diff options
| author | Steven Rostedt <srostedt@redhat.com> | 2012-01-13 17:53:40 -0500 |
|---|---|---|
| committer | Steven Rostedt <rostedt@goodmis.org> | 2012-01-13 18:01:48 -0500 |
| commit | 364212fddaaa60c5a64f67a0f5624ad996ecc8a0 (patch) | |
| tree | 47ce8b894b493e59d142f91f5b2c943e48d3d29b /scripts | |
| parent | d060d963e88f3e990cec2fe5214de49de9a49eca (diff) | |
kconfig/streamline-config.pl: Fix parsing Makefile with variables
Thomas Lange reported that when he did a 'make localmodconfig', his
config was missing the brcmsmac driver, even though he had the module
loaded.
Looking into this, I found the file:
drivers/net/wireless/brcm80211/brcmsmac/Makefile
had the following in the Makefile:
MODULEPFX := brcmsmac
obj-$(CONFIG_BRCMSMAC) += $(MODULEPFX).o
The way streamline-config.pl works, is parsing all the
obj-$(CONFIG_FOO) += foo.o
lines to find that CONFIG_FOO belongs to the module foo.ko.
But in this case, the brcmsmac.o was not used, but a variable in its place.
By changing streamline-config.pl to remember defined variables in Makefiles
and substituting them when they are used in the obj-X lines, allows
Thomas (and others) to have their brcmsmac module stay configured
when it is loaded and running "make localmodconfig".
Reported-by: Thomas Lange <thomas-lange2@gmx.de>
Tested-by: Thomas Lange <thomas-lange2@gmx.de>
Cc: Arend van Spriel <arend@broadcom.com>
Cc: stable@vger.kernel.org
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/kconfig/streamline_config.pl | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/scripts/kconfig/streamline_config.pl b/scripts/kconfig/streamline_config.pl index 42ef5ea5ebdc..bccf07ddd0b6 100644 --- a/scripts/kconfig/streamline_config.pl +++ b/scripts/kconfig/streamline_config.pl | |||
| @@ -250,10 +250,33 @@ if ($kconfig) { | |||
| 250 | read_kconfig($kconfig); | 250 | read_kconfig($kconfig); |
| 251 | } | 251 | } |
| 252 | 252 | ||
| 253 | sub convert_vars { | ||
| 254 | my ($line, %vars) = @_; | ||
| 255 | |||
| 256 | my $process = ""; | ||
| 257 | |||
| 258 | while ($line =~ s/^(.*?)(\$\((.*?)\))//) { | ||
| 259 | my $start = $1; | ||
| 260 | my $variable = $2; | ||
| 261 | my $var = $3; | ||
| 262 | |||
| 263 | if (defined($vars{$var})) { | ||
| 264 | $process .= $start . $vars{$var}; | ||
| 265 | } else { | ||
| 266 | $process .= $start . $variable; | ||
| 267 | } | ||
| 268 | } | ||
| 269 | |||
| 270 | $process .= $line; | ||
| 271 | |||
| 272 | return $process; | ||
| 273 | } | ||
| 274 | |||
| 253 | # Read all Makefiles to map the configs to the objects | 275 | # Read all Makefiles to map the configs to the objects |
| 254 | foreach my $makefile (@makefiles) { | 276 | foreach my $makefile (@makefiles) { |
| 255 | 277 | ||
| 256 | my $line = ""; | 278 | my $line = ""; |
| 279 | my %make_vars; | ||
| 257 | 280 | ||
| 258 | open(MIN,$makefile) || die "Can't open $makefile"; | 281 | open(MIN,$makefile) || die "Can't open $makefile"; |
| 259 | while (<MIN>) { | 282 | while (<MIN>) { |
| @@ -270,10 +293,16 @@ foreach my $makefile (@makefiles) { | |||
| 270 | 293 | ||
| 271 | my $objs; | 294 | my $objs; |
| 272 | 295 | ||
| 296 | $_ = convert_vars($_, %make_vars); | ||
| 297 | |||
| 273 | # collect objects after obj-$(CONFIG_FOO_BAR) | 298 | # collect objects after obj-$(CONFIG_FOO_BAR) |
| 274 | if (/obj-\$\((CONFIG_[^\)]*)\)\s*[+:]?=\s*(.*)/) { | 299 | if (/obj-\$\((CONFIG_[^\)]*)\)\s*[+:]?=\s*(.*)/) { |
| 275 | $var = $1; | 300 | $var = $1; |
| 276 | $objs = $2; | 301 | $objs = $2; |
| 302 | |||
| 303 | # check if variables are set | ||
| 304 | } elsif (/^\s*(\S+)\s*[:]?=\s*(.*\S)/) { | ||
| 305 | $make_vars{$1} = $2; | ||
| 277 | } | 306 | } |
| 278 | if (defined($objs)) { | 307 | if (defined($objs)) { |
| 279 | foreach my $obj (split /\s+/,$objs) { | 308 | foreach my $obj (split /\s+/,$objs) { |
