Skip to contentSkip to conversation

streamline_config clean-ups

RFC In review Arnaud Lacombe 4 participants 14 messages Jul 1, 2011 – Jul 25, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover streamline_config clean-ups

Hi,

The following series attempts to merge some redundants stuff in the kconfig Makefile, namely how streamline_config learns about its environment, avoids multi-line shell command in kconfig's Makefile. Seconds commit also removes the non-portable usage of sed(1) as -i is not POSIX compliant.

Comments appreciated!

- Arnaud

ps: I'm not really a huge fan of the direct export of MAKECMDGOALS, maybe should it be KBUILD_MAKECMDGOALS.

Arnaud Lacombe (4):
kbuild: export MAKECMDGOALS kconfig/streamline_config.pl: directly access LSMOD kconfig/streamline_config.pl: merge local{mod,yes}config kconfig/streamline_config.pl: move config generation to script

 Makefile                             |    3 ++
 scripts/kconfig/Makefile             |   40 +--------------------------------
 scripts/kconfig/localconfig.sh       |   20 +++++++++++++++++
 scripts/kconfig/streamline_config.pl |   19 +++++++++++++--
 4 files changed, 41 insertions(+), 41 deletions(-)
 create mode 100755 scripts/kconfig/localconfig.sh
Signature · 1 line
1.7.3.4.574.g608b.dirty
#1 lore raw

RFC 1/4 kbuild: export MAKECMDGOALS

Cc Steven Rostedt <[email protected]>
---
 Makefile |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
Makefile +3 -0
index afb8e0d..ea517fd 100644
@@ -22,6 +22,9 @@ LC_COLLATE=C
 LC_NUMERIC=C
 export LC_COLLATE LC_NUMERIC
 
+# Export make goals
+export MAKECMDGOALS
+
 # We are using a recursive build, so we need to do a little thinking
 # to get the ordering right.
 #
Signature · 1 line
1.7.3.4.574.g608b.dirty
#2 lore raw

Re: [RFC 1/4] kbuild: export MAKECMDGOALS

Hi,

Quoted 17 lines · Arnaud Lacombe
Cc Steven Rostedt <[email protected]>

---
 Makefile |    3 +++

 1 files changed, 3 insertions(+), 0 deletions(-)
Makefile +0 -0
index afb8e0d..ea517fd 100644
@@ -22,6 +22,9 @@ LC_COLLATE=C

 LC_NUMERIC=C
 export LC_COLLATE LC_NUMERIC

Makefile +3 -0
+# Export make goals
+export MAKECMDGOALS
+

 # We are using a recursive build, so we need to do a little thinking

Quoted 2 lines
 # to get the ordering right.
 #

Michal, before I send a new version of this serie, can you tell me your point of view on the export of MAKECMDGOALS (or KBUILD_MAKECMDGOALS) and Kconfig to the environment ?

Thanks,
- Arnaud

#3 lore raw

Re: [RFC 1/4] kbuild: export MAKECMDGOALS

Quoted 16 lines · Arnaud Lacombe

Hi,

Quoted 13 lines · Arnaud Lacombe
Cc Steven Rostedt<[email protected]>
---
  Makefile |    3 +++
  1 files changed, 3 insertions(+), 0 deletions(-)
Makefile +0 -0
index afb8e0d..ea517fd 100644
@@ -22,6 +22,9 @@ LC_COLLATE=C
  LC_NUMERIC=C
  export LC_COLLATE LC_NUMERIC
 
Quoted 9 lines

Makefile LC_COLLATE=C · line 30

Quoted 6 lines
Makefile +3 -0
+# Export make goals
+export MAKECMDGOALS
+
  # We are using a recursive build, so we need to do a little thinking
  # to get the ordering right.
  #

Michal, before I send a new version of this serie, can you tell me your point of view on the export of MAKECMDGOALS (or KBUILD_MAKECMDGOALS) and Kconfig to the environment ?

