History log of /linux-master/scripts/config
Revision Date Author Comments
# d39648eb 19-Dec-2020 Randy Dunlap <rdunlap@infradead.org>

kconfig: config script: add a little user help

Give the user a clue about the problem along with the 35 lines of
usage/help text.

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Masahiro Yamada <masahiroy@kernel.org>
Cc: linux-kbuild@vger.kernel.org
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>


# c25ce589 23-Nov-2020 Finn Behrens <me@kloenk.de>

tweewide: Fix most Shebang lines

Change every shebang which does not need an argument to use /usr/bin/env.
This is needed as not every distro has everything under /usr/bin,
sometimes not even bash.

Signed-off-by: Finn Behrens <me@kloenk.de>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>


# e461bc9f 10-Apr-2020 Jeremie Francois (on alpha) <jeremie.francois@gmail.com>

scripts/config: allow colons in option strings for sed

Sed broke on some strings as it used colon as a separator.
I made it more robust by using \001, which is legit POSIX AFAIK.

E.g. ./config --set-str CONFIG_USBNET_DEVADDR "de:ad:be:ef:00:01"
failed with: sed: -e expression #1, char 55: unknown option to `s'

Signed-off-by: Jeremie Francois (on alpha) <jeremie.francois@gmail.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>


# b2441318 01-Nov-2017 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

License cleanup: add SPDX GPL-2.0 license identifier to files with no license

Many source files in the tree are missing licensing information, which
makes it harder for compliance tools to determine the correct license.

By default all files without license information are under the default
license of the kernel, which is GPL version 2.

Update the files which contain no license information with the 'GPL-2.0'
SPDX license identifier. The SPDX identifier is a legally binding
shorthand, which can be used instead of the full boiler plate text.

This patch is based on work done by Thomas Gleixner and Kate Stewart and
Philippe Ombredanne.

How this work was done:

Patches were generated and checked against linux-4.14-rc6 for a subset of
the use cases:
- file had no licensing information it it.
- file was a */uapi/* one with no licensing information in it,
- file was a */uapi/* one with existing licensing information,

Further patches will be generated in subsequent months to fix up cases
where non-standard license headers were used, and references to license
had to be inferred by heuristics based on keywords.

The analysis to determine which SPDX License Identifier to be applied to
a file was done in a spreadsheet of side by side results from of the
output of two independent scanners (ScanCode & Windriver) producing SPDX
tag:value files created by Philippe Ombredanne. Philippe prepared the
base worksheet, and did an initial spot review of a few 1000 files.

The 4.13 kernel was the starting point of the analysis with 60,537 files
assessed. Kate Stewart did a file by file comparison of the scanner
results in the spreadsheet to determine which SPDX license identifier(s)
to be applied to the file. She confirmed any determination that was not
immediately clear with lawyers working with the Linux Foundation.

Criteria used to select files for SPDX license identifier tagging was:
- Files considered eligible had to be source code files.
- Make and config files were included as candidates if they contained >5
lines of source
- File already had some variant of a license header in it (even if <5
lines).

All documentation files were explicitly excluded.

The following heuristics were used to determine which SPDX license
identifiers to apply.

- when both scanners couldn't find any license traces, file was
considered to have no license information in it, and the top level
COPYING file license applied.

For non */uapi/* files that summary was:

SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 11139

and resulted in the first patch in this series.

If that file was a */uapi/* path one, it was "GPL-2.0 WITH
Linux-syscall-note" otherwise it was "GPL-2.0". Results of that was:

SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 WITH Linux-syscall-note 930

and resulted in the second patch in this series.

- if a file had some form of licensing information in it, and was one
of the */uapi/* ones, it was denoted with the Linux-syscall-note if
any GPL family license was found in the file or had no licensing in
it (per prior point). Results summary:

SPDX license identifier # files
---------------------------------------------------|------
GPL-2.0 WITH Linux-syscall-note 270
GPL-2.0+ WITH Linux-syscall-note 169
((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) 21
((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) 17
LGPL-2.1+ WITH Linux-syscall-note 15
GPL-1.0+ WITH Linux-syscall-note 14
((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) 5
LGPL-2.0+ WITH Linux-syscall-note 4
LGPL-2.1 WITH Linux-syscall-note 3
((GPL-2.0 WITH Linux-syscall-note) OR MIT) 3
((GPL-2.0 WITH Linux-syscall-note) AND MIT) 1

and that resulted in the third patch in this series.

- when the two scanners agreed on the detected license(s), that became
the concluded license(s).

- when there was disagreement between the two scanners (one detected a
license but the other didn't, or they both detected different
licenses) a manual inspection of the file occurred.

- In most cases a manual inspection of the information in the file
resulted in a clear resolution of the license that should apply (and
which scanner probably needed to revisit its heuristics).

- When it was not immediately clear, the license identifier was
confirmed with lawyers working with the Linux Foundation.

- If there was any question as to the appropriate license identifier,
the file was flagged for further research and to be revisited later
in time.

In total, over 70 hours of logged manual review was done on the
spreadsheet to determine the SPDX license identifiers to apply to the
source files by Kate, Philippe, Thomas and, in some cases, confirmation
by lawyers working with the Linux Foundation.

Kate also obtained a third independent scan of the 4.13 code base from
FOSSology, and compared selected files where the other two scanners
disagreed against that SPDX file, to see if there was new insights. The
Windriver scanner is based on an older version of FOSSology in part, so
they are related.

Thomas did random spot checks in about 500 files from the spreadsheets
for the uapi headers and agreed with SPDX license identifier in the
files he inspected. For the non-uapi files Thomas did random spot checks
in about 15000 files.

In initial set of patches against 4.14-rc6, 3 files were found to have
copy/paste license identifier errors, and have been fixed to reflect the
correct identifier.

Additionally Philippe spent 10 hours this week doing a detailed manual
inspection and review of the 12,461 patched files from the initial patch
version early this week with:
- a full scancode scan run, collecting the matched texts, detected
license ids and scores
- reviewing anything where there was a license detected (about 500+
files) to ensure that the applied SPDX license was correct
- reviewing anything where there was no detection but the patch license
was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
SPDX license was correct

This produced a worksheet with 20 files needing minor correction. This
worksheet was then exported into 3 different .csv files for the
different types of files to be modified.

These .csv files were then reviewed by Greg. Thomas wrote a script to
parse the csv files and add the proper SPDX tag to the file, in the
format that the file expected. This script was further refined by Greg
based on the output to detect more types of files automatically and to
distinguish between header and source .c files (which need different
comment types.) Finally Greg ran the script using the .csv files to
generate the patches.

Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 7eb6e340 28-May-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kbuild: trivial - remove trailing empty lines

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>


# 86eb7818 13-Sep-2013 Clement Chauplannaz <chauplac@gmail.com>

scripts/config: fix variable substitution command

Commit 229455bc02b87f7128f190c4491b4ceffff38648 accidentally changed the
separator between sed `s' command and its parameters from ':' to '/'.

Revert this change.

Reported-and-tested-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Clement Chauplannaz <chauplac@gmail.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>


# 83e8b90e 13-Jul-2013 Clement Chauplannaz <chauplac@gmail.com>

scripts/config: use sed's POSIX interface

Script `config' relies on extensions of `GNU sed', and is thus not
working on all Unixes:
- in-place edition of files (-i), which can be replaced with
a temporary file;
- extended-regexps (-r), which can be split into basic regexps;
- single-line calls to `a' command, while some implementations
require a leading newline before the parameter.

Rewrite calls to `sed' to comply with POSIX interface, and move them
to helper functions.

Signed-off-by: Clement Chauplannaz <chauplac@gmail.com>
Tested-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>


# 73877785 12-May-2013 Clement Chauplannaz <chauplac@gmail.com>

scripts/config: replace hard-coded script name by a dynamic value

The script `config' prints its name in usage() function. It is currently
hard-coded to value `config'. However, the script may be reused under
a different name in contexts other than the Linux Kernel.

Replace the hard-coded value `config' by the name of the script at runtime.

Signed-off-by: Clement Chauplannaz <chauplac@gmail.com>
Acked-by: Andi Kleen <ak@linux.intel.com>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>


# 57a9c760 12-May-2013 Clement Chauplannaz <chauplac@gmail.com>

scripts/config: fix assignment of parameters for short version of --*-after options

When --*-after options are used, two parameters are parsed from the
command-line before the adequate function is called:
- the `before' option, after which the new option will be inserted,
- the name of the option to enable/disable/modularise.

With the short version of --*-after options (namely -E, -D, -M), the
parsing step is not performed which leads to processing unset variables.

Add options -E, -D, -M to the test that triggers assignment of parameters
for --*-after options.

Signed-off-by: Clement Chauplannaz <chauplac@gmail.com>
Acked-by: Andi Kleen <ak@linux.intel.com>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>


# c6ba8d06 13-Dec-2012 Hiroshi Doyu <hdoyu@nvidia.com>

scripts/config: Fix wrong "shift" for --keep-case

Remove wrong "shift" for --keep-case. There is always "shift" at
beginning of while-loop. No need "shift" at --keep-case just before
"continue" to process next argument.

Now the following works as expected:

./scripts/config -e aAa -k -e bBb -e cCc && tail -3 .config
CONFIG_AAA=y
CONFIG_bBb=y
CONFIG_cCc=y

Signed-off-by: Hiroshi Doyu <hdoyu@nvidia.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>


# 1925a276 15-Jul-2012 Yann E. MORIN <yann.morin.1998@free.fr>

scripts/config: fix double-quotes un-escaping

When reporting a string value, only the first double-quote was
un-escaped. We need to un-escape all escaped double-quotes.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Michal Marek <mmarek@suse.cz>


# d5bfb6b3 07-Jun-2012 Yann E. MORIN <yann.morin.1998@free.fr>

scripts/config: add option to undef a symbol

It is currently possible to enable, disable or modularise
a symbol. Also, an undefined symbol is reported as such.

Add a new command to undefine a symbol, by removing the
corresponding line from the .config file.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Michal Marek <mmarek@suse.cz>


# f5ef2f7b 07-Jun-2012 Yann E. MORIN <yann.morin.1998@free.fr>

scripts/config: allow alternate prefix to config option symbol

While the Linux kernel uses 'CONFIG_' as a prefix to the config options
symbols, many projects that use kconfig may use different prefixes, or
even none at all.

If the CONFIG_ environment variable is set, use it as the prefix (empty
is a valid prefix). Otherwise, use the default prefix 'CONFIG_'.

This matches the support for alternate prefixes in scripts/kconfig/lkc.h,
which uses the same logic (albeit with a C define instead of an environment
variable).

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Michal Marek <mmarek@suse.cz>


# 4edc7e32 07-Jun-2012 Yann E. MORIN <yann.morin.1998@free.fr>

scripts/config: add option to not upper-case symbols

Currently, scripts/config mangles the config option symbols to always
be upper-case.

While the Linux kernel almost exclusively uses upper-case symbols, there
are still a few symbols with lower-case which this script can not handle:

$ grep -r -E '^[[:space:]]*config[[:space:]]+[^[:space:]]*[[:lower:]][^[:space:]=.]*$' . |wc -l
173
(that's roughly 1.3% of the symbols in 3.5-rc1)

Eg.:
./arch/arm/Kconfig:config VFPv3
./arch/powerpc/platforms/Kconfig.cputype:config 40x
./arch/x86/Kconfig:config SCx200HR_TIMER
./drivers/video/console/Kconfig:config FONT_8x8
./drivers/video/Kconfig:config NTSC_640x480

Also, other projects that use kconfig may allow for lower- or mixed-case
symbols, and may find easier to reuse this script than implement each
their own (potentially flawed) logic. For such a use-case, see:
http://marc.info/?l=linux-kbuild&m=133409932115848&w=2

This patch adds a new option to keep the given case, and keep the current
default to upper-case the symbols.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Michal Marek <mmarek@suse.cz>


# d6686da8 09-Apr-2012 Yann E. MORIN <yann.morin.1998@free.fr>

scripts/config: properly report and set string options

Currently, scripts/config removes the leading double-quote from
string options, but leaves the trailing double-quote.

Also, double-quotes in a string are escaped, but scripts/config
does not unescape those when printing

Finally, scripts/config does not escape double-quotes when setting
string options.

Eg. the current behavior:
$ grep -E '^CONFIG_FOO=' .config
CONFIG_FOO="Bar \"Buz\" Meh"
$ ./scripts/config -s FOO
Bar \"Buz\" Meh"
$ ./scripts/config --set-str FOO 'Alpha "Bravo" Charlie'
$ grep -E '^CONFIG_FOO=' .config
CONFIG_FOO="Alpha "Bravo" Charlie"

Fix those three, giving this new behavior:
$ grep -E '^CONFIG_FOO=' .config
CONFIG_FOO="Bar \"Buz\" Meh"
$ ./scripts/config -s FOO
Bar "Buz" Meh
$ ./scripts/config --set-str FOO 'Alpha "Bravo" Charlie'
$ grep -E '^CONFIG_FOO=' .config
CONFIG_FOO="Alpha \"Bravo\" Charlie"

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Acked-by: Andi Kleen <andi@firstfloor.org>
Signed-off-by: Michal Marek <mmarek@suse.cz>


# f0a6332c 15-Dec-2010 Jonas Aaberg <jonas.aberg@stericsson.com>

kbuild: add numeric --set-val option to scripts/config

Add new option to scripts/config for changing .config numeric values

Acked-by: Linus Walleij <linus.walleij@stericsson.com>
Signed-off-by: Jonas Aaberg <jonas.aberg@stericsson.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>


# 45f53cc9 04-Nov-2010 Andi Kleen <ak@linux.intel.com>

Kconfig: fix single letter command in scripts/config

The one letter commands in scripts/config didn't work and always
printed usage. Fix this here.

Cc: erick@openchill.org
Reported-by: erick@openchill.org
Signed-off-by: Andi Kleen <ak@linux.intel.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>


# 1f990cf9 25-May-2009 Michal Marek <mmarek@suse.cz>

kbuild: add generic --set-str option to scripts/config

Signed-off-by: Michal Marek <mmarek@suse.cz>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>


# 47312d2c 25-May-2009 Michal Marek <mmarek@suse.cz>

kbuild: simplify argument loop in scripts/config

Signed-off-by: Michal Marek <mmarek@suse.cz>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>


# 56643222 14-Jun-2009 Michal Marek <mmarek@suse.cz>

kbuild: handle non-existing options in scripts/config

If an option does not exist in .config, set it at the end of the file.

Signed-off-by: Michal Marek <mmarek@suse.cz>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>


# 2302e873 07-Jan-2009 Andi Kleen <andi@firstfloor.org>

kbuild: print usage with no arguments in scripts/config

Requested by Sam.

Signed-off-by: Andi Kleen <ak@linux.intel.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>


# 8e54701e 02-Jan-2009 Andi Kleen <andi@firstfloor.org>

kconfig: add script to manipulate .config files on the command line

I often change single options in .config files. Instead of using
an editor or one of the frontends it's convenient to do this from
the command line. It's also useful to do from automated build scripts
when building different variants from a base config file.

I extracted most of the CONFIG manipulation code from one of my
build scripts into a new shell script scripts/config

The script is not integrated with the normal Kconfig machinery
and doesn't do any checking against Kconfig files, but just manipulates
that text format. This is always done at make time anyways.

I believe this script would be a useful standard addition for scripts/*

Sample usage:

./scripts/config --disable smp
Disable SMP in .config file

./scripts/config --file otherdir/.config --module e1000e
Enable E1000E as module in otherdir/.config

./scripts/config --state smp
y
Check state of config option CONFIG_SMP

After merging into git please make scripts/config executable

Signed-off-by: Andi Kleen <ak@linux.intel.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>