aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-02-25 17:44:33 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2010-02-25 17:44:33 -0500
commitb6d97026561a6ed6eed58428633a6bb4e1b78c57 (patch)
treeaa14520be1485fe1eab56e24a28d63797c1ef54c /scripts
parent1954ee55605a75c91924b63c2584f4d53f11afc7 (diff)
parent3cebbb81c7e75321e25cc586d07a25a3d98278fc (diff)
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
Diffstat (limited to 'scripts')
-rw-r--r--scripts/kconfig/Makefile14
-rw-r--r--scripts/kconfig/streamline_config.pl59
2 files changed, 69 insertions, 4 deletions
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index 999e8a7d5bf7..186c46604d06 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -30,8 +30,17 @@ silentoldconfig: $(obj)/conf
30 $(Q)mkdir -p include/generated 30 $(Q)mkdir -p include/generated
31 $< -s $(Kconfig) 31 $< -s $(Kconfig)
32 32
33# if no path is given, then use src directory to find file
34ifdef LSMOD
35LSMOD_F := $(LSMOD)
36ifeq ($(findstring /,$(LSMOD)),)
37 LSMOD_F := $(objtree)/$(LSMOD)
38endif
39endif
40
33localmodconfig: $(obj)/streamline_config.pl $(obj)/conf 41localmodconfig: $(obj)/streamline_config.pl $(obj)/conf
34 $(Q)perl $< $(srctree) $(Kconfig) > .tmp.config 42 $(Q)mkdir -p include/generated
43 $(Q)perl $< $(srctree) $(Kconfig) $(LSMOD_F) > .tmp.config
35 $(Q)if [ -f .config ]; then \ 44 $(Q)if [ -f .config ]; then \
36 cmp -s .tmp.config .config || \ 45 cmp -s .tmp.config .config || \
37 (mv -f .config .config.old.1; \ 46 (mv -f .config .config.old.1; \
@@ -45,7 +54,8 @@ localmodconfig: $(obj)/streamline_config.pl $(obj)/conf
45 $(Q)rm -f .tmp.config 54 $(Q)rm -f .tmp.config
46 55
47localyesconfig: $(obj)/streamline_config.pl $(obj)/conf 56localyesconfig: $(obj)/streamline_config.pl $(obj)/conf
48 $(Q)perl $< $(srctree) $(Kconfig) > .tmp.config 57 $(Q)mkdir -p include/generated
58 $(Q)perl $< $(srctree) $(Kconfig) $(LSMOD_F) > .tmp.config
49 $(Q)sed -i s/=m/=y/ .tmp.config 59 $(Q)sed -i s/=m/=y/ .tmp.config
50 $(Q)if [ -f .config ]; then \ 60 $(Q)if [ -f .config ]; then \
51 cmp -s .tmp.config .config || \ 61 cmp -s .tmp.config .config || \
diff --git a/scripts/kconfig/streamline_config.pl b/scripts/kconfig/streamline_config.pl
index 0d800820c3cd..afbd54ac1d83 100644
--- a/scripts/kconfig/streamline_config.pl
+++ b/scripts/kconfig/streamline_config.pl
@@ -113,6 +113,7 @@ find_config;
113# Get the build source and top level Kconfig file (passed in) 113# Get the build source and top level Kconfig file (passed in)
114my $ksource = $ARGV[0]; 114my $ksource = $ARGV[0];
115my $kconfig = $ARGV[1]; 115my $kconfig = $ARGV[1];
116my $lsmod_file = $ARGV[2];
116 117
117my @makefiles = `find $ksource -name Makefile`; 118my @makefiles = `find $ksource -name Makefile`;
118my %depends; 119my %depends;
@@ -121,6 +122,8 @@ my %prompts;
121my %objects; 122my %objects;
122my $var; 123my $var;
123my $cont = 0; 124my $cont = 0;
125my $iflevel = 0;
126my @ifdeps;
124 127
125# prevent recursion 128# prevent recursion
126my %read_kconfigs; 129my %read_kconfigs;
@@ -146,6 +149,15 @@ sub read_kconfig {
146 $state = "NEW"; 149 $state = "NEW";
147 $config = $1; 150 $config = $1;
148 151
152 for (my $i = 0; $i < $iflevel; $i++) {
153 if ($i) {
154 $depends{$config} .= " " . $ifdeps[$i];
155 } else {
156 $depends{$config} = $ifdeps[$i];
157 }
158 $state = "DEP";
159 }
160
149 # collect the depends for the config 161 # collect the depends for the config
150 } elsif ($state eq "NEW" && /^\s*depends\s+on\s+(.*)$/) { 162 } elsif ($state eq "NEW" && /^\s*depends\s+on\s+(.*)$/) {
151 $state = "DEP"; 163 $state = "DEP";
@@ -166,6 +178,21 @@ sub read_kconfig {
166 # note if the config has a prompt 178 # note if the config has a prompt
167 $prompt{$config} = 1; 179 $prompt{$config} = 1;
168 180
181 # Check for if statements
182 } elsif (/^if\s+(.*\S)\s*$/) {
183 my $deps = $1;
184 # remove beginning and ending non text
185 $deps =~ s/^[^a-zA-Z0-9_]*//;
186 $deps =~ s/[^a-zA-Z0-9_]*$//;
187
188 my @deps = split /[^a-zA-Z0-9_]+/, $deps;
189
190 $ifdeps[$iflevel++] = join ':', @deps;
191
192 } elsif (/^endif/) {
193
194 $iflevel-- if ($iflevel);
195
169 # stop on "help" 196 # stop on "help"
170 } elsif (/^\s*help\s*$/) { 197 } elsif (/^\s*help\s*$/) {
171 $state = "NONE"; 198 $state = "NONE";
@@ -237,8 +264,36 @@ foreach my $makefile (@makefiles) {
237 264
238my %modules; 265my %modules;
239 266
240# see what modules are loaded on this system 267if (defined($lsmod_file)) {
241open(LIN,"/sbin/lsmod|") || die "Cant lsmod"; 268 if ( ! -f $lsmod_file) {
269 die "$lsmod_file not found";
270 }
271 if ( -x $lsmod_file) {
272 # the file is executable, run it
273 open(LIN, "$lsmod_file|");
274 } else {
275 # Just read the contents
276 open(LIN, "$lsmod_file");
277 }
278} else {
279
280 # see what modules are loaded on this system
281 my $lsmod;
282
283 foreach $dir ( ("/sbin", "/bin", "/usr/sbin", "/usr/bin") ) {
284 if ( -x "$dir/lsmod" ) {
285 $lsmod = "$dir/lsmod";
286 last;
287 }
288}
289 if (!defined($lsmod)) {
290 # try just the path
291 $lsmod = "lsmod";
292 }
293
294 open(LIN,"$lsmod|") || die "Can not call lsmod with $lsmod";
295}
296
242while (<LIN>) { 297while (<LIN>) {
243 next if (/^Module/); # Skip the first line. 298 next if (/^Module/); # Skip the first line.
244 if (/^(\S+)/) { 299 if (/^(\S+)/) {