A cleaner interface would IMO be to check the target in the makefile and pass a commandline option to streamline_config.pl, so that it's easier to run it manually.

Michal

#4 lore raw

Re: [RFC 1/4] kbuild: export MAKECMDGOALS

Hi,

Quoted 30 lines · Michal Marek
Quoted 18 lines · Arnaud Lacombe

Hi,

Quoted 14 lines · Arnaud Lacombe
Cc Steven Rostedt<[email protected]>

---
 Makefile |    3 +++

 1 files changed, 3 insertions(+), 0 deletions(-)
Makefile +0 -0
index afb8e0d..ea517fd 100644
@@ -22,6 +22,9 @@ LC_COLLATE=C

 LC_NUMERIC=C
 export LC_COLLATE LC_NUMERIC

Quoted 10 lines
Quoted 6 lines
Makefile +3 -0
+# Export make goals
+export MAKECMDGOALS
+

 # We are using a recursive build, so we need to do a little thinking

 # to get the ordering right.
 #

Michal, before I send a new version of this serie, can you tell me your point of view on the export of MAKECMDGOALS (or KBUILD_MAKECMDGOALS) and Kconfig to the environment ?

Quoted 4 lines

A cleaner interface would IMO be to check the target in the makefile and pass a commandline option to streamline_config.pl, so that it's easier to run it manually.

thanks, I'll do the same for $(Kconfig), ie. pass it on the command line.

- Arnaud

#5 lore raw

Re: [RFC 1/4] kbuild: export MAKECMDGOALS

In reply to Michal Marek
Quoted 27 lines · Michal Marek
Quoted 16 lines · Arnaud Lacombe

Hi,

Quoted 13 lines · Arnaud Lacombe
Cc Steven Rostedt<[email protected]>
---
  Makefile |    3 +++
  1 files changed, 3 insertions(+), 0 deletions(-)
Makefile +0 -0
index afb8e0d..ea517fd 100644
@@ -22,6 +22,9 @@ LC_COLLATE=C
  LC_NUMERIC=C
  export LC_COLLATE LC_NUMERIC
 
Quoted 9 lines

Makefile LC_COLLATE=C · line 30

Quoted 6 lines
Makefile +3 -0
+# Export make goals
+export MAKECMDGOALS
+
  # We are using a recursive build, so we need to do a little thinking
  # to get the ordering right.
  #

Michal, before I send a new version of this serie, can you tell me your point of view on the export of MAKECMDGOALS (or KBUILD_MAKECMDGOALS) and Kconfig to the environment ?

Quoted 3 lines

A cleaner interface would IMO be to check the target in the makefile and pass a commandline option to streamline_config.pl, so that it's easier to run it manually.

I agree with this. As I've been told by many people that they prefer to run streamline_config.pl directly.

-- Steve

#6 lore raw

RFC 2/4 kconfig/streamline_config.pl: directly access LSMOD

In reply to Arnaud Lacombe
Cc Steven Rostedt <[email protected]>
---
 scripts/kconfig/Makefile             |   12 ++----------
 scripts/kconfig/streamline_config.pl |    8 ++++++--
 2 files changed, 8 insertions(+), 12 deletions(-)
scripts/kconfig/Makefile +2 -10
index 84abb2f..a718b3c 100644
@@ -33,17 +33,9 @@ silentoldconfig: $(obj)/conf
 	$(Q)mkdir -p include/generated
 	$< --$@ $(Kconfig)
 
-# if no path is given, then use src directory to find file
-ifdef LSMOD
-LSMOD_F := $(LSMOD)
-ifeq ($(findstring /,$(LSMOD)),)
-  LSMOD_F := $(objtree)/$(LSMOD)
-endif
-endif
-
 localmodconfig: $(obj)/streamline_config.pl $(obj)/conf
 	$(Q)mkdir -p include/generated
