diff options
| -rw-r--r-- | scripts/kconfig/Makefile | 14 | ||||
| -rw-r--r-- | scripts/kconfig/streamline_config.pl | 59 |
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 | ||
| 34 | ifdef LSMOD | ||
| 35 | LSMOD_F := $(LSMOD) | ||
| 36 | ifeq ($(findstring /,$(LSMOD)),) | ||
| 37 | LSMOD_F := $(objtree)/$(LSMOD) | ||
| 38 | endif | ||
| 39 | endif | ||
| 40 | |||
| 33 | localmodconfig: $(obj)/streamline_config.pl $(obj)/conf | 41 | localmodconfig: $(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 | ||
| 47 | localyesconfig: $(obj)/streamline_config.pl $(obj)/conf | 56 | localyesconfig: $(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) |
| 114 | my $ksource = $ARGV[0]; | 114 | my $ksource = $ARGV[0]; |
| 115 | my $kconfig = $ARGV[1]; | 115 | my $kconfig = $ARGV[1]; |
| 116 | my $lsmod_file = $ARGV[2]; | ||
| 116 | 117 | ||
| 117 | my @makefiles = `find $ksource -name Makefile`; | 118 | my @makefiles = `find $ksource -name Makefile`; |
| 118 | my %depends; | 119 | my %depends; |
| @@ -121,6 +122,8 @@ my %prompts; | |||
| 121 | my %objects; | 122 | my %objects; |
| 122 | my $var; | 123 | my $var; |
| 123 | my $cont = 0; | 124 | my $cont = 0; |
| 125 | my $iflevel = 0; | ||
| 126 | my @ifdeps; | ||
| 124 | 127 | ||
| 125 | # prevent recursion | 128 | # prevent recursion |
| 126 | my %read_kconfigs; | 129 | my %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 | ||
| 238 | my %modules; | 265 | my %modules; |
| 239 | 266 | ||
| 240 | # see what modules are loaded on this system | 267 | if (defined($lsmod_file)) { |
| 241 | open(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 | |||
| 242 | while (<LIN>) { | 297 | while (<LIN>) { |
| 243 | next if (/^Module/); # Skip the first line. | 298 | next if (/^Module/); # Skip the first line. |
| 244 | if (/^(\S+)/) { | 299 | if (/^(\S+)/) { |
