streamline_config clean-ups
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
RFC 1/4 kbuild: export MAKECMDGOALS
--- Makefile | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
Makefile +3 -0
@@ -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
RFC 2/4 kconfig/streamline_config.pl: directly access LSMOD
In reply to Arnaud Lacombe--- scripts/kconfig/Makefile | 12 ++---------- scripts/kconfig/streamline_config.pl | 8 ++++++-- 2 files changed, 8 insertions(+), 12 deletions(-)
scripts/kconfig/Makefile +2 -10
@@ -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
@@ -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
RFC 3/4 kconfig/streamline_config.pl: merge local{mod,yes}config
In reply to Arnaud LacombeThe 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.
--- scripts/kconfig/Makefile | 18 +----------------- scripts/kconfig/streamline_config.pl | 11 ++++++++++- 2 files changed, 11 insertions(+), 18 deletions(-)
scripts/kconfig/Makefile +1 -17
@@ -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
@@ -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
RFC 4/4 kconfig/streamline_config.pl: move config generation to script
In reply to Arnaud LacombeThis avoid having to deals with multiline shell command in the Makefile and increase readability.
--- 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
@@ -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
@@ -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
Hi,
Quoted 11 lines · Arnaud Lacombe
Hi,
The following series attempts to merge some redundants stuff in the kconfig
Makefile, namely howstreamline_configlearns about its environment, avoids multi-line shell command in kconfig'sMakefile. 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 MAKECMDGOALSkconfig/streamline_config.pl: directly access LSMODkconfig/streamline_config.pl: merge local{mod,yes}configkconfig/streamline_config.pl: move config generation to scriptMakefile | 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
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 howstreamline_configlearns about its environment, avoids multi-line shell command in kconfig'sMakefile. 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,
- ArnaudQuoted 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 MAKECMDGOALSkconfig/streamline_config.pl: directly access LSMODkconfig/streamline_config.pl: merge local{mod,yes}configkconfig/streamline_config.pl: move config generation to scriptMakefile | 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
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 howstreamline_configlearns about its environment, avoids multi-line shell command in kconfig'sMakefile. 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
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 howstreamline_configlearns about its environment, avoids multi-line shell command in kconfig'sMakefile. 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/ localmodconfigand 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
@@ -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
@@ -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
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
Re: [RFC 1/4] kbuild: export MAKECMDGOALS
In reply to Arnaud LacombeHi,
Quoted 17 lines · Arnaud Lacombe
Cc Steven Rostedt <[email protected]>---
Makefile | 3 +++1 files changed, 3 insertions(+), 0 deletions(-)Makefile +0
-0@@ -22,6 +22,9 @@ LC_COLLATE=CLC_NUMERIC=C
exportLC_COLLATELC_NUMERICMakefile +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
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@@ -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) andKconfigto 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
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@@ -22,6 +22,9 @@ LC_COLLATE=CLC_NUMERIC=C
exportLC_COLLATELC_NUMERICQuoted 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) andKconfigto 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
Re: [RFC 1/4] kbuild: export MAKECMDGOALS
In reply to Michal MarekQuoted 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@@ -22,6 +22,9 @@ LC_COLLATE=C LC_NUMERIC=C export LC_COLLATE LC_NUMERICQuoted 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) andKconfigto 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