public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4][linux-next] kconfig: Updates to localmodconfig
@ 2010-02-03 15:46 Steven Rostedt
  2010-02-03 15:46 ` [PATCH 1/4] kconfig: Create include/generated for localmodconfig Steven Rostedt
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Steven Rostedt @ 2010-02-03 15:46 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-kbuild, Andrew Morton, Anibal Monsalve Salazar,
	Michal Marek

I'm posting the following patches for review. I've added these
to go into linux-next. They can be found in the git repo shown
below:

  git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-kconfig.git
for-linus-2


Steven Rostedt (4):
      kconfig: Create include/generated for localmodconfig
      kconfig: Check for if conditions in Kconfig for localmodconfig
      kconfig: Look in both /bin and /sbin for lsmod in streamline_config.pl
      kconfig: Add LSMOD=file to override the lsmod for localmodconfig

----
 scripts/kconfig/Makefile             |   15 +++++++-
 scripts/kconfig/streamline_config.pl |   59 ++++++++++++++++++++++++++++++++-
 2 files changed, 70 insertions(+), 4 deletions(-)

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/4] kconfig: Create include/generated for localmodconfig
  2010-02-03 15:46 [PATCH 0/4][linux-next] kconfig: Updates to localmodconfig Steven Rostedt
@ 2010-02-03 15:46 ` Steven Rostedt
  2010-02-03 15:46 ` [PATCH 2/4] kconfig: Check for if conditions in Kconfig " Steven Rostedt
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 9+ messages in thread
From: Steven Rostedt @ 2010-02-03 15:46 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-kbuild, Andrew Morton, Anibal Monsalve Salazar,
	Michal Marek

[-- Attachment #1: 0001-kconfig-Create-include-generated-for-localmodconfig.patch --]
[-- Type: text/plain, Size: 1242 bytes --]

From: Steven Rostedt <srostedt@redhat.com>

If someone downloads a brand new kernel and runs localmodconfig or
localyesconfig, the ending result will report:

 *** Error during update of the kernel configuration.

This is because localmodconfig and localyesconfig must create the
include/generated directory to place the autoconf.h file.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 scripts/kconfig/Makefile |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index 999e8a7..006c96f 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -31,6 +31,7 @@ silentoldconfig: $(obj)/conf
 	$< -s $(Kconfig)
 
 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 ||		\
@@ -45,6 +46,7 @@ localmodconfig: $(obj)/streamline_config.pl $(obj)/conf
 	$(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 				\
-- 
1.6.5



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/4] kconfig: Check for if conditions in Kconfig for localmodconfig
  2010-02-03 15:46 [PATCH 0/4][linux-next] kconfig: Updates to localmodconfig Steven Rostedt
  2010-02-03 15:46 ` [PATCH 1/4] kconfig: Create include/generated for localmodconfig Steven Rostedt
