History log of /linux-master/scripts/kconfig/streamline_config.pl
Revision Date Author Comments
# 98d7c754 07-Jun-2023 Jiri Slaby <jirislaby@kernel.org>

streamline_config.pl: handle also ${CONFIG_FOO}

streamline_config.pl currently searches for CONFIG options in Kconfig
files as $(CONFIG_FOO). But some Kconfigs (e.g. thunderbolt) use
${CONFIG_FOO}. So fix up the regex to accept both.

This fixes:
$ make LSMOD=`pwd/`/lsmod localmodconfig
using config: '.config'
thunderbolt config not found!!

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Acked-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>


# 0431acd8 25-Nov-2021 Łukasz Stelmach <l.stelmach@samsung.com>

streamline_config.pl: show the full Kconfig name

Show the very same file name that was passed to open()
in case the operation failed.

Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>


# d1b1f1e6 28-Jun-2021 Steven Rostedt (VMware) <rostedt@goodmis.org>

streamline_config.pl: add softtabstop=4 for vim users

The tab stop for Perl files is by default (at least in emacs) to be 4
spaces, where a tab is used for all 8 spaces. Add a local variable
comment to make vim do the same by default, and this will help keep the
file consistent in the future when others edit it via vim and not emacs.

Link: https://lkml.kernel.org/r/20210322214032.293992979@goodmis.org
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Cc: Masahiro Yamada <masahiroy@kernel.org>
Cc: "John (Warthog9) Hawley" <warthog9@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


# b83c8ba4 28-Jun-2021 Steven Rostedt (VMware) <rostedt@goodmis.org>

streamline_config.pl: make spacing consistent

Patch series "streamline_config.pl: Fix Perl spacing".

Talking with John Hawley about how vim and emacs deal with Perl files with
respect to tabs and spaces, I found that some of my Perl code in the
kernel had inconsistent spacing. The way emacs handles Perl by default is
to use 4 spaces per indent, but make all 8 spaces into a single tab. Vim
does not do this by default. But if you add the vim variable control:

# vim: softtabstop=4

to a perl file, it makes vim behave the same way as emacs.

The first patch is to change all 8 spaces into a single tab (mostly from
people editing the file with vim). The next patch adds the softtabstop
variable to make vim act like emacs by default.

This patch (of 2):

As Perl code tends to have 4 space indentation, but uses tabs for every 8
spaces, make that consistent in the streamline_config.pl code. Replace
all 8 spaces with a single tab.

Link: https://lkml.kernel.org/r/20210322214032.133596267@goodmis.org
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Cc: "John (Warthog9) Hawley" <warthog9@kernel.org>
Cc: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


# 21f8b32f 26-Mar-2021 Bhaskar Chowdhury <unixbhaskar@gmail.com>

kconfig: streamline_config.pl: Couple of typo fixes

s/configuraton/configuration/
s/orignal/original/

Signed-off-by: Bhaskar Chowdhury <unixbhaskar@gmail.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>


# a73fbfce 26-Aug-2020 Randy Dunlap <rdunlap@infradead.org>

kconfig: streamline_config.pl: check defined(ENV variable) before using it

A user reported:
'Use of uninitialized value $ENV{"LMC_KEEP"} in split at
./scripts/kconfig/streamline_config.pl line 596.'

so first check that $ENV{LMC_KEEP} is defined before trying
to use it.

Fixes: c027b02d89fd ("streamline_config.pl: add LMC_KEEP to preserve some kconfigs")
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Acked-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>


# c027b02d 12-May-2020 Changbin Du <changbin.du@intel.com>

streamline_config.pl: add LMC_KEEP to preserve some kconfigs

Sometimes it is useful to preserve batches of configs when making
localmodconfig. For example, I usually don't want any usb and fs
modules to be disabled. Now we can do it by:

$ make LMC_KEEP="drivers/usb:fs" localmodconfig

Signed-off-by: Changbin Du <changbin.du@gmail.com>
Acked-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>


