From patchwork Wed Feb 3 15:46:09 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Rostedt X-Patchwork-Id: 76734 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o13Fodp7022859 for ; Wed, 3 Feb 2010 15:50:39 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757358Ab0BCPtM (ORCPT ); Wed, 3 Feb 2010 10:49:12 -0500 Received: from hrndva-omtalb.mail.rr.com ([71.74.56.125]:46270 "EHLO hrndva-omtalb.mail.rr.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757339Ab0BCPtJ (ORCPT ); Wed, 3 Feb 2010 10:49:09 -0500 X-Authority-Analysis: v=1.0 c=1 a=nffpKdO8o5EA:10 a=20KFwNOVAAAA:8 a=meVymXHHAAAA:8 a=HGNNirQh7TFNGZ8RDJoA:9 a=3h8Eo5CmbHGZZfNPhdkA:7 a=37uurf8JyXwKI_q8jxQqGHwM8nAA:4 a=jEp0ucaQiEUA:10 a=jeBq3FmKZ4MA:10 X-Cloudmark-Score: 0 X-Originating-IP: 74.67.89.75 Received: from [74.67.89.75] ([74.67.89.75:34623] helo=gandalf.stny.rr.com) by hrndva-oedge04.mail.rr.com (envelope-from ) (ecelerity 2.2.2.39 r()) with ESMTP id A4/F9-13539-2FA996B4; Wed, 03 Feb 2010 15:49:07 +0000 Received: from rostedt by gandalf.stny.rr.com with local (Exim 4.71) (envelope-from ) id 1NchTW-0006U2-L7; Wed, 03 Feb 2010 10:49:06 -0500 Message-Id: <20100203154906.499020585@goodmis.org> User-Agent: quilt/0.48-1 Date: Wed, 03 Feb 2010 10:46:09 -0500 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: linux-kbuild@vger.kernel.org, Andrew Morton , Anibal Monsalve Salazar , Michal Marek Subject: [PATCH 4/4] kconfig: Add LSMOD=file to override the lsmod for localmodconfig References: <20100203154605.461025238@goodmis.org> Content-Disposition: inline; filename=0004-kconfig-Add-LSMOD-file-to-override-the-lsmod-for-loc.patch Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Wed, 03 Feb 2010 15:50:39 +0000 (UTC) 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 () { next if (/^Module/); # Skip the first line. if (/^(\S+)/) {