@ 2010-02-03 15:46 ` Steven Rostedt
  2010-02-03 15:46 ` [PATCH 3/4] kconfig: Look in both /bin and /sbin for lsmod in streamline_config.pl Steven Rostedt
  2010-02-03 15:46 ` [PATCH 4/4] kconfig: Add LSMOD=file to override the lsmod for localmodconfig Steven Rostedt
  3 siblings, 0 replies; 9+ messages in thread
From: Steven Rostedt @ 2010-02-03 15:46 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-kbuild, Andrew Morton, Anibal Monsalve Salazar,
	Michal Marek, Anton Blanchard

[-- Attachment #1: 0002-kconfig-Check-for-if-conditions-in-Kconfig-for-local.patch --]
[-- Type: text/plain, Size: 1972 bytes --]

From: Steven Rostedt <srostedt@redhat.com>

The streamline_config.pl misses the if conditions for checking
dependencies. For Kconfigs with the following construct:

 if MEDIA_SUPPORT

 config VIDEO_DEV

 [...]

If VIDEO_DEV was enabled, the script will miss the fact that MEDIA_SUPPORT
is also needed.

This patch changes streamline_config.pl to include if conditions into
the dependencies of configs.

Reported-by: Anton Blanchard <anton@sambo.org>
Tested-by: Anton Blanchard <anton@sambo.org>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 scripts/kconfig/streamline_config.pl |   26 ++++++++++++++++++++++++++
 1 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/scripts/kconfig/streamline_config.pl b/scripts/kconfig/streamline_config.pl
index 0d80082..9e66fa8 100644
--- a/scripts/kconfig/streamline_config.pl
+++ b/scripts/kconfig/streamline_config.pl
@@ -121,6 +121,8 @@ my %prompts;
 my %objects;
 my $var;
 my $cont = 0;
+my $iflevel = 0;
+my @ifdeps;
 
 # prevent recursion
 my %read_kconfigs;
@@ -146,6 +148,15 @@ sub read_kconfig {
 	    $state = "NEW";
 	    $config = $1;
 
+	    for (my $i = 0; $i < $iflevel; $i++) {
+		if ($i) {
+		    $depends{$config} .= " " . $ifdeps[$i];
+		} else {
+		    $depends{$config} = $ifdeps[$i];
+		}
+		$state = "DEP";
+	    }
+
 	# collect the depends for the config
 	} elsif ($state eq "NEW" && /^\s*depends\s+on\s+(.*)$/) {
 	    $state = "DEP";
@@ -166,6 +177,21 @@ sub read_kconfig {
 	    # note if the config has a prompt
 	    $prompt{$config} = 1;
 
+	# Check for if statements
+	} elsif (/^if\s+(.*\S)\s*$/) {
+	    my $deps = $1;
+	    # remove beginning and ending non text
+	    $deps =~ s/^[^a-zA-Z0-9_]*//;
+	    $deps =~ s/[^a-zA-Z0-9_]*$//;
+
+	    my @deps = split /[^a-zA-Z0-9_]+/, $deps;
+
+	    $ifdeps[$iflevel++] = join ':', @deps;
+
+	} elsif (/^endif/) {
+
+	    $iflevel-- if ($iflevel);
+
 	# stop on "help"
 	} elsif (/^\s*help\s*$/) {
 	    $state = "NONE";
-- 
1.6.5



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/4] kconfig: Look in both /bin and /sbin for lsmod in streamline_config.pl
  2010-02-03 15:46 [PATCH 0/4][linux-next] kconfig: Updates to localmodconfig Steven Rostedt
  2010-02-03 15:46 ` [PATCH 1/4] kconfig: Create include/generated for localmodconfig Steven Rostedt
  2010-02-03 15:46 ` [PATCH 2/4] kconfig: Check for if conditions in Kconfig " Steven Rostedt
@ 2010-02-03 15:46 ` Steven Rostedt
  2010-02-03 15:46 ` [PATCH 4/4] kconfig: Add LSMOD=file to override the lsmod for localmodconfig Steven Rostedt
  3 siblings, 0 replies; 9+ messages in thread
From: Steven Rostedt @ 2010-02-03 15:46 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-kbuild, Andrew Morton, Anibal Monsalve Salazar,
	Michal Marek, Xavier Chantry

[-- Attachment #1: 0003-kconfig-Look-in-both-bin-and-sbin-for-lsmod-in-strea.patch --]
[-- Type: text/plain, Size: 1274 bytes --]

From: Steven Rostedt <srostedt@redhat.com>

Distributions now have lsmod in /bin instead of /sbin. But to handle
both cases, we look for it in /sbin /bin /usr/bin and /usr/sbin.
If lsmod is not found in any of those paths, it defaults to use
just lsmod and hopes that it lies in the path of the user.

Tested-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 scripts/kconfig/streamline_config.pl |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/scripts/kconfig/streamline_config.pl b/scripts/kconfig/streamline_config.pl
index 9e66fa8..d7f7db7 100644
--- a/scripts/kconfig/streamline_config.pl
+++ b/scripts/kconfig/streamline_config.pl
@@ -264,7 +264,20 @@ foreach my $makefile (@makefiles) {
 my %modules;
 
 # see what modules are loaded on this system
-open(LIN,"/sbin/lsmod|") || die "Cant lsmod";
+my $lsmod;
+
+foreach $dir ( ("/sbin", "/bin", "/usr/sbin", "/usr/bin") ) {
+    if ( -x "$dir/lsmod" ) {
+	$lsmod = "$dir/lsmod";
+	last;
+    }
+}
+if (!defined($lsmod)) {
+    # try just the path
+    $lsmod = "lsmod";
+}
+
+open(LIN,"$lsmod|") || die "Can not call lsmod with $lsmod";
 while (<LIN>) {
 	next if (/^Module/);  # Skip the first line.
 	if (/^(\S+)/) {
-- 
1.6.5



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 4/4] kconfig: Add LSMOD=file to override the lsmod for localmodconfig
  2010-02-03 15:46 [PATCH 0/4][linux-next] kconfig: Updates to localmodconfig Steven Rostedt
                   ` (2 preceding siblings ...)
  2010-02-03 15:46 ` [PATCH 3/4] kconfig: Look in both /bin and /sbin for lsmod in streamline_config.pl Steven Rostedt
@ 2010-02-03 15:46 ` Steven Rostedt
  2010-02-03 16:07   ` Michal Marek
  3 siblings, 1 reply; 9+ messages in thread
From: Steven Rostedt @ 2010-02-03 15:46 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-kbuild, Andrew Morton, Anibal Monsalve Salazar,
	Michal Marek

[-- Attachment #1: 0004-kconfig-Add-LSMOD-file-to-override-the-lsmod-for-loc.patch --]
[-- Type: text/plain, Size: 3902 bytes --]

From: Steven Rostedt <srostedt@redhat.com>

Doing the following:

	make LSMOD=file localmodconfig

Will make the streamline-config code use the given file instead of
lsmod. If the file is an executable, it will execute it, otherwise
it will read it as text.

	make LSMOD=/my/local/path/lsmod localmodconfig

The above will execute the lsmod in /my/local/path instead of the
lsmods that may be located elsewhere.

	make LSMOD=embedded_board_lsmod localmodconfig

The above will read the "embedded_board_lsmod" as a text file. This
is useful if you are doing a cross compile and need to run the
config against modules that exist on an embedded device.

Note, if the LSMOD= file does is not a path, it will add the
path to the object directory. That is, the above example will look
for "embedded_board_lsmod" in the directory that the binary will
be built in (the O=dir directory).

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>

 On branch config/linus
---
 scripts/kconfig/Makefile             |   13 +++++++++-
 scripts/kconfig/streamline_config.pl |   38 ++++++++++++++++++++++++---------
 2 files changed, 38 insertions(+), 13 deletions(-)

diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index 006c96f..85b9065 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -30,9 +30,18 @@ silentoldconfig: $(obj)/conf
 	$(Q)mkdir -p include/generated
 	$< -s $(Kconfig)
 
+# if no path is given, then use src directory to find file
+ifdef LSMOD
+LSMOD_F = $(shell if [ `basename $(LSMOD)` == $(LSMOD) ]; then \
+		echo $(objtree)/$(LSMOD);			\
+	else							\
+		echo $(LSMOD);					\
+	fi)
+endif
+
 localmodconfig: $(obj)/streamline_config.pl $(obj)/conf
 	$(Q)mkdir -p include/generated
-	$(Q)perl $< $(srctree) $(Kconfig) > .tmp.config
+	$(Q)perl $< $(srctree) $(Kconfig) $(LSMOD_F) > .tmp.config
 	$(Q)if [ -f .config ]; then 				\
 			cmp -s .tmp.config .config ||		\
 			(mv -f .config .config.old.1;		\
@@ -47,7 +56,7 @@ localmodconfig: $(obj)/streamline_config.pl $(obj)/conf
 
 localyesconfig: $(obj)/streamline_config.pl $(obj)/conf
 	$(Q)mkdir -p include/generated
-	$(Q)perl $< $(srctree) $(Kconfig) > .tmp.config
+	$(Q)perl $< $(srctree) $(Kconfig) $(LSMOD_F) > .tmp.config
 	$(Q)sed -i s/=m/=y/ .tmp.config
 	$(Q)if [ -f .config ]; then 				\
 			cmp -s .tmp.config .config ||		\
diff --git a/scripts/kconfig/streamline_config.pl b/scripts/kconfig/streamline_config.pl
index d7f7db7..afbd54a 100644
--- a/scripts/kconfig/streamline_config.pl
+++ b/scripts/kconfig/streamline_config.pl
@@ -113,6 +113,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 @makefiles = `find $ksource -name Makefile`;
 my %depends;
@@ -263,21 +264,36 @@ foreach my $makefile (@makefiles) {
 
 my %modules;
 
-# see what modules are loaded on this system
-my $lsmod;
-
-foreach $dir ( ("/sbin", "/bin", "/usr/sbin", "/usr/bin") ) {
-    if ( -x "$dir/lsmod" ) {
-	$lsmod = "$dir/lsmod";
-	last;
+if (defined($lsmod_file)) {
+    if ( ! -f $lsmod_file) {
+	die "$lsmod_file not found";
+    }
+    if ( -x $lsmod_file) {
+	# the file is executable, run it
+	open(LIN, "$lsmod_file|");
+    } else {
+	# Just read the contents
+	open(LIN, "$lsmod_file");
     }
+} else {
+
+    # see what modules are loaded on this system
+    my $lsmod;
+
+    foreach $dir ( ("/sbin", "/bin", "/usr/sbin", "/usr/bin") ) {
+	if ( -x "$dir/lsmod" ) {
+	    $lsmod = "$dir/lsmod";
+	    last;
+	}
 }
-if (!defined($lsmod)) {
-    # try just the path
-    $lsmod = "lsmod";
+    if (!defined($lsmod)) {
+	# try just the path
+	$lsmod = "lsmod";
+    }
+
+    open(LIN,"$lsmod|") || die "Can not call lsmod with $lsmod";
 }
 
-open(LIN,"$lsmod|") || die "Can not call lsmod with $lsmod";
 while (<LIN>) {
 	next if (/^Module/);  # Skip the first line.
 	if (/^(\S+)/) {
-- 
1.6.5



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 4/4] kconfig: Add LSMOD=file to override the lsmod for localmodconfig
  2010-02-03 15:46 ` [PATCH 4/4] kconfig: Add LSMOD=file to override the lsmod for localmodconfig Steven Rostedt