-	$(Q)perl $< $(srctree) $(Kconfig) $(LSMOD_F) > .tmp.config
+	$(Q)perl $< $(srctree) $(Kconfig) > .tmp.config
 	$(Q)if [ -f .config ]; then 					\
 			cmp -s .tmp.config .config ||			\
 			(mv -f .config .config.old.1;			\
@@ -58,7 +50,7 @@ localmodconfig: $(obj)/streamline_config.pl $(obj)/conf
 
 localyesconfig: $(obj)/streamline_config.pl $(obj)/conf
 	$(Q)mkdir -p include/generated
-	$(Q)perl $< $(srctree) $(Kconfig) $(LSMOD_F) > .tmp.config
+	$(Q)perl $< $(srctree) $(Kconfig) > .tmp.config
 	$(Q)sed -i s/=m/=y/ .tmp.config
 	$(Q)if [ -f .config ]; then					\
 			cmp -s .tmp.config .config ||			\
scripts/kconfig/streamline_config.pl +6 -2
index a4fe923..ae34d20 100644
@@ -115,7 +115,7 @@ find_config;
 # Get the build source and top level Kconfig file (passed in)
 my $ksource = $ARGV[0];
 my $kconfig = $ARGV[1];
-my $lsmod_file = $ARGV[2];
+my $lsmod_file = $ENV{'LSMOD'};
 
 my @makefiles = `find $ksource -name Makefile 2>/dev/null`;
 chomp @makefiles;
@@ -296,7 +296,11 @@ my %modules;
 
 if (defined($lsmod_file)) {
     if ( ! -f $lsmod_file) {
-	die "$lsmod_file not found";
+	if ( -f $ENV{'objtree'}."/".$lsmod_file) {
+	    $lsmod_file = $ENV{'objtree'}."/".$lsmod_file;
+	} else {
+		die "$lsmod_file not found";
+	}
     }
     if ( -x $lsmod_file) {
 	# the file is executable, run it
Signature · 1 line
1.7.3.4.574.g608b.dirty
#7 lore raw

RFC 3/4 kconfig/streamline_config.pl: merge local{mod,yes}config

In reply to Arnaud Lacombe

The two targets localmodconfig' and localyesconfig' only differs from the sed(1) ran on the result of streamline_config.pl' to convert symbols set to modules' to `yes'. This conversion can be made directly from the perl script, and thus avoid duplicating the command to generate the configuration.

Cc Steven Rostedt <[email protected]>
---
 scripts/kconfig/Makefile             |   18 +-----------------
 scripts/kconfig/streamline_config.pl |   11 ++++++++++-
 2 files changed, 11 insertions(+), 18 deletions(-)
scripts/kconfig/Makefile +1 -17
index a718b3c..8a59adf 100644
@@ -33,7 +33,7 @@ silentoldconfig: $(obj)/conf
 	$(Q)mkdir -p include/generated
 	$< --$@ $(Kconfig)
 
-localmodconfig: $(obj)/streamline_config.pl $(obj)/conf
+localyesconfig localmodconfig: $(obj)/streamline_config.pl $(obj)/conf
 	$(Q)mkdir -p include/generated
 	$(Q)perl $< $(srctree) $(Kconfig) > .tmp.config
 	$(Q)if [ -f .config ]; then 					\
@@ -48,22 +48,6 @@ localmodconfig: $(obj)/streamline_config.pl $(obj)/conf
 	fi
 	$(Q)rm -f .tmp.config
 
-localyesconfig: $(obj)/streamline_config.pl $(obj)/conf
-	$(Q)mkdir -p include/generated
-	$(Q)perl $< $(srctree) $(Kconfig) > .tmp.config
-	$(Q)sed -i s/=m/=y/ .tmp.config
-	$(Q)if [ -f .config ]; then					\
-			cmp -s .tmp.config .config ||			\
-			(mv -f .config .config.old.1;			\
-			 mv -f .tmp.config .config;			\
-			 $(obj)/conf --silentoldconfig $(Kconfig);	\
-			 mv -f .config.old.1 .config.old)		\
-	else								\
-			mv -f .tmp.config .config;			\
-			$(obj)/conf --silentoldconfig $(Kconfig);	\
-	fi
-	$(Q)rm -f .tmp.config
-
 # Create new linux.pot file
 # Adjust charset to UTF-8 in .po file to accept UTF-8 in Kconfig files
 # The symlink is used to repair a deficiency in arch/um
scripts/kconfig/streamline_config.pl +10 -1
index ae34d20..c762d9d 100644
@@ -117,6 +117,11 @@ my $ksource = $ARGV[0];
 my $kconfig = $ARGV[1];
 my $lsmod_file = $ENV{'LSMOD'};
 
+my $localyesconfig = 0;
+if ($ENV{'MAKECMDGOALS'} =~ /.*localyesconfig.*/) {
+	$localyesconfig = 1;
+}
+
 my @makefiles = `find $ksource -name Makefile 2>/dev/null`;
 chomp @makefiles;
 
@@ -425,7 +430,11 @@ while(<CIN>) {
 
     if (/^(CONFIG.*)=(m|y)/) {
 	if (defined($configs{$1})) {
-	    $setconfigs{$1} = $2;
+	    if ($localyesconfig) {
+	        $setconfigs{$1} = 'y';
+	    } else {
+	        $setconfigs{$1} = $2;
+	    }
 	} elsif ($2 eq "m") {
 	    print "# $1 is not set\n";
 	    next;
Signature · 1 line
1.7.3.4.574.g608b.dirty
#8 lore raw

RFC 4/4 kconfig/streamline_config.pl: move config generation to script

In reply to Arnaud Lacombe

This avoid having to deals with multiline shell command in the Makefile and increase readability.

Cc Steven Rostedt <[email protected]>
---
 scripts/kconfig/Makefile       |   14 +-------------
 scripts/kconfig/localconfig.sh |   20 ++++++++++++++++++++
 2 files changed, 21 insertions(+), 13 deletions(-)
 create mode 100755 scripts/kconfig/localconfig.sh
scripts/kconfig/Makefile +1 -13
index 8a59adf..d48ddc9 100644
@@ -34,19 +34,7 @@ silentoldconfig: $(obj)/conf
 	$< --$@ $(Kconfig)
 
 localyesconfig localmodconfig: $(obj)/streamline_config.pl $(obj)/conf
-	$(Q)mkdir -p include/generated
-	$(Q)perl $< $(srctree) $(Kconfig) > .tmp.config
-	$(Q)if [ -f .config ]; then 					\
-			cmp -s .tmp.config .config ||			\
-			(mv -f .config .config.old.1;			\
-			 mv -f .tmp.config .config;			\
-			 $(obj)/conf --silentoldconfig $(Kconfig);	\
-			 mv -f .config.old.1 .config.old)		\
-	else								\
-			mv -f .tmp.config .config;			\
-			$(obj)/conf --silentoldconfig $(Kconfig);	\
-	fi
-	$(Q)rm -f .tmp.config
+	$(Q)$(src)/localconfig.sh
 
 # Create new linux.pot file
 # Adjust charset to UTF-8 in .po file to accept UTF-8 in Kconfig files
scripts/kconfig/localconfig.sh new file +20 -0
new file mode 100755
index 0000000..64dd295
@@ -0,0 +1,20 @@
+#!/bin/sh
+#
+
+mkdir -p include/generated
+
+perl "${srctree}/scripts/kconfig/streamline_config.pl" ${srctree}/ ${Kconfig} $1 > .tmp.config
+
+if [ -f .config ]; then
+	if ! cmp -s .tmp.config .config; then
+		mv -f .config .config.old.1
+		mv -f .tmp.config .config
+		${obj}/conf --silentoldconfig ${Kconfig}
+		mv -f .config.old.1 .config.old
+	fi
+else
+	mv -f .tmp.config .config
+	${obj}/conf --silentoldconfig ${Kconfig}
+fi
+
+rm -f .tmp.config
Signature · 1 line
1.7.3.4.574.g608b.dirty
#9 lore raw
In reply to Arnaud Lacombe

Hi,

Quoted 11 lines · Arnaud Lacombe

Hi,

The following series attempts to merge some redundants stuff in the kconfig Makefile, namely how streamline_config learns about its environment, avoids multi-line shell command in kconfig's Makefile. Seconds commit also removes the non-portable usage of sed(1) as -i is not POSIX compliant.

Comments appreciated!

 - Arnaud

Ping ?

Thanks,
- Arnaud

Quoted 20 lines

ps: I'm not really a huge fan of the direct export of MAKECMDGOALS, maybe should it be KBUILD_MAKECMDGOALS.

Arnaud Lacombe (4):
 kbuild: export MAKECMDGOALS kconfig/streamline_config.pl: directly access LSMOD kconfig/streamline_config.pl: merge local{mod,yes}config kconfig/streamline_config.pl: move config generation to script

 Makefile                             |    3 ++ scripts/kconfig/Makefile             |   40 +-------------------------------- scripts/kconfig/localconfig.sh       |   20 +++++++++++++++++ scripts/kconfig/streamline_config.pl |   19 +++++++++++++--

 4 files changed, 41 insertions(+), 41 deletions(-)

 create mode 100755 scripts/kconfig/localconfig.sh

--
1.7.3.4.574.g608b.dirty

#10 lore raw
Quoted 10 lines · Arnaud Lacombe

Hi,

Quoted 7 lines · Arnaud Lacombe

Hi,

The following series attempts to merge some redundants stuff in the kconfig Makefile, namely how streamline_config learns about its environment, avoids multi-line shell command in kconfig's Makefile. Seconds commit also removes the non-portable usage of sed(1) as -i is not POSIX compliant.

Quoted 5 lines
Quoted 4 lines

Comments appreciated!

- Arnaud

Ping ?

Ah sorry, I do plan on looking at this but have been busy doing other things. Note, if you want a quicker response, mail me at [email protected]. I mostly just get spam in my redhat.com account, and do not have the patch filters I do with my goodmis.org account. Speaking of which, you still want [PATCH] in your subject. ie. [RFC][PATCH 0/4] ....

My procmail moves emails to me with [.*PATCH.*] into a separate folder that I look at to put into my todo list.

Thanks,

-- Steve

Quoted 24 lines

Thanks,
- Arnaud

Quoted 20 lines

ps: I'm not really a huge fan of the direct export of MAKECMDGOALS, maybe should it be KBUILD_MAKECMDGOALS.

Arnaud Lacombe (4):
kbuild: export MAKECMDGOALS kconfig/streamline_config.pl: directly access LSMOD kconfig/streamline_config.pl: merge local{mod,yes}config kconfig/streamline_config.pl: move config generation to script

 Makefile                             |    3 ++
 scripts/kconfig/Makefile             |   40 +--------------------------------
 scripts/kconfig/localconfig.sh       |   20 +++++++++++++++++
 scripts/kconfig/streamline_config.pl |   19 +++++++++++++--
 4 files changed, 41 insertions(+), 41 deletions(-)
 create mode 100755 scripts/kconfig/localconfig.sh

--
1.7.3.4.574.g608b.dirty

#11 lore raw
Quoted 11 lines · Steven Rostedt
Quoted 10 lines · Arnaud Lacombe

Hi,

Quoted 7 lines · Arnaud Lacombe

Hi,

The following series attempts to merge some redundants stuff in the kconfig Makefile, namely how streamline_config learns about its environment, avoids multi-line shell command in kconfig's Makefile. Seconds commit also removes the non-portable usage of sed(1) as -i is not POSIX compliant.

Quoted 5 lines
Quoted 5 lines
Quoted 4 lines

Comments appreciated!

- Arnaud

Ping ?

I just tried your patches out. It breaks when we compile for another directory. I just tried:

$ make LSMOD=/tmp/lsmod O=../machine/build/ localmodconfig

and it it did not work.

-- Steve

#12 lore raw

Hi,

Quoted 16 lines · Steven Rostedt
Quoted 15 lines · Steven Rostedt
Quoted 14 lines · Arnaud Lacombe

Hi,

Quoted 11 lines · Arnaud Lacombe

Hi,

The following series attempts to merge some redundants stuff in the kconfig Makefile, namely how streamline_config learns about its environment, avoids multi-line shell command in kconfig's Makefile. Seconds commit also removes the non-portable usage of sed(1) as -i is not POSIX compliant.

Comments appreciated!

 - Arnaud

Quoted 9 lines
Quoted 1 line
Quoted 1 line

Ping ?

I just tried your patches out. It breaks when we compile for another directory. I just tried:

$ make LSMOD=/tmp/lsmod O=../machine/build/ localmodconfig

and it it did not work.

yes... it could not have. I missed a $(srctree), an export, and an error check. Attached patch should fix it, behavior (see below) with this patch is consistent between v3.0-rc6 and the tip of the patched branch.

Btw, as of v3.0-rc6, localmodconfig does not produce a valid .config. Local kernel is a Fedora 14 kernel, based on config-2.6.35.13-91.fc14.x86_64. The perl script complete fine, but the config is then restarted, I'm not sure if it is the intended behavior.

- Arnaud

From d6e7caf197c10b448da873c27cf5ef89f9bcf4b2 Mon Sep 17 00:00:00 2001
From: Arnaud Lacombe <[email protected]>
Date: Wed, 13 Jul 2011 22:29:24 -0400
Subject: [PATCH] fix

---
 scripts/kconfig/Makefile       |    4 +++-
 scripts/kconfig/localconfig.sh |    2 ++
 2 files changed, 5 insertions(+), 1 deletions(-)
scripts/kconfig/Makefile +3 -1
index d48ddc9..1bf4375 100644
@@ -11,6 +11,8 @@ else
 Kconfig := Kconfig
 endif
 
+export Kconfig
+
 xconfig: $(obj)/qconf
 	$< $(Kconfig)
 
@@ -34,7 +36,7 @@ silentoldconfig: $(obj)/conf
 	$< --$@ $(Kconfig)
 
 localyesconfig localmodconfig: $(obj)/streamline_config.pl $(obj)/conf
-	$(Q)$(src)/localconfig.sh
+	$(Q)$(srctree)/$(src)/localconfig.sh
 
 # Create new linux.pot file
 # Adjust charset to UTF-8 in .po file to accept UTF-8 in Kconfig files
scripts/kconfig/localconfig.sh +2 -0
index 64dd295..f8185fb 100755
@@ -1,6 +1,8 @@
 #!/bin/sh
 #
 
+set -e
+
 mkdir -p include/generated
 
 perl "${srctree}/scripts/kconfig/streamline_config.pl" ${srctree}/ ${Kconfig} $1 > .tmp.config
Signature · 1 line
1.7.3.4.574.g608b.dirty
#13 lore raw
Quoted 4 lines · Arnaud Lacombe

yes... it could not have. I missed a $(srctree), an export, and an error check. Attached patch should fix it, behavior (see below) with this patch is consistent between v3.0-rc6 and the tip of the patched branch.

That seems to work. Could you resend a fixed patchset?

Quoted 6 lines

Btw, as of v3.0-rc6, localmodconfig does not produce a valid .config. Local kernel is a Fedora 14 kernel, based on config-2.6.35.13-91.fc14.x86_64. The perl script complete fine, but the config is then restarted, I'm not sure if it is the intended behavior.

Hmm, not sure exactly what you mean. The script should run (silent)oldconfig after it does the localmodconfig to fill in the stuff that it caused to change. Did you notice something that broke?

-- Steve