diff options
| author | Michal Marek <mmarek@suse.cz> | 2010-08-04 08:05:07 -0400 |
|---|---|---|
| committer | Michal Marek <mmarek@suse.cz> | 2010-08-04 08:05:07 -0400 |
| commit | 7a996d3ab150bb0e1b71fa182f70199a703efdd1 (patch) | |
| tree | 96a36947d90c9b96580899abd38cb3b70cd9d40b /scripts/kconfig | |
| parent | 7cf3d73b4360e91b14326632ab1aeda4cb26308d (diff) | |
| parent | 9fe6206f400646a2322096b56c59891d530e8d51 (diff) | |
Merge commit 'v2.6.35' into kbuild/kconfig
Conflicts:
scripts/kconfig/Makefile
Diffstat (limited to 'scripts/kconfig')
| -rw-r--r-- | scripts/kconfig/Makefile | 18 | ||||
| -rw-r--r-- | scripts/kconfig/nconf.gui.c | 2 | ||||
| -rw-r--r-- | scripts/kconfig/streamline_config.pl | 68 | ||||
| -rw-r--r-- | scripts/kconfig/util.c | 2 |
4 files changed, 78 insertions, 12 deletions
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index c0e459e2b014..de934def410f 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile | |||
| @@ -33,9 +33,18 @@ silentoldconfig: $(obj)/conf | |||
| 33 | $(Q)mkdir -p include/generated | 33 | $(Q)mkdir -p include/generated |
| 34 | $< --$@ $(Kconfig) | 34 | $< --$@ $(Kconfig) |
| 35 | 35 | ||
| 36 | # if no path is given, then use src directory to find file | ||
| 37 | ifdef LSMOD | ||
| 38 | LSMOD_F := $(LSMOD) | ||
| 39 | ifeq ($(findstring /,$(LSMOD)),) | ||
| 40 | LSMOD_F := $(objtree)/$(LSMOD) | ||
| 41 | endif | ||
| 42 | endif | ||
| 43 | |||
| 36 | localmodconfig: $(obj)/streamline_config.pl $(obj)/conf | 44 | localmodconfig: $(obj)/streamline_config.pl $(obj)/conf |
| 37 | $(Q)perl $< $(srctree) $(Kconfig) > .tmp.config | 45 | $(Q)mkdir -p include/generated |
| 38 | $(Q)if [ -f .config ]; then \ | 46 | $(Q)perl $< $(srctree) $(Kconfig) $(LSMOD_F) > .tmp.config |
| 47 | $(Q)if [ -f .config ]; then \ | ||
| 39 | cmp -s .tmp.config .config || \ | 48 | cmp -s .tmp.config .config || \ |
| 40 | (mv -f .config .config.old.1; \ | 49 | (mv -f .config .config.old.1; \ |
| 41 | mv -f .tmp.config .config; \ | 50 | mv -f .tmp.config .config; \ |
| @@ -48,7 +57,8 @@ localmodconfig: $(obj)/streamline_config.pl $(obj)/conf | |||
| 48 | $(Q)rm -f .tmp.config | 57 | $(Q)rm -f .tmp.config |
| 49 | 58 | ||
| 50 | localyesconfig: $(obj)/streamline_config.pl $(obj)/conf | 59 | localyesconfig: $(obj)/streamline_config.pl $(obj)/conf |
| 51 | $(Q)perl $< $(srctree) $(Kconfig) > .tmp.config | 60 | $(Q)mkdir -p include/generated |
| 61 | $(Q)perl $< $(srctree) $(Kconfig) $(LSMOD_F) > .tmp.config | ||
| 52 | $(Q)sed -i s/=m/=y/ .tmp.config | 62 | $(Q)sed -i s/=m/=y/ .tmp.config |
| 53 | $(Q)if [ -f .config ]; then \ | 63 | $(Q)if [ -f .config ]; then \ |
| 54 | cmp -s .tmp.config .config || \ | 64 | cmp -s .tmp.config .config || \ |
| @@ -212,7 +222,7 @@ HOSTCFLAGS_zconf.tab.o := -I$(src) | |||
| 212 | HOSTLOADLIBES_qconf = $(KC_QT_LIBS) -ldl | 222 | HOSTLOADLIBES_qconf = $(KC_QT_LIBS) -ldl |
| 213 | HOSTCXXFLAGS_qconf.o = $(KC_QT_CFLAGS) -D LKC_DIRECT_LINK | 223 | HOSTCXXFLAGS_qconf.o = $(KC_QT_CFLAGS) -D LKC_DIRECT_LINK |
| 214 | 224 | ||
| 215 | HOSTLOADLIBES_gconf = `pkg-config --libs gtk+-2.0 gmodule-2.0 libglade-2.0` | 225 | HOSTLOADLIBES_gconf = `pkg-config --libs gtk+-2.0 gmodule-2.0 libglade-2.0` -ldl |
| 216 | HOSTCFLAGS_gconf.o = `pkg-config --cflags gtk+-2.0 gmodule-2.0 libglade-2.0` \ | 226 | HOSTCFLAGS_gconf.o = `pkg-config --cflags gtk+-2.0 gmodule-2.0 libglade-2.0` \ |
| 217 | -D LKC_DIRECT_LINK | 227 | -D LKC_DIRECT_LINK |
| 218 | 228 | ||
diff --git a/scripts/kconfig/nconf.gui.c b/scripts/kconfig/nconf.gui.c index 115edb437fb1..a9d9344e1365 100644 --- a/scripts/kconfig/nconf.gui.c +++ b/scripts/kconfig/nconf.gui.c | |||
| @@ -226,7 +226,7 @@ void fill_window(WINDOW *win, const char *text) | |||
| 226 | int len = get_line_length(line); | 226 | int len = get_line_length(line); |
| 227 | strncpy(tmp, line, min(len, x)); | 227 | strncpy(tmp, line, min(len, x)); |
| 228 | tmp[len] = '\0'; | 228 | tmp[len] = '\0'; |
| 229 | mvwprintw(win, i, 0, tmp); | 229 | mvwprintw(win, i, 0, "%s", tmp); |
| 230 | } | 230 | } |
| 231 | } | 231 | } |
| 232 | 232 | ||
diff --git a/scripts/kconfig/streamline_config.pl b/scripts/kconfig/streamline_config.pl index 0d800820c3cd..c70a27d924f0 100644 --- a/scripts/kconfig/streamline_config.pl +++ b/scripts/kconfig/streamline_config.pl | |||
| @@ -113,14 +113,19 @@ 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]; | ||
| 117 | |||
| 118 | my @makefiles = `find $ksource -name Makefile 2>/dev/null`; | ||
| 119 | chomp @makefiles; | ||
| 116 | 120 | ||
| 117 | my @makefiles = `find $ksource -name Makefile`; | ||
| 118 | my %depends; | 121 | my %depends; |
| 119 | my %selects; | 122 | my %selects; |
| 120 | my %prompts; | 123 | my %prompts; |
| 121 | my %objects; | 124 | my %objects; |
| 122 | my $var; | 125 | my $var; |
| 123 | my $cont = 0; | 126 | my $cont = 0; |
| 127 | my $iflevel = 0; | ||
| 128 | my @ifdeps; | ||
| 124 | 129 | ||
| 125 | # prevent recursion | 130 | # prevent recursion |
| 126 | my %read_kconfigs; | 131 | my %read_kconfigs; |
| @@ -146,6 +151,15 @@ sub read_kconfig { | |||
| 146 | $state = "NEW"; | 151 | $state = "NEW"; |
| 147 | $config = $1; | 152 | $config = $1; |
| 148 | 153 | ||
| 154 | for (my $i = 0; $i < $iflevel; $i++) { | ||
| 155 | if ($i) { | ||
| 156 | $depends{$config} .= " " . $ifdeps[$i]; | ||
| 157 | } else { | ||
| 158 | $depends{$config} = $ifdeps[$i]; | ||
| 159 | } | ||
| 160 | $state = "DEP"; | ||
| 161 | } | ||
| 162 | |||
| 149 | # collect the depends for the config | 163 | # collect the depends for the config |
| 150 | } elsif ($state eq "NEW" && /^\s*depends\s+on\s+(.*)$/) { | 164 | } elsif ($state eq "NEW" && /^\s*depends\s+on\s+(.*)$/) { |
| 151 | $state = "DEP"; | 165 | $state = "DEP"; |
| @@ -166,6 +180,21 @@ sub read_kconfig { | |||
| 166 | # note if the config has a prompt | 180 | # note if the config has a prompt |
| 167 | $prompt{$config} = 1; | 181 | $prompt{$config} = 1; |
| 168 | 182 | ||
| 183 | # Check for if statements | ||
| 184 | } elsif (/^if\s+(.*\S)\s*$/) { | ||
| 185 | my $deps = $1; | ||
| 186 | # remove beginning and ending non text | ||
| 187 | $deps =~ s/^[^a-zA-Z0-9_]*//; | ||
| 188 | $deps =~ s/[^a-zA-Z0-9_]*$//; | ||
| 189 | |||
| 190 | my @deps = split /[^a-zA-Z0-9_]+/, $deps; | ||
| 191 | |||
| 192 | $ifdeps[$iflevel++] = join ':', @deps; | ||
| 193 | |||
| 194 | } elsif (/^endif/) { | ||
| 195 | |||
| 196 | $iflevel-- if ($iflevel); | ||
| 197 | |||
| 169 | # stop on "help" | 198 | # stop on "help" |
| 170 | } elsif (/^\s*help\s*$/) { | 199 | } elsif (/^\s*help\s*$/) { |
| 171 | $state = "NONE"; | 200 | $state = "NONE"; |
| @@ -188,7 +217,6 @@ if ($kconfig) { | |||
| 188 | 217 | ||
| 189 | # Read all Makefiles to map the configs to the objects | 218 | # Read all Makefiles to map the configs to the objects |
| 190 | foreach my $makefile (@makefiles) { | 219 | foreach my $makefile (@makefiles) { |
| 191 | chomp $makefile; | ||
| 192 | 220 | ||
| 193 | open(MIN,$makefile) || die "Can't open $makefile"; | 221 | open(MIN,$makefile) || die "Can't open $makefile"; |
| 194 | while (<MIN>) { | 222 | while (<MIN>) { |
| @@ -215,7 +243,7 @@ foreach my $makefile (@makefiles) { | |||
| 215 | foreach my $obj (split /\s+/,$objs) { | 243 | foreach my $obj (split /\s+/,$objs) { |
| 216 | $obj =~ s/-/_/g; | 244 | $obj =~ s/-/_/g; |
| 217 | if ($obj =~ /(.*)\.o$/) { | 245 | if ($obj =~ /(.*)\.o$/) { |
| 218 | # Objects may bes enabled by more than one config. | 246 | # Objects may be enabled by more than one config. |
| 219 | # Store configs in an array. | 247 | # Store configs in an array. |
| 220 | my @arr; | 248 | my @arr; |
| 221 | 249 | ||
| @@ -237,8 +265,36 @@ foreach my $makefile (@makefiles) { | |||
| 237 | 265 | ||
| 238 | my %modules; | 266 | my %modules; |
| 239 | 267 | ||
| 240 | # see what modules are loaded on this system | 268 | if (defined($lsmod_file)) { |
| 241 | open(LIN,"/sbin/lsmod|") || die "Cant lsmod"; | 269 | if ( ! -f $lsmod_file) { |
| 270 | die "$lsmod_file not found"; | ||
| 271 | } | ||
| 272 | if ( -x $lsmod_file) { | ||
| 273 | # the file is executable, run it | ||
| 274 | open(LIN, "$lsmod_file|"); | ||
| 275 | } else { | ||
| 276 | # Just read the contents | ||
| 277 | open(LIN, "$lsmod_file"); | ||
| 278 | } | ||
| 279 | } else { | ||
| 280 | |||
| 281 | # see what modules are loaded on this system | ||
| 282 | my $lsmod; | ||
| 283 | |||
| 284 | foreach $dir ( ("/sbin", "/bin", "/usr/sbin", "/usr/bin") ) { | ||
| 285 | if ( -x "$dir/lsmod" ) { | ||
| 286 | $lsmod = "$dir/lsmod"; | ||
| 287 | last; | ||
| 288 | } | ||
| 289 | } | ||
| 290 | if (!defined($lsmod)) { | ||
| 291 | # try just the path | ||
| 292 | $lsmod = "lsmod"; | ||
| 293 | } | ||
| 294 | |||
| 295 | open(LIN,"$lsmod|") || die "Can not call lsmod with $lsmod"; | ||
| 296 | } | ||
| 297 | |||
| 242 | while (<LIN>) { | 298 | while (<LIN>) { |
| 243 | next if (/^Module/); # Skip the first line. | 299 | next if (/^Module/); # Skip the first line. |
| 244 | if (/^(\S+)/) { | 300 | if (/^(\S+)/) { |
| @@ -252,7 +308,7 @@ close (LIN); | |||
| 252 | my %configs; | 308 | my %configs; |
| 253 | foreach my $module (keys(%modules)) { | 309 | foreach my $module (keys(%modules)) { |
| 254 | if (defined($objects{$module})) { | 310 | if (defined($objects{$module})) { |
| 255 | @arr = @{$objects{$module}}; | 311 | my @arr = @{$objects{$module}}; |
| 256 | foreach my $conf (@arr) { | 312 | foreach my $conf (@arr) { |
| 257 | $configs{$conf} = $module; | 313 | $configs{$conf} = $module; |
| 258 | } | 314 | } |
diff --git a/scripts/kconfig/util.c b/scripts/kconfig/util.c index 81c100d953ef..78b5c04e736b 100644 --- a/scripts/kconfig/util.c +++ b/scripts/kconfig/util.c | |||
| @@ -72,7 +72,7 @@ int file_write_dep(const char *name) | |||
| 72 | } | 72 | } |
| 73 | 73 | ||
| 74 | 74 | ||
| 75 | /* Allocate initial growable sting */ | 75 | /* Allocate initial growable string */ |
| 76 | struct gstr str_new(void) | 76 | struct gstr str_new(void) |
| 77 | { | 77 | { |
| 78 | struct gstr gs; | 78 | struct gstr gs; |