@ 2010-02-03 16:07   ` Michal Marek
  2010-02-03 16:12     ` Steven Rostedt
  0 siblings, 1 reply; 9+ messages in thread
From: Michal Marek @ 2010-02-03 16:07 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: linux-kernel, linux-kbuild, Andrew Morton,
	Anibal Monsalve Salazar

On Wed, Feb 03, 2010 at 10:46:09AM -0500, Steven Rostedt wrote:
> +# if no path is given, then use src directory to find file
> +ifdef LSMOD
> +LSMOD_F = $(shell if [ `basename $(LSMOD)` == $(LSMOD) ]; then \
> +		echo $(objtree)/$(LSMOD);			\
> +	else							\
> +		echo $(LSMOD);					\
> +	fi)
> +endif

You can do this within make like:

ifdef LSMOD
LSMOD_F := $(LSMOD)
ifeq ($(findstring /,$(LSMOD)),)
  LSMOD_F := $(objtree)/$(LSMOD)
endif
endif

Michal

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 4/4] kconfig: Add LSMOD=file to override the lsmod for localmodconfig
  2010-02-03 16:07   ` Michal Marek
@ 2010-02-03 16:12     ` Steven Rostedt
  2010-02-03 16:20       ` [PATCH] kconfig: simplify LSMOD= handling Michal Marek
  0 siblings, 1 reply; 9+ messages in thread
From: Steven Rostedt @ 2010-02-03 16:12 UTC (permalink / raw)
  To: Michal Marek
  Cc: linux-kernel, linux-kbuild, Andrew Morton,
	Anibal Monsalve Salazar

On Wed, 2010-02-03 at 17:07 +0100, Michal Marek wrote:
> On Wed, Feb 03, 2010 at 10:46:09AM -0500, Steven Rostedt wrote:
> > +# if no path is given, then use src directory to find file
> > +ifdef LSMOD
> > +LSMOD_F = $(shell if [ `basename $(LSMOD)` == $(LSMOD) ]; then \
> > +		echo $(objtree)/$(LSMOD);			\
> > +	else							\
> > +		echo $(LSMOD);					\
> > +	fi)
> > +endif
> 
> You can do this within make like:
> 
> ifdef LSMOD
> LSMOD_F := $(LSMOD)
> ifeq ($(findstring /,$(LSMOD)),)
>   LSMOD_F := $(objtree)/$(LSMOD)
> endif
> endif

You can send me a patch and I'll apply it on top.

Thanks,

-- Steve



^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH] kconfig: simplify LSMOD= handling
  2010-02-03 16:12     ` Steven Rostedt
