Skip to content

Commit

Permalink
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel…
Browse files Browse the repository at this point in the history
…/git/rostedt/linux-2.6-kconfig

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-kconfig:
  kconfig: Have streamline_config process menuconfigs too
  kconfig: Fix streamline_config to read multi line deps in Kconfig files
  kconfig: Fix missing declaration of variable $dir in streamline_config.pl
  kconfig: Fix variable name typo %prompts in streamline_config.pl
  kconfig: Make localmodconfig handle environment variables
  • Loading branch information
Linus Torvalds committed Oct 29, 2010
2 parents 1840897 + 8ef17fa commit b7bdcc4
Showing 1 changed file with 36 additions and 7 deletions.
43 changes: 36 additions & 7 deletions scripts/kconfig/streamline_config.pl
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
# mv config_strip .config
# make oldconfig
#
use strict;

my $config = ".config";

my $uname = `uname -r`;
Expand Down Expand Up @@ -123,7 +125,6 @@ sub find_config {
my %prompts;
my %objects;
my $var;
my $cont = 0;
my $iflevel = 0;
my @ifdeps;

Expand All @@ -137,19 +138,45 @@ sub read_kconfig {
my $config;
my @kconfigs;

open(KIN, "$ksource/$kconfig") || die "Can't open $kconfig";
my $cont = 0;
my $line;

my $source = "$ksource/$kconfig";
my $last_source = "";

# Check for any environment variables used
while ($source =~ /\$(\w+)/ && $last_source ne $source) {
my $env = $1;
$last_source = $source;
$source =~ s/\$$env/$ENV{$env}/;
}

open(KIN, "$source") || die "Can't open $kconfig";
while (<KIN>) {
chomp;

# Make sure that lines ending with \ continue
if ($cont) {
$_ = $line . " " . $_;
}

if (s/\\$//) {
$cont = 1;
$line = $_;
next;
}

$cont = 0;

# collect any Kconfig sources
if (/^source\s*"(.*)"/) {
$kconfigs[$#kconfigs+1] = $1;
}

# configs found
if (/^\s*config\s+(\S+)\s*$/) {
if (/^\s*(menu)?config\s+(\S+)\s*$/) {
$state = "NEW";
$config = $1;
$config = $2;

for (my $i = 0; $i < $iflevel; $i++) {
if ($i) {
Expand Down Expand Up @@ -178,7 +205,7 @@ sub read_kconfig {
# configs without prompts must be selected
} elsif ($state ne "NONE" && /^\s*tristate\s\S/) {
# note if the config has a prompt
$prompt{$config} = 1;
$prompts{$config} = 1;

# Check for if statements
} elsif (/^if\s+(.*\S)\s*$/) {
Expand Down Expand Up @@ -218,6 +245,8 @@ sub read_kconfig {
# Read all Makefiles to map the configs to the objects
foreach my $makefile (@makefiles) {

my $cont = 0;

open(MIN,$makefile) || die "Can't open $makefile";
while (<MIN>) {
my $objs;
Expand Down Expand Up @@ -281,7 +310,7 @@ sub read_kconfig {
# see what modules are loaded on this system
my $lsmod;

foreach $dir ( ("/sbin", "/bin", "/usr/sbin", "/usr/bin") ) {
foreach my $dir ( ("/sbin", "/bin", "/usr/sbin", "/usr/bin") ) {
if ( -x "$dir/lsmod" ) {
$lsmod = "$dir/lsmod";
last;
Expand Down Expand Up @@ -363,7 +392,7 @@ sub parse_config_dep_select
parse_config_dep_select $depends{$config};
}

if (defined($prompt{$config}) || !defined($selects{$config})) {
if (defined($prompts{$config}) || !defined($selects{$config})) {
next;
}

Expand Down

0 comments on commit b7bdcc4

Please sign in to comment.