# 68f0d627 16-Dec-2019 Masahiro Yamada <masahiroy@kernel.org>

kconfig: localmodconfig: fix indentation for closing brace

This is the closing brace for the foreach loop. Fix the misleading
indentation.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>


# 5edcef84 16-Dec-2019 Masahiro Yamada <masahiroy@kernel.org>

kconfig: localmodconfig: remove unused $config

This is unused since commit cdfc47950a53 ("kconfig: search for a config
to base the local(mod|yes)config on").

Having unused $config is confusing because $config is used as a local
variable in various sub-routines.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>


# 0c874100 18-Dec-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

kconfig: convert to SPDX License Identifier

All files in lxdialog/ are licensed under GPL-2.0+, and the rest are
under GPL-2.0. I added GPL-2.0 tags to test scripts in tests/.

Documentation/process/license-rules.rst does not suggest anything
about the flex/bison files. Because flex does not accept the C++
comment style at the very top of a file, I used the C style for
zconf.l, and so for zconf.y for consistency.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>


# 8593080c 08-Jun-2018 Sam Ravnborg <sam@ravnborg.org>

kconfig: fix localmodconfig

When kconfig syntax moved to use $(FOO) for environment variables
localmodconfig was not updated.
Fix so it now works with the new syntax $(FOO)

Fixes: 104daea149c4 ("kconfig: reference environment variables directly and remove 'option env='")
Reported-by: Kevin Locke <kevin@kevinlocke.name>
Reported-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Tested-by: Kevin Locke <kevin@kevinlocke.name>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>


# cb77f0d6 07-May-2017 Kamil Rytarowski <n54@gmx.com>

scripts: Switch to more portable Perl shebang

The default NetBSD package manager is pkgsrc and it installs Perl
along other third party programs under custom and configurable prefix.
The default prefix for binary prebuilt packages is /usr/pkg, and the
Perl executable lands in /usr/pkg/bin/perl.

This change switches "/usr/bin/perl" to "/usr/bin/env perl" as it's
the most portable solution that should work for almost everybody.
Perl's executable is detected automatically.

This change switches -w option passed to the executable with more
modern "use warnings;" approach. There is no functional change to the
default behavior.

While there, drop "require 5" from scripts/namespace.pl (Perl from 1994?).

Signed-off-by: Kamil Rytarowski <n54@gmx.com>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>


# 5bcba792 26-Apr-2016 Benjamin Poirier <bpoirier@suse.com>

localmodconfig: Fix whitespace repeat count after "tristate"

Also recognize standalone "prompt".

Before this patch we incorrectly identified some symbols as not having a
prompt and potentially needing to be selected by something else.

Note that this patch could theoretically change the resulting .config,
causing it to have fewer symbols turned on. However, given the current set
of Kconfig files, this situation does not occur because the symbols newly
added to %prompts are absent from %selects.

Link: http://lkml.kernel.org/r/1461696998-3953-1-git-send-email-bpoirier@suse.com

Signed-off-by: Benjamin Poirier <bpoirier@suse.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>


# 96bab35d 26-Apr-2016 Benjamin Poirier <bpoirier@suse.com>

localmodconfig: Reset certificate paths

When using `make localmodconfig` and friends, if the input config comes
from a kernel that was built in a different environment (for example, the
canonical case of using localmodconfig to trim a distribution kernel
config) the key files for module signature checking will not be available
and should be regenerated or omitted. Otherwise, the user will be faced
with annoying errors when trying to build with the generated .config:

make[1]: *** No rule to make target 'keyring.crt', needed by 'certs/x509_certificate_list'. Stop.
Makefile:1576: recipe for target 'certs/' failed

Link: http://lkml.kernel.org/r/1461696721-3001-1-git-send-email-bpoirier@suse.com

Signed-off-by: Benjamin Poirier <bpoirier@suse.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>


# 5169192b 10-Apr-2016 Benjamin Poirier <bpoirier@suse.com>

localmodconfig: Add missing $ to reference a variable

That is clearly what the original intention was. This does not change the
output .config but it prevents some useless processing.

! eq "m" is changed to the simpler eq "y"; symbols with values other than
m|y are not included in %orig_configs.

Link: http://lkml.kernel.org/r/1460333193-16361-3-git-send-email-bpoirier@suse.com

Signed-off-by: Benjamin Poirier <bpoirier@suse.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>


# a77ed525 10-Apr-2016 Benjamin Poirier <bpoirier@suse.com>

localmodconfig: Fix parsing of "help" text

Help text may start with "help" or "---help---". This patch fixes
read_kconfig() to recognize the second variant.

This removes useless junk from %depends and %selects. That junk is due to
help text that contains the words "selects" and "depends".

Link: http://lkml.kernel.org/r/1460333193-16361-2-git-send-email-bpoirier@suse.com

Signed-off-by: Benjamin Poirier <bpoirier@suse.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>


# 27b71568 10-Apr-2016 Benjamin Poirier <bpoirier@suse.com>

localmodconfig: Recognize more keywords that end a menu entry

Based on the list in Documentation/kbuild/kconfig-language.txt

This removes junk from %depends because parsing of a menu entry spilled
over to another menu entry.

Link: http://lkml.kernel.org/r/1460333193-16361-1-git-send-email-bpoirier@suse.com

Signed-off-by: Benjamin Poirier <bpoirier@suse.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>


# 296471ad 02-Apr-2016 Benjamin Poirier <bpoirier@suse.com>

localmodconfig: Fix parsing of Kconfig "source" statements

The parameter of Kconfig "source" statements does not need to be quoted.
The current regex causes many kconfig files to be skipped and hence,
dependencies to be missed.

Also fix the whitespace repeat count.

Link: http://lkml.kernel.org/r/1459619722-13695-1-git-send-email-bpoirier@suse.com

Tested-by: Lee, Chun-Yi <jlee@suse.com>
Signed-off-by: Benjamin Poirier <bpoirier@suse.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>


# c0ddc8c7 26-Jul-2015 Richard Weinberger <richard@nod.at>

localmodconfig: Use Kbuild files too

In kbuild it is allowed to define objects in files named "Makefile"
and "Kbuild".
Currently localmodconfig reads objects only from "Makefile"s and misses
modules like nouveau.

Link: http://lkml.kernel.org/r/1437948415-16290-1-git-send-email-richard@nod.at

Cc: stable@vger.kernel.org
Reported-and-tested-by: Leonidas Spyropoulos <artafinde@gmail.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>


# 06ed5c2b 20-Aug-2014 Michal Marek <mmarek@suse.cz>

kbuild: Make scripts executable

The Makefiles call the respective interpreter explicitly, but this makes
it easier to use the scripts manually.

Signed-off-by: Michal Marek <mmarek@suse.cz>


# 38385f8f 28-Apr-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kbuild: trivial - remove trailing spaces

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>


# 95edca5c 17-Dec-2013 Steven Rostedt (Red Hat) <rostedt@goodmis.org>

localmodconfig: Add config depends by default settings

Currently localmodconfig will miss dependencies from the default option.
For example:

config FOO
default y if BAR || ZOO

If FOO is needed for a module and is set to '=m', and so are BAR or ZOO,
localmodconfig will not see that BOO or ZOO are also needed for the foo
module, and will incorrectly disable them.

Link: http://lkml.kernel.org/r/20131218175137.162937350@goodmis.org

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>


# ced9cb1a 29-Apr-2013 Steven Rostedt <rostedt@goodmis.org>

localmodconfig: Process source kconfig files as they are found

A bug was reported that caused localmodconfig to not keep all the
dependencies of ATH9K. This was caused by the kconfig file:

In drivers/net/wireless/ath/Kconfig:

---
if ATH_CARDS

config ATH_DEBUG
bool "Atheros wireless debugging"
---help---
Say Y, if you want to debug atheros wireless drivers.
Right now only ath9k makes use of this.

source "drivers/net/wireless/ath/ath5k/Kconfig"
source "drivers/net/wireless/ath/ath9k/Kconfig"
source "drivers/net/wireless/ath/carl9170/Kconfig"
source "drivers/net/wireless/ath/ath6kl/Kconfig"
source "drivers/net/wireless/ath/ar5523/Kconfig"
source "drivers/net/wireless/ath/wil6210/Kconfig"

endif
---

The current way kconfig works, it processes new source files after the
first file is completed. It creates an array of new source config files
and when the one file is finished, it continues with the next file.

Unfortunately, this means that it loses the fact that the source file is
within an "if" statement, and this means that each of these source file's
configs will not have the proper dependencies set.

As ATH9K requires ATH_CARDS set, the localmodconfig did not see that
dependency, and did not enable ATH_CARDS. When the oldconfig was run, it
forced ATH9K to be disabled.

Link: http://lkml.kernel.org/r/alpine.DEB.2.02.1304291022320.9234@oneiric

Cc: stable@vger.kernel.org # 3.8+
Reported-by: Robert P. J. Day <rpjday@crashcourse.ca>
Tested-by: Robert P. J. Day <rpjday@crashcourse.ca>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>


# bc20d12e 29-Apr-2013 Steven Rostedt <rostedt@goodmis.org>

localmodconfig: Add debug prints for dependencies of module configs

When a config for a module is added to the list to save in the final
config file, add a print to show what dependencies are used. This is
useful to debug when a config is disabled by the make oldconfig after
localmodconfig is finished.

This print only appears if the environment variable LOCALMODCONFIG_DEBUG
is defined.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>


# 4eae518d 01-Oct-2012 Yuta Ando <yuta.and@gmail.com>

localmodconfig: Fix localyesconfig to set to 'y' not 'm'

The kbuild target 'localyesconfig' has been same as 'localmodconfig'
since the commit 50bce3e "kconfig/streamline_config.pl: merge
local{mod,yes}config". The commit expects this script generates
different configure depending on target, but it was not yet implemented.

So I added code that sets to 'yes' when target is 'localyesconfig'.

Link: http://lkml.kernel.org/r/1349101470-12243-1-git-send-email-yuta.and@gmail.com

Cc: stable@vger.kernel.org # v3.2
Cc: linux-kbuild@vger.kernel.org
Signed-off-by: Yuta Ando <yuta.and@gmail.com>
Signed-off-by: Steven Rostedt <rostedt@rostedt.homelinux.com>


# 45f4c81d 09-Aug-2012 Bill Pemberton <wfp5p@virginia.edu>

localmodconfig: Use my variable for loop in streamline_config.pl

perlcritic complains about $kconfig being reused in the foreach loop
at the end of read_kconfig. Change it to a my variable.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>


# e0d28694 09-Aug-2012 Bill Pemberton <wfp5p@virginia.edu>

localmodconfig: Use 3 parameter open in streamline_config.pl

Convert remaining open calls to use the perl's preferred 3 parameter
open.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>


# 3f0c5413 09-Aug-2012 Bill Pemberton <wfp5p@virginia.edu>

localmodconfig: Rework find_config in streamline_config.pl

Change find_config function to read_config. It now finds the config,
reads the config into an array, and returns the array. This makes it
a little cleaner and changes the open to use perl's 3 option open.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>


# 224a2571 09-Aug-2012 Bill Pemberton <wfp5p@virginia.edu>

localmodconfig: Set default value for ksource in streamline_config.pl

Running streamline_config.pl as it's shown it in the comment header,
you will get a warning about $ksource being uninitialized. This is
because $ksource is set to ARGV[0], but the examples don't require any
arguments. Fix by setting ksource to . if no ARGV[0] is given.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>


# 4503379c 18-Jun-2012 Steven Rostedt <srostedt@redhat.com>

localmodconfig: Add debug environment variable LOCALMODCONFIG_DEBUG

If the environment variable LOCALMODCONFIG_DEBUG is set, then debug output
will appear in the make localmodconfig. This will simplify debugging what
people get with their output, as I can just tell people to do:

LOCALMODCONFIG_DEBUG=1 make localmodconfig 2>out.txt

and have them send me the out.txt. I'll be able to see why things are not
working as they think it should be.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>


# d4bb58b5 18-Jun-2012 Steven Rostedt <srostedt@redhat.com>

localmodconfig: Check if configs are already set for selects

There are some cases that a required module does not have a prompt
and needs to have another module enabled that selects it to be set.
As localmodconfig is conservative and tries to make the minimum config
without breaking the user's kernel, or keeping the user from using
devices that were loaded when the lsmod was done, all modules that
select this module will also be enabled.

If you needed module A, but module A did not have a prompt but needed
module B to be selected, localmodconfig would make sure B was still
enabled. If not only B selected A, but C, D, E, F, and G also
selected A, then all of those would also be included, as well as the
modules they depend on. This ballooned the number of configs that
localmodconfig would keep.

The fix here is to process the depends first, and then record those
configs that did not have a prompt and needed to be selected.
After the depends are done, check what configs are needed to select
the configs in the list, and if a config that selects it is already
set, then we don't need to do anything else.

If no config that selects the config is set, then just pick one and
try again.

This change brought down the number of selected modules from 290
to 67! Both before and after were run against a config that had 3095
modules enabled.

Tested-by: John David Yost <johnyost@ptd.net> # AlleyTrotter
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>


# 4f4c51c9 18-Jun-2012 Steven Rostedt <srostedt@redhat.com>

localmodconfig: Read in orig config file to avoid extra processing

Read in the entire config file. If there's a config that we depend on
that happens to be in the core set (not a module) then we do not need
to process it as a module.

Currently, we follow the entire depend and selects even if they
are enabled as core and not modules. By checking to make sure that we
only look at modules we can drop the count a little.

From one of my tests, localmodconfig went from taking 3095 set modules
down to 356 before this patch, and down to 290 modules after the change.

Tested-by: John David Yost <johnyost@ptd.net> # AlleyTrotter
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>


# 0b58a99e 18-Jun-2012 Steven Rostedt <srostedt@redhat.com>

localmodconfig: Comments and cleanup for streamline_config.pl

Added some more comments and cleaned up part of the the code to use
a named variable instead of one of the special $1 perl variables.

No functional changes.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>


# 364212fd 13-Jan-2012 Steven Rostedt <srostedt@redhat.com>

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>


# d060d963 13-Jan-2012 Steven Rostedt <srostedt@redhat.com>

kconfig/streamline-config.pl: Simplify backslash line concatination

Simplify the way lines ending with backslashes (continuation) in Makefiles
is parsed. This is needed to implement a necessary fix.

Tested-by: Thomas Lange <thomas-lange2@gmx.de>
Cc: stable@vger.kernel.org
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>


# 22d550ae 19-Jul-2011 Arnaud Lacombe <lacombar@gmail.com>

kconfig/streamline_config.pl: use options to determine operating mode

The options introduced are --localmodconfig (default) and --localyesconfig.
They match the Makefile target behavior.

Cc: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Arnaud Lacombe <lacombar@gmail.com>


# f597a718 01-Jul-2011 Arnaud Lacombe <lacombar@gmail.com>

kconfig/streamline_config.pl: directly access LSMOD from the environment

Cc: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Arnaud Lacombe <lacombar@gmail.com>


# cce1dac8 24-Jan-2011 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

trivial: Fix Steven's Copyright typos

OK, the copyright allows you to write a copy, still I think the lawyers
prefer the correct spelling.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
LKML-Reference: <1295899921-11333-1-git-send-email-u.kleine-koenig@pengutronix.de>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>


# 8ef17fa2 28-Oct-2010 Steven Rostedt <srostedt@redhat.com>

kconfig: Have streamline_config process menuconfigs too

Some menuconfigs in the Kconfig files have prompts and dependencies.
Currently, streamline_config misses these, and this can cause
streamline_config to keep modules enabled that should not be, and
even worse, not enable those that should.

This patch makes streamline_config process menuconfigs just like it
would process a config.

Reported-by: member graysky <graysky@archlinux.us>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>


# 20d19047 28-Oct-2010 Steven Rostedt <srostedt@redhat.com>

kconfig: Fix streamline_config to read multi line deps in Kconfig files

I noticed that some Kconfig files have multi line dependencies
that continue with a backslash. Those dependencies on the next
line will be missed by streamline_config.

For example:

config CS89x0
tristate "CS89x0 support"
depends on NET_ETHERNET && (ISA || EISA || MACH_IXDP2351 \
|| ARCH_IXDP2X01 || MACH_MX31ADS)

The "|| ARCH_IXDP2X01 || MACH_MX31ADS)" will not be processed.

This patch adds code to handle this case.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>


# cf5a189d 17-Aug-2010 hiromu <hiromu1996@gmail.com>

kconfig: Fix missing declaration of variable $dir in streamline_config.pl

On Fri, Aug 17, 2010 at 01:43PM +0800, Américo Wang wrote:
> Acked-by: WANG Cong <xiyou.wangcong@gmail.com>
>
> BTW, I think we should add "use strict;" too.

Then I added "use strict;" to streamline_config.pl, I saw another
warning.

> Global symbol "$dir" requires explicit package name at
scripts/kconfig/streamline_config.pl line 286.
> Global symbol "$dir" requires explicit package name at
scripts/kconfig/streamline_config.pl line 287.
> Global symbol "$dir" requires explicit package name at
scripts/kconfig/streamline_config.pl line 288.

Then I added "my $dir;" to line 285.

Cc: Américo Wang <xiyou.wangcong@gmail.com>
Cc: Toralf Foerster <toralf.foerster@gmx.de>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: Hiromu Yakura <hiromu1996@gmail.com>
LKML-Reference: <1282042158.7160.9.camel@hiromu-Macbook>

[ changed to just add my in front of $dir instead of new line ]

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>


# ccece60a 14-Aug-2010 hiromu yagura <hiromu1996@gmail.com>

kconfig: Fix variable name typo %prompts in streamline_config.pl

When I added "use strict;" to streamline_config.pl, I saw the following
warnings:

> Global symbol "%prompt" requires explicit package name at
scripts/kconfig/streamline_config.pl line 183.
> Global symbol "%prompt" requires explicit package name at
scripts/kconfig/streamline_config.pl line 368.

The declaration of %prompt was incorrect, and should have been %prompts.

Cc: Toralf Foerster <toralf.foerster@gmx.de>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: Hiromu Yakura <hiromu1996@gmail.com>
LKML-Reference: <1281845597.11566.5.camel@camp10-laptop>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>


# 4908980b 28-Oct-2010 Steven Rostedt <srostedt@redhat.com>

kconfig: Make localmodconfig handle environment variables

The commit 838a2e55e6a4e9e8a10451ed2ef0f7a08dabdb04
kbuild: migrate all arch to the kconfig mainmenu upgrade

Broke make localmodconfig. The reason was that it added a
environment variable to the kconfig source, which the
streamline_config.pl could not handle.

This patch changes streamline_config.pl to handle kconfig sources
using environment variables in their names.

Cc: Arnaud Lacombe <lacombar@gmail.com>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Michal Marek <mmarek@suse.cz>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>


# 17431928 26-May-2010 Toralf Förster <toralf.foerster@gmx.de>

kconfig: Hide error output in find command in streamline_config.pl

Finding the list of Makefiles in streamline-config should not report errors.

Also move the "chomp" to the @makefiles array instead of doing it in the
for loop. This is more efficient, and does not make it any less readable
by C programmers.

Signed-off-by: Toralf Foerster <toralf.foerster@gmx.de>
LKML-Reference: <201005262022.02928.toralf.foerster@gmx.de>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>


# 1d1d1fea 28-May-2010 Toralf Foerster <toralf.foerster@gmx.de>

kconfig: Fix typo in comment in streamline_config.pl

Signed-off-by: Toralf Foerster <toralf.foerster@gmx.de>
LKML-Reference: <201005281025.52753.toralf.foerster@gmx.de>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>


# e5199edb 28-May-2010 Toralf Foerster <toralf.foerster@gmx.de>

kconfig: Make a variable local in streamline_config.pl

Proper perl requires that local variables should be declared with 'my',
otherwise this may produce errors.

Signed-off-by: Toralf Foerster <toralf.foerster@gmx.de>
LKML-Reference: <201005281025.00358.toralf.foerster@gmx.de>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>


# 615f0833 02-Feb-2010 Steven Rostedt <srostedt@redhat.com>

kconfig: Add LSMOD=file to override the lsmod for localmodconfig

Doing the following:

make LSMOD=file localmodconfig

Will make the streamline-config code use the given file instead of
lsmod. If the file is an executable, it will execute it, otherwise
it will read it as text.

make LSMOD=/my/local/path/lsmod localmodconfig

The above will execute the lsmod in /my/local/path instead of the
lsmods that may be located elsewhere.

make LSMOD=embedded_board_lsmod localmodconfig

The above will read the "embedded_board_lsmod" as a text file. This
is useful if you are doing a cross compile and need to run the
config against modules that exist on an embedded device.

Note, if the LSMOD= file does is not a path, it will add the
path to the object directory. That is, the above example will look
for "embedded_board_lsmod" in the directory that the binary will
be built in (the O=dir directory).

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>

On branch config/linus


# 88f66ea9 06-Jan-2010 Steven Rostedt <srostedt@redhat.com>

kconfig: Look in both /bin and /sbin for lsmod in streamline_config.pl

Distributions now have lsmod in /bin instead of /sbin. But to handle
both cases, we look for it in /sbin /bin /usr/bin and /usr/sbin.
If lsmod is not found in any of those paths, it defaults to use
just lsmod and hopes that it lies in the path of the user.

Tested-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>


# 13d7e938 06-Jan-2010 Steven Rostedt <srostedt@redhat.com>

kconfig: Check for if conditions in Kconfig for localmodconfig

The streamline_config.pl misses the if conditions for checking
dependencies. For Kconfigs with the following construct:

if MEDIA_SUPPORT

config VIDEO_DEV

[...]

If VIDEO_DEV was enabled, the script will miss the fact that MEDIA_SUPPORT
is also needed.

This patch changes streamline_config.pl to include if conditions into
the dependencies of configs.

Reported-by: Anton Blanchard <anton@sambo.org>
Tested-by: Anton Blanchard <anton@sambo.org>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>


# 463bf900 20-Nov-2009 Steven Rostedt <srostedt@redhat.com>

kconfig: Fix make O=<dir> local{mod,yes}config

When the output directory is something other than the kernel source,
the streamline_config script gets confused. This patch passes in the
source directory to the script so that it can find the proper files.

Reported-by: Peter Zijlstra <peterz@infradead.org>
Tested-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>


# a9024838 07-May-2009 Steven Rostedt <srostedt@redhat.com>

kconfig: make local .config default for streamline_config

As Andi Kleen pointed out, most people would expect that the local .config
file to be based for a streamline config. This patch changes the order
of searching for a config file to consider the .config in the local
directory first.

Reported-by: Andi Kleen <andi@firstfloor.org>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>


# 810b2be6 30-Apr-2009 Steven Rostedt <srostedt@redhat.com>

kconfig: test for /boot/config-uname after /proc/config.gz in localconfig

Many distros put their config in /boot/config-`uname -r`, add a check
for that right after /proc/config.gz

Reported-by: Alan Jenkins <sourcejedi.lkml@googlemail.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>


# d08ca277 30-Apr-2009 Steven Rostedt <srostedt@redhat.com>

kconfig: unset IKCONFIG_PROC and clean up nesting

Due to cut and paste error IKCONFIG was both set and cleared.
It was suppose to be IKCONFIG_PROC to be cleared.

Also cleaned up if nesting.

Reported-by: Alan Jenkins <sourcejedi.lkml@googlemail.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>


# cdfc4795 30-Apr-2009 Steven Rostedt <srostedt@redhat.com>

kconfig: search for a config to base the local(mod|yes)config on

Instead of using the .config in the local directory. This patch
changes streamline_config.pl to search various locations for a config.

Here's the list and order of search:

/proc/config.gz
/boot/vmlinuz-`uname -r`
vmlinux # local to the directory
/lib/modules/`uname -r`/kernel/kernel/configs.ko
kernel/configs.ko
kernel/configs.o
.config

Once it finds a file that contains a config (it checks if the binary
objects have configs first) it then uses it to create the .config
with minimum modules needed.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>


# 744ffcbe 29-Apr-2009 Steven Rostedt <srostedt@redhat.com>

kconfig: enable CONFIG_IKCONFIG from streamline_config.pl

Ingo Molnar suggested that the streamline_config.pl should enable
CONFIG_IKCONFIG to keep the current config in the kernel.
Then we can use scripts/extract-ikconfig to find the current
modules.

This patch changes streamline_config.pl to check if CONFIG_IKCONFIG
is not set, and if it is not, it enables it to be a module.

[ Impact: make current config options easier to find ]

Reported-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>


# ea2c1894 30-Apr-2009 Steven Rostedt <srostedt@redhat.com>

kconfig: do not warn about modules built in

The streamline_config.pl finds all the configs that are needed to
compile the currently loaded modules. After it creates the .config
file, it tests to make sure all the configs that are needed were
set.

It only looks at the configs that are modules, it does not look
at the builtin configs. This causes unnecessary warnings about modules
not being covered.

Reported-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>


# 74398d32 30-Apr-2009 Steven Rostedt <srostedt@redhat.com>

kconfig: streamline_config.pl do not stop with no depends

If a config does not have a prompt, it must be selected.
streamline_config.pl keeps track of all configs that select other configs.
If a config that does not have a prompt needs to be set to enable a
current module, it will include all configs that select it.
Note, streamline_config.pl does not enable modules that are not already
enabled. It only keeps enabled those that were enabled and might be
needed to compile the current modules.

The code to find the selects of a config is after the code that
adds the depends. But if a config needed selects but had no dependencies,
it would not be set. Because the code would stop before getting to
the select.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>


# dcc60243 29-Apr-2009 Steven Rostedt <srostedt@redhat.com>

kconfig: add streamline_config.pl to scripts

streamline_config.pl is a very powerful tool. For those that install
a kernel to a new box using the config file from the distribution know that
it can take forever to compile the kernel.

Making a custom config file that will still boot your box, but bring
down the compile time of the kernel can be quit painful, and to ask
someone that reported a bug to do this can be a large burdon since that
person may not even know how to build a kernel.

This script will perform "lsmod" to find all the modules loaded on the
current running system. It will read all the Makefiles to map which
CONFIG enables a module. It will read the Kconfig files to find the
dependencies and selects that may be needed to support a CONFIG.
Finally, it reads the .config file and removes any module "=m" that is
not needed to enable the currently loaded modules. The output goes to
standard out.

Here's a way to run the script. From the Linux directory that holds
a distribution .config.

$ scripts/kconfig/streamline_config.pl arch/x86/Kconfig > config-sl
$ mv .config config-save
$ mv config-sl .config
$ make oldconfig

Now you have a .config that will still build all your modules, but also
take much less time to build the kernel.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>