@ 2010-02-03 16:20       ` Michal Marek
  2010-02-03 16:49         ` [PATCH][linux-next] " Steven Rostedt
  0 siblings, 1 reply; 9+ messages in thread
From: Michal Marek @ 2010-02-03 16:20 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: linux-kernel, linux-kbuild, Andrew Morton,
	Anibal Monsalve Salazar

Signed-off-by: Michal Marek <mmarek@suse.cz>
---
 scripts/kconfig/Makefile |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index 85b9065..186c466 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -32,11 +32,10 @@ silentoldconfig: $(obj)/conf
 
 # if no path is given, then use src directory to find file
 ifdef LSMOD
-LSMOD_F = $(shell if [ `basename $(LSMOD)` == $(LSMOD) ]; then \
-		echo $(objtree)/$(LSMOD);			\
-	else							\
-		echo $(LSMOD);					\
-	fi)
+LSMOD_F := $(LSMOD)
+ifeq ($(findstring /,$(LSMOD)),)
+  LSMOD_F := $(objtree)/$(LSMOD)
+endif
 endif
 
 localmodconfig: $(obj)/streamline_config.pl $(obj)/conf
-- 
1.6.5.3


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH][linux-next] kconfig: simplify LSMOD= handling
  2010-02-03 16:20       ` [PATCH] kconfig: simplify LSMOD= handling Michal Marek
@ 2010-02-03 16:49         ` Steven Rostedt
  0 siblings, 0 replies; 9+ messages in thread
