From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: linux-kbuild@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>,
Anibal Monsalve Salazar <anibal@debian.org>,
Michal Marek <mmarek@suse.cz>
Subject: [PATCH 4/4] kconfig: Add LSMOD=file to override the lsmod for localmodconfig
Date: Wed, 03 Feb 2010 10:46:09 -0500 [thread overview]
Message-ID: <20100203154906.499020585@goodmis.org> (raw)
In-Reply-To: 20100203154605.461025238@goodmis.org
[-- 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
next prev parent reply other threads:[~2010-02-03 15:49 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` Steven Rostedt [this message]
2010-02-03 16:07 ` [PATCH 4/4] kconfig: Add LSMOD=file to override the lsmod for localmodconfig 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100203154906.499020585@goodmis.org \
--to=rostedt@goodmis.org \
--cc=akpm@linux-foundation.org \
--cc=anibal@debian.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mmarek@suse.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox