diff options
Diffstat (limited to 'scripts/kconfig/streamline_config.pl')
-rw-r--r-- | scripts/kconfig/streamline_config.pl | 43 |
1 files changed, 36 insertions, 7 deletions
diff --git a/scripts/kconfig/streamline_config.pl b/scripts/kconfig/streamline_config.pl index c70a27d924f0..fd81fc33d633 100644 --- a/scripts/kconfig/streamline_config.pl +++ b/scripts/kconfig/streamline_config.pl | |||
@@ -42,6 +42,8 @@ | |||
42 | # mv config_strip .config | 42 | # mv config_strip .config |
43 | # make oldconfig | 43 | # make oldconfig |
44 | # | 44 | # |
45 | use strict; | ||
46 | |||
45 | my $config = ".config"; | 47 | my $config = ".config"; |
46 | 48 | ||
47 | my $uname = `uname -r`; | 49 | my $uname = `uname -r`; |
@@ -123,7 +125,6 @@ my %selects; | |||
123 | my %prompts; | 125 | my %prompts; |
124 | my %objects; | 126 | my %objects; |
125 | my $var; | 127 | my $var; |
126 | my $cont = 0; | ||
127 | my $iflevel = 0; | 128 | my $iflevel = 0; |
128 | my @ifdeps; | 129 | my @ifdeps; |
129 | 130 | ||
@@ -137,19 +138,45 @@ sub read_kconfig { | |||
137 | my $config; | 138 | my $config; |
138 | my @kconfigs; | 139 | my @kconfigs; |
139 | 140 | ||
140 | open(KIN, "$ksource/$kconfig") || die "Can't open $kconfig"; | 141 | my $cont = 0; |
142 | my $line; | ||
143 | |||
144 | my $source = "$ksource/$kconfig"; | ||
145 | my $last_source = ""; | ||
146 | |||
147 | # Check for any environment variables used | ||
148 | while ($source =~ /\$(\w+)/ && $last_source ne $source) { | ||
149 | my $env = $1; | ||
150 | $last_source = $source; | ||
151 | $source =~ s/\$$env/$ENV{$env}/; | ||
152 | } | ||
153 | |||
154 | open(KIN, "$source") || die "Can't open $kconfig"; | ||
141 | while (<KIN>) { | 155 | while (<KIN>) { |
142 | chomp; | 156 | chomp; |
143 | 157 | ||
158 | # Make sure that lines ending with \ continue | ||
159 | if ($cont) { | ||
160 | $_ = $line . " " . $_; | ||
161 | } | ||
162 | |||
163 | if (s/\\$//) { | ||
164 | $cont = 1; | ||
165 | $line = $_; | ||
166 | next; | ||
167 | } | ||
168 | |||
169 | $cont = 0; | ||
170 | |||
144 | # collect any Kconfig sources | 171 | # collect any Kconfig sources |
145 | if (/^source\s*"(.*)"/) { | 172 | if (/^source\s*"(.*)"/) { |
146 | $kconfigs[$#kconfigs+1] = $1; | 173 | $kconfigs[$#kconfigs+1] = $1; |
147 | } | 174 | } |
148 | 175 | ||
149 | # configs found | 176 | # configs found |
150 | if (/^\s*config\s+(\S+)\s*$/) { | 177 | if (/^\s*(menu)?config\s+(\S+)\s*$/) { |
151 | $state = "NEW"; | 178 | $state = "NEW"; |
152 | $config = $1; | 179 | $config = $2; |
153 | 180 | ||
154 | for (my $i = 0; $i < $iflevel; $i++) { | 181 | for (my $i = 0; $i < $iflevel; $i++) { |
155 | if ($i) { | 182 | if ($i) { |
@@ -178,7 +205,7 @@ sub read_kconfig { | |||
178 | # configs without prompts must be selected | 205 | # configs without prompts must be selected |
179 | } elsif ($state ne "NONE" && /^\s*tristate\s\S/) { | 206 | } elsif ($state ne "NONE" && /^\s*tristate\s\S/) { |
180 | # note if the config has a prompt | 207 | # note if the config has a prompt |
181 | $prompt{$config} = 1; | 208 | $prompts{$config} = 1; |
182 | 209 | ||
183 | # Check for if statements | 210 | # Check for if statements |
184 | } elsif (/^if\s+(.*\S)\s*$/) { | 211 | } elsif (/^if\s+(.*\S)\s*$/) { |
@@ -218,6 +245,8 @@ if ($kconfig) { | |||
218 | # Read all Makefiles to map the configs to the objects | 245 | # Read all Makefiles to map the configs to the objects |
219 | foreach my $makefile (@makefiles) { | 246 | foreach my $makefile (@makefiles) { |
220 | 247 | ||
248 | my $cont = 0; | ||
249 | |||
221 | open(MIN,$makefile) || die "Can't open $makefile"; | 250 | open(MIN,$makefile) || die "Can't open $makefile"; |
222 | while (<MIN>) { | 251 | while (<MIN>) { |
223 | my $objs; | 252 | my $objs; |
@@ -281,7 +310,7 @@ if (defined($lsmod_file)) { | |||
281 | # see what modules are loaded on this system | 310 | # see what modules are loaded on this system |
282 | my $lsmod; | 311 | my $lsmod; |
283 | 312 | ||
284 | foreach $dir ( ("/sbin", "/bin", "/usr/sbin", "/usr/bin") ) { | 313 | foreach my $dir ( ("/sbin", "/bin", "/usr/sbin", "/usr/bin") ) { |
285 | if ( -x "$dir/lsmod" ) { | 314 | if ( -x "$dir/lsmod" ) { |
286 | $lsmod = "$dir/lsmod"; | 315 | $lsmod = "$dir/lsmod"; |
287 | last; | 316 | last; |
@@ -363,7 +392,7 @@ while ($repeat) { | |||
363 | parse_config_dep_select $depends{$config}; | 392 | parse_config_dep_select $depends{$config}; |
364 | } | 393 | } |
365 | 394 | ||
366 | if (defined($prompt{$config}) || !defined($selects{$config})) { | 395 | if (defined($prompts{$config}) || !defined($selects{$config})) { |
367 | next; | 396 | next; |
368 | } | 397 | } |
369 | 398 | ||