From: Steven Rostedt @ 2010-02-03 16:49 UTC (permalink / raw)
  To: Michal Marek
  Cc: linux-kernel, linux-kbuild, Andrew Morton,
	Anibal Monsalve Salazar


This has been merged into my for-next branch:

  git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-kconfig.git
for-linus-2


Michal Marek (1):
      kconfig: Simplify LSMOD= handling

----
 scripts/kconfig/Makefile |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)
---------------------------
commit 3cebbb81c7e75321e25cc586d07a25a3d98278fc
Author: Michal Marek <mmarek@suse.cz>
Date:   Wed Feb 3 17:20:14 2010 +0100

    kconfig: Simplify LSMOD= handling
    
    Signed-off-by: Michal Marek <mmarek@suse.cz>
    LKML-Reference: <20100203162014.GA10956@sepie.suse.cz>
    Signed-off-by: Steven Rostedt <rostedt@goodmis.org>

diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index 85b9065..186c466 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -32,11 +32,10 @@ silentoldconfig: $(obj)/conf
 
 # if no path is given, then use src directory to find file
 ifdef LSMOD
-LSMOD_F = $(shell if [ `basename $(LSMOD)` == $(LSMOD) ]; then \
-		echo $(objtree)/$(LSMOD);			\
-	else							\
-		echo $(LSMOD);					\
-	fi)
+LSMOD_F := $(LSMOD)
+ifeq ($(findstring /,$(LSMOD)),)
+  LSMOD_F := $(objtree)/$(LSMOD)
+endif
 endif
 
 localmodconfig: $(obj)/streamline_config.pl $(obj)/conf



^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2010-02-03 16:49 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-03 15:46 [PATCH 0/4][linux-next] kconfig: Updates to localmodconfig Steven Rostedt
2010-02-03 15:46 ` [PATCH 1/4] kconfig: Create include/generated for localmodconfig Steven Rostedt
2010-02-03 15:46 ` [PATCH 2/4] kconfig: Check for if conditions in Kconfig " Steven Rostedt
2010-02-03 15:46 ` [PATCH 3/4] kconfig: Look in both /bin and /sbin for lsmod in streamline_config.pl Steven Rostedt
2010-02-03 15:46 ` [PATCH 4/4] kconfig: Add LSMOD=file to override the lsmod for localmodconfig Steven Rostedt
2010-02-03 16:07   ` Michal Marek
2010-02-03 16:12     ` Steven Rostedt
2010-02-03 16:20       ` [PATCH] kconfig: simplify LSMOD= handling Michal Marek
2010-02-03 16:49         ` [PATCH][linux-next] " Steven Rostedt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox