Commit b6d97026 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'for-linus-2' of...

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

* 'for-linus-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-kconfig:
  kconfig: Simplify LSMOD= handling
  kconfig: Add LSMOD=file to override the lsmod for localmodconfig
  kconfig: Look in both /bin and /sbin for lsmod in streamline_config.pl
  kconfig: Check for if conditions in Kconfig for localmodconfig
  kconfig: Create include/generated for localmodconfig
parents 1954ee55 3cebbb81
......@@ -30,8 +30,17 @@ 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 := $(LSMOD)
ifeq ($(findstring /,$(LSMOD)),)
LSMOD_F := $(objtree)/$(LSMOD)
endif
endif
localmodconfig: $(obj)/streamline_config.pl $(obj)/conf
$(Q)perl $< $(srctree) $(Kconfig) > .tmp.config
$(Q)mkdir -p include/generated
$(Q)perl $< $(srctree) $(Kconfig) $(LSMOD_F) > .tmp.config
$(Q)if [ -f .config ]; then \
cmp -s .tmp.config .config || \
(mv -f .config .config.old.1; \
......@@ -45,7 +54,8 @@ localmodconfig: $(obj)/streamline_config.pl $(obj)/conf
$(Q)rm -f .tmp.config
localyesconfig: $(obj)/streamline_config.pl $(obj)/conf
$(Q)perl $< $(srctree) $(Kconfig) > .tmp.config
$(Q)mkdir -p include/generated
$(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 || \
......
......@@ -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;
......@@ -121,6 +122,8 @@ my %prompts;
my %objects;
my $var;
my $cont = 0;
my $iflevel = 0;
my @ifdeps;
# prevent recursion
my %read_kconfigs;
......@@ -146,6 +149,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 +178,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";
......@@ -237,8 +264,36 @@ foreach my $makefile (@makefiles) {
my %modules;
# see what modules are loaded on this system
open(LIN,"/sbin/lsmod|") || die "Cant lsmod";
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";
}
open(LIN,"$lsmod|") || die "Can not call lsmod with $lsmod";
}
while (<LIN>) {
next if (/^Module/); # Skip the first line.
if (/^(\S+)/) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment