kconfig: re-sync with Linux 4.17-rc4
Align Kconfig to Linux 4.17-rc4 with minimal impact on non-kconfig files.
Previous Kconfig sync was done by commit bf7ab1e70fd762 ("kconfig:
re-sync with Linux 4.10") and it achieved almost perfect alignment with
a few (intended) exceptions, caused by below U-boot commits:
[A] v2015.04 5f9eb2207500 ("kbuild: remove scripts/multiconfig.sh")
[B] v2015.07 20c20826efab ("Kconfig: Enable usage of escape char '\' in string values")
[C] v2016.01 da58dec86616 ("Various Makefiles: Add SPDX-License-Identifier tags")
[D] v2016.03 5b8031ccb4ed ("Add more SPDX-License-Identifier tags")
[E] v2016.03 192bc6948b02 ("Fix GCC format-security errors and convert sprintfs.")
Here is the list of Kconfig commits which followed the v4.10 alignment:
[F] v2018.01 0931ed3c0d0f ("kconfig/symbol.c: use correct pointer type argument for sizeof")
[G] v2018.03 1414e09b4f25 ("kconfig: revert change that was not needed for -Wformat-security")
[H] v2018.05 83d290c56fab ("SPDX: Convert all of our single license tags to Linux Kernel style")
Commit [F] was subsequently applied to Linux kernel as commit [I]
with the same patch id, so it won't contribute to further misalignment.
[I] v4.15-rc1 88127dae6ed9 ("kconfig/symbol.c: use correct pointer type argument for sizeof")
Commit [G] is a Kconfig-specific revert of commit [E].
Commit [H] relocated and reformatted the license doing no functional change.
In summary, the only functional change that makes U-boot Kconfig
diverge from Linux Kconfig is commit [B]. After a brief analysis,
the purpose of [B] seems to be placing "\n" literals in string symbols
like CONFIG_AUTOBOOT_PROMPT="autoboot in %d seconds\n" in order to pass
them directly to printf and expect correct output at runtime. Currently,
Linux doesn't seem to have this requirement, so for the moment [B] looks
like a U-boot specific feature/fix. From point of view of further Kconfig
alignment and backporting efforts, it is highly desired that commits
like [B] are propagated to Linux and any Kconfig fixes/features are
contributed to Linux kernel first. This specific Kconfig re-sync just
keeps [B] in place.
Contrary to 4.10 Kconfig re-sync (which achieves zero non-kconfig
changes), 4.17-rc4 re-sync does some amount of updates in Kbuild
(striving to keep them at minimum), due to a number of reasons:
* Kbuild is affected by the removal of Kconfig "*shipped" files and now
requires flex and bison pre-installed on the host.
* PYTHON{2,3} variables are defined in top-level Makefile as
prerequisite for running the newly developed Kconfig unit tests.
* silentoldconfig becomes an "internal implementation detail" deprecated
for external use, being renamed to syncconfig.
The exact non-kconfig files touched by this commit are:
$ git show --format="" --stat -- ':!scripts/kconfig'
.gitignore | 2 ++
Makefile | 9 +++++++--
scripts/Makefile.build | 11 +++++++++++
scripts/Makefile.lib | 41 ++++++++++++-----------------------------
The imported Linux commits touching the above files are:
c054be10ffdbd5 ("remove gperf left-overs from build system")
73a4f6dbe70a1b ("kbuild: add LEX and YACC variables")
033dba2ec06c47 ("kbuild: prepare to remove C files pre-generated by flex and bison")
eea199b445f64c ("kbuild: remove unnecessary LEX_PREFIX and YACC_PREFIX")
e71de5ee08dcb0 ("kbuild: remove remaining use of undefined YACC_PREFIX")
d59fbbd09d5d6b ("kbuild: replace hardcoded bison in cmd_bison_h with $(YACC)")
911a91c39cabcb H ("kconfig: rename silentoldconfig to syncconfig")
59889300274569 (".gitignore: move *.lex.c *.tab.[ch] patterns to the top-level .gitignore")
9a8dfb394c0467 ("kbuild: clean up *.lex.c and *.tab.[ch] patterns from top-level Makefile")
833e622459432e H ("genksyms: generate lexer and parser during build instead of shipping")
b23d1a241f4eb4 H ("kbuild: add %.lex.c and %.tab.[ch] to 'targets' automatically")
e9781b52d4e0e3 H ("kbuild: add PYTHON2 and PYTHON3 variables")
The commits marked with 'H' are assessed as "hard" (build will fail)
prerequisites and the rest of them are assessed as "soft" prerequisites
for the re-sync. In spite of relatively high number of non-H commits,
they belong to this Kconfig update topic-wise and decrease the number of
cherry pick conflicts for many commits in this series. Additional effort
can be put in eliminating the soft prerequisites, if really needed.
The commits which contributed to this Kconfig re-sync are listed below.
Whenever a conflict resolution has been performed (mostly by hand, but
sometimes automatically by git), it is revealed by the '!' sign in the
second column, which means a patch id mismatch between Linux and U-boot
commits:
9be3213b14d44f ("gconfig: remove misleading parentheses around a condition")
ff85a1a80e0034 ("kconfig: Check for libncurses before menuconfig")
ad8181060788c8 ("kconfig: fix sparse warnings in nconfig")
cb77f0d623ff33 ! ("scripts: Switch to more portable Perl shebang")
bb3290d91695bb ! ("Remove gperf usage from toolchain")
c054be10ffdbd5 ("remove gperf left-overs from build system")
b24413180f5600 ! ("License cleanup: add SPDX GPL-2.0 license identifier to files with no license")
9059a3493efea6 ! ("kconfig: fix relational operators for bool and tristate symbols")
2c37e08464a850 ("kconfig: Warn if choice default is not in choice")
33ca1a24866373 ("kconfig: Document the 'menu' struct")
52aede4ba5efd1 ("kconfig: Document the 'symbol' struct")
c873443430ebd1 ("kconfig: Sync zconf.y with zconf.tab.c_shipped")
9a826842ff2fbd ("kconfig: Rename menu_check_dep() to rewrite_m()")
fa8cedaef814ce ("kconfig: Clarify expression rewriting")
f77850d3fe0c96 ("kconfig: Clean up modules handling and fix crash")
e3b03bf29d6b99 ("kconfig: display recursive dependency resolution hint just once")
73a4f6dbe70a1b ! ("kbuild: add LEX and YACC variables")
033dba2ec06c47 ! ("kbuild: prepare to remove C files pre-generated by flex and bison")
29c833061c1d8c ("kconfig: generate lexer and parser during build instead of shipping")
26e47a3c11a25c ("kconfig: Don't leak symbol names during parsing")
24161a6711c945 ("kconfig: Don't leak 'source' filenames during parsing")
bc28fe1d5ede88 ("kconfig: Don't leak 'option' arguments during parsing")
0724a7c32a54e3 ("kconfig: Don't leak main menus during parsing")
ae7440ef0c8013 ("kconfig: Fix automatic menu creation mem leak")
5b1374b3b3c2fc ("kconfig: Fix expr_free() E_NOT leak")
7cf33f88e29410 ("kconfig: Fix choice symbol expression leak")
05cccce580456d ("kconfig: Document automatic submenu creation code")
0735f7e5def2ab ("kconfig: Document important expression functions")
df60f4b92d3d0b ("kconfig: Remove menu_end_entry()")
b92d804a51796b ("kconfig: drop 'boolean' keyword")
6479f327dea60d ("kconfig: Warn if there is more than one help text")
52e58a3caeba5d ("kconfig: make input_mode static")
5a3dc717b3c785 ("kconfig: make xfgets() really static")
84dd95d4f87a0d ("kconfig: make conf_unsaved a local variable of conf_read()")
765f4cdef6f80d ("kconfig: use default 'yy' prefix for lexer and parser")
eea199b445f64c ("kbuild: remove unnecessary LEX_PREFIX and YACC_PREFIX")
e71de5ee08dcb0 ("kbuild: remove remaining use of undefined YACC_PREFIX")
d59fbbd09d5d6b ! ("kbuild: replace hardcoded bison in cmd_bison_h with $(YACC)")
3e41ba05b6d60c ("kconfig: Document SYMBOL_OPTIONAL logic")
d3465af60f4471 ("kconfig: Clarify choice dependency propagation")
9d1a9e8bc18bea ("kconfig: Document 'if' flattening logic")
b53688014e3325 ("kconfig: Clarify menu and 'if' dependency propagation")
d0fd0428ecf04b ("kconfig: fix make xconfig when gettext is missing")
312ee68752faaa ("kconfig: announce removal of oldnoconfig if used")
1ccb27143360bd ("kconfig: make "Selected by:" and "Implied by:" readable")
cedd55d49dee94 ! ("kconfig: Remove silentoldconfig from help and docs; fix kconfig/conf's help")
1b9eda2e4892cb ("kconfig: Warn if help text is blank")
cb67ab2cd2b8ab ("kconfig: do not write choice values when their dependency becomes n")
4f208f392103e8 ("kconfig: show '?' prompt even if no help text is available")
cd58a91def2acc ("kconfig: remove 'config*' pattern from .gitignnore")
d2a04648a5dbc3 ("kconfig: remove check_stdin()")
f3ff6fb5db68bc ("kconfig: echo stdin to stdout if either is redirected")
9e3e10c725360b ("kconfig: send error messages to stderr")
d717f24d8c6808 ("kconfig: add xrealloc() helper")
523ca58b7db2e3 ("kconfig: remove const qualifier from sym_expand_string_value()")
cd81fc82b93fa4 ("kconfig: add xstrdup() helper")
f4bc1eefc1608e ("kconfig: set SYMBOL_AUTO to the symbol marked with defconfig_list")
bf0bbdcf100322 ("kconfig: Don't leak choice names during parsing")
1a90ce36c6eff6 ("kconfig: Update ncurses package names for menuconfig")
5ae6fcc4bb82bd ("kconfig: fix line number in recursive inclusion error message")
07a422bb213adb ! ("kbuild: restore autoksyms.h touch to the top Makefile")
9a47ceec543bfb ("kconfig: clean-up reverse dependency help implementation")
d9119b5925a03b ("kconfig: Print reverse dependencies in groups")
f467c5640c29ad ("kconfig: only write '# CONFIG_FOO is not set' for visible symbols")
59a80b5e892dde ("kconfig: do not call check_conf() for olddefconfig")
4bb3a5b085cd6f ("kconfig: remove unneeded input_mode test in conf()")
99f0b6578bab44 ("kconfig: remove redundant input_mode test for check_conf() loop")
2aad9b89621386 ("kconfig: hide irrelevant sub-menus for oldconfig")
81d2bc2273052e ("kconfig: invoke oldconfig instead of silentoldconfig from local*config")
911a91c39cabcb ! ("kconfig: rename silentoldconfig to syncconfig")
2a61625835c7c8 ! ("kconfig: remove redundant streamline_config.pl prerequisite")
022a4bf6b59dfd ("kconfig: tests: add framework for Kconfig unit testing")
1903c511905984 ("kconfig: tests: add basic choice tests")
49ac3c0c3aa3b7 ("kconfig: tests: test automatic submenu creation")
b76960c0f6b25d ("kconfig: tests: test if new symbols in choice are asked")
930c429a656fdb ("kconfig: tests: check unneeded "is not set" with unmet dependency")
ee236610653ede ("kconfig: tests: check visibility of tristate choice values in y choice")
beaaddb625400e ("kconfig: tests: test defconfig when two choices interact")
3e4888c2e3d77d ("kconfig: tests: test randconfig for choice in choice")
29c434f367ea7b ("kconfig: tests: test if recursive dependencies are detected")
e2c75e7667c737 ("kconfig: tests: test if recursive inclusion is detected")
f622f827958162 ("kconfig: warn unmet direct dependency of tristate symbols selected by y")
f8f69dc0b4e070 ("kconfig: make unmet dependency warnings readable")
26561514cc9def ("kconfig: do not include both curses.h and ncurses.h for nconfig")
32a94b8b0c3e5a ("kconfig: remove duplicated file name and lineno of recursive inclusion")
379a8eb8eb1a55 ("kconfig: detect recursive inclusion earlier")
18492685e479fd ("kconfig: use yylineno option instead of manual lineno increments")
59889300274569 ! (".gitignore: move *.lex.c *.tab.[ch] patterns to the top-level .gitignore")
9a8dfb394c0467 ! ("kbuild: clean up *.lex.c and *.tab.[ch] patterns from top-level Makefile")
833e622459432e ! ("genksyms: generate lexer and parser during build instead of shipping")
b23d1a241f4eb4 ! ("kbuild: add %.lex.c and %.tab.[ch] to 'targets' automatically")
17baab68d337a0 ("kconfig: extend output of 'listnewconfig'")
e9781b52d4e0e3 ! ("kbuild: add PYTHON2 and PYTHON3 variables")
The current Kconfig update generates below build-time warnings:
YACC scripts/dtc/dtc-parser.tab.h
scripts/dtc/dtc-parser.y: warning: 3 shift/reduce conflicts [-Wconflicts-sr]
YACC scripts/dtc/dtc-parser.tab.c
scripts/dtc/dtc-parser.y: warning: 3 shift/reduce conflicts [-Wconflicts-sr]
This seems to happen because the Kbuild updates apparently didn't make
room for both "*shipped"-based builds and flex/bison-based builds. A
similar problem has been reported for genksyms parser in v4.17-rc1
commit 833e622459432e ("genksyms: generate lexer and parser during build
instead of shipping"). I have figured out empirically that the warnings
are healed after updating the in-tree U-boot DTC to upstream v1.4.6-9,
same as done by Linux v4.17-rc1 commit 9130ba88464032 ("scripts/dtc:
Update to upstream version v1.4.6-9-gaadd0b65c987"). Whether fixing the
DTC-related yacc warnings should be done together with the Kconfig
re-sync, I would like to hear from community.
My testing was limited to:
- make defconfig all
- make ARCH=arm CROSS_COMPILE=aarch64-linux-gnu- r8a7795_ulcb_defconfig all
- comparing .config before and after the re-sync
- running the newly imported Kconfig unit tests as seen below:
$ make testconfig
Tested-by: Petr Vorel <petr.vorel@gmail.com>
============================= test session starts =============================
scripts/kconfig/tests/auto_submenu/__init__.py::test PASSED [ 7%]
scripts/kconfig/tests/choice/__init__.py::test_oldask0 PASSED [ 14%]
scripts/kconfig/tests/choice/__init__.py::test_oldask1 PASSED [ 21%]
scripts/kconfig/tests/choice/__init__.py::test_allyes PASSED [ 28%]
scripts/kconfig/tests/choice/__init__.py::test_allmod PASSED [ 35%]
scripts/kconfig/tests/choice/__init__.py::test_allno PASSED [ 42%]
scripts/kconfig/tests/choice/__init__.py::test_alldef PASSED [ 50%]
scripts/kconfig/tests/choice_value_with_m_dep/__init__.py::test PASSED [ 57%]
scripts/kconfig/tests/err_recursive_inc/__init__.py::test PASSED [ 64%]
scripts/kconfig/tests/inter_choice/__init__.py::test PASSED [ 71%]
scripts/kconfig/tests/new_choice_with_dep/__init__.py::test PASSED [ 78%]
scripts/kconfig/tests/no_write_if_dep_unmet/__init__.py::test PASSED [ 85%]
scripts/kconfig/tests/rand_nested_choice/__init__.py::test PASSED [ 92%]
scripts/kconfig/tests/warn_recursive_dep/__init__.py::test PASSED [100%]
========================== 14 passed in 0.34 seconds ==========================
Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com>
Reviewed-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Tested-by: Petr Vorel <petr.vorel@gmail.com>
2018-05-19 12:13:50 +00:00
|
|
|
#!/usr/bin/env perl
|
2014-07-30 05:08:13 +00:00
|
|
|
#
|
|
|
|
# Copyright 2005-2009 - Steven Rostedt
|
|
|
|
# Licensed under the terms of the GNU GPL License version 2
|
|
|
|
#
|
|
|
|
# It's simple enough to figure out how this works.
|
|
|
|
# If not, then you can ask me at stripconfig@goodmis.org
|
|
|
|
#
|
|
|
|
# What it does?
|
|
|
|
#
|
|
|
|
# If you have installed a Linux kernel from a distribution
|
|
|
|
# that turns on way too many modules than you need, and
|
|
|
|
# you only want the modules you use, then this program
|
|
|
|
# is perfect for you.
|
|
|
|
#
|
|
|
|
# It gives you the ability to turn off all the modules that are
|
|
|
|
# not loaded on your system.
|
|
|
|
#
|
|
|
|
# Howto:
|
|
|
|
#
|
|
|
|
# 1. Boot up the kernel that you want to stream line the config on.
|
|
|
|
# 2. Change directory to the directory holding the source of the
|
|
|
|
# kernel that you just booted.
|
|
|
|
# 3. Copy the configuraton file to this directory as .config
|
|
|
|
# 4. Have all your devices that you need modules for connected and
|
|
|
|
# operational (make sure that their corresponding modules are loaded)
|
|
|
|
# 5. Run this script redirecting the output to some other file
|
|
|
|
# like config_strip.
|
|
|
|
# 6. Back up your old config (if you want too).
|
|
|
|
# 7. copy the config_strip file to .config
|
|
|
|
# 8. Run "make oldconfig"
|
|
|
|
#
|
|
|
|
# Now your kernel is ready to be built with only the modules that
|
|
|
|
# are loaded.
|
|
|
|
#
|
|
|
|
# Here's what I did with my Debian distribution.
|
|
|
|
#
|
|
|
|
# cd /usr/src/linux-2.6.10
|
|
|
|
# cp /boot/config-2.6.10-1-686-smp .config
|
|
|
|
# ~/bin/streamline_config > config_strip
|
|
|
|
# mv .config config_sav
|
|
|
|
# mv config_strip .config
|
|
|
|
# make oldconfig
|
|
|
|
#
|
kconfig: re-sync with Linux 4.17-rc4
Align Kconfig to Linux 4.17-rc4 with minimal impact on non-kconfig files.
Previous Kconfig sync was done by commit bf7ab1e70fd762 ("kconfig:
re-sync with Linux 4.10") and it achieved almost perfect alignment with
a few (intended) exceptions, caused by below U-boot commits:
[A] v2015.04 5f9eb2207500 ("kbuild: remove scripts/multiconfig.sh")
[B] v2015.07 20c20826efab ("Kconfig: Enable usage of escape char '\' in string values")
[C] v2016.01 da58dec86616 ("Various Makefiles: Add SPDX-License-Identifier tags")
[D] v2016.03 5b8031ccb4ed ("Add more SPDX-License-Identifier tags")
[E] v2016.03 192bc6948b02 ("Fix GCC format-security errors and convert sprintfs.")
Here is the list of Kconfig commits which followed the v4.10 alignment:
[F] v2018.01 0931ed3c0d0f ("kconfig/symbol.c: use correct pointer type argument for sizeof")
[G] v2018.03 1414e09b4f25 ("kconfig: revert change that was not needed for -Wformat-security")
[H] v2018.05 83d290c56fab ("SPDX: Convert all of our single license tags to Linux Kernel style")
Commit [F] was subsequently applied to Linux kernel as commit [I]
with the same patch id, so it won't contribute to further misalignment.
[I] v4.15-rc1 88127dae6ed9 ("kconfig/symbol.c: use correct pointer type argument for sizeof")
Commit [G] is a Kconfig-specific revert of commit [E].
Commit [H] relocated and reformatted the license doing no functional change.
In summary, the only functional change that makes U-boot Kconfig
diverge from Linux Kconfig is commit [B]. After a brief analysis,
the purpose of [B] seems to be placing "\n" literals in string symbols
like CONFIG_AUTOBOOT_PROMPT="autoboot in %d seconds\n" in order to pass
them directly to printf and expect correct output at runtime. Currently,
Linux doesn't seem to have this requirement, so for the moment [B] looks
like a U-boot specific feature/fix. From point of view of further Kconfig
alignment and backporting efforts, it is highly desired that commits
like [B] are propagated to Linux and any Kconfig fixes/features are
contributed to Linux kernel first. This specific Kconfig re-sync just
keeps [B] in place.
Contrary to 4.10 Kconfig re-sync (which achieves zero non-kconfig
changes), 4.17-rc4 re-sync does some amount of updates in Kbuild
(striving to keep them at minimum), due to a number of reasons:
* Kbuild is affected by the removal of Kconfig "*shipped" files and now
requires flex and bison pre-installed on the host.
* PYTHON{2,3} variables are defined in top-level Makefile as
prerequisite for running the newly developed Kconfig unit tests.
* silentoldconfig becomes an "internal implementation detail" deprecated
for external use, being renamed to syncconfig.
The exact non-kconfig files touched by this commit are:
$ git show --format="" --stat -- ':!scripts/kconfig'
.gitignore | 2 ++
Makefile | 9 +++++++--
scripts/Makefile.build | 11 +++++++++++
scripts/Makefile.lib | 41 ++++++++++++-----------------------------
The imported Linux commits touching the above files are:
c054be10ffdbd5 ("remove gperf left-overs from build system")
73a4f6dbe70a1b ("kbuild: add LEX and YACC variables")
033dba2ec06c47 ("kbuild: prepare to remove C files pre-generated by flex and bison")
eea199b445f64c ("kbuild: remove unnecessary LEX_PREFIX and YACC_PREFIX")
e71de5ee08dcb0 ("kbuild: remove remaining use of undefined YACC_PREFIX")
d59fbbd09d5d6b ("kbuild: replace hardcoded bison in cmd_bison_h with $(YACC)")
911a91c39cabcb H ("kconfig: rename silentoldconfig to syncconfig")
59889300274569 (".gitignore: move *.lex.c *.tab.[ch] patterns to the top-level .gitignore")
9a8dfb394c0467 ("kbuild: clean up *.lex.c and *.tab.[ch] patterns from top-level Makefile")
833e622459432e H ("genksyms: generate lexer and parser during build instead of shipping")
b23d1a241f4eb4 H ("kbuild: add %.lex.c and %.tab.[ch] to 'targets' automatically")
e9781b52d4e0e3 H ("kbuild: add PYTHON2 and PYTHON3 variables")
The commits marked with 'H' are assessed as "hard" (build will fail)
prerequisites and the rest of them are assessed as "soft" prerequisites
for the re-sync. In spite of relatively high number of non-H commits,
they belong to this Kconfig update topic-wise and decrease the number of
cherry pick conflicts for many commits in this series. Additional effort
can be put in eliminating the soft prerequisites, if really needed.
The commits which contributed to this Kconfig re-sync are listed below.
Whenever a conflict resolution has been performed (mostly by hand, but
sometimes automatically by git), it is revealed by the '!' sign in the
second column, which means a patch id mismatch between Linux and U-boot
commits:
9be3213b14d44f ("gconfig: remove misleading parentheses around a condition")
ff85a1a80e0034 ("kconfig: Check for libncurses before menuconfig")
ad8181060788c8 ("kconfig: fix sparse warnings in nconfig")
cb77f0d623ff33 ! ("scripts: Switch to more portable Perl shebang")
bb3290d91695bb ! ("Remove gperf usage from toolchain")
c054be10ffdbd5 ("remove gperf left-overs from build system")
b24413180f5600 ! ("License cleanup: add SPDX GPL-2.0 license identifier to files with no license")
9059a3493efea6 ! ("kconfig: fix relational operators for bool and tristate symbols")
2c37e08464a850 ("kconfig: Warn if choice default is not in choice")
33ca1a24866373 ("kconfig: Document the 'menu' struct")
52aede4ba5efd1 ("kconfig: Document the 'symbol' struct")
c873443430ebd1 ("kconfig: Sync zconf.y with zconf.tab.c_shipped")
9a826842ff2fbd ("kconfig: Rename menu_check_dep() to rewrite_m()")
fa8cedaef814ce ("kconfig: Clarify expression rewriting")
f77850d3fe0c96 ("kconfig: Clean up modules handling and fix crash")
e3b03bf29d6b99 ("kconfig: display recursive dependency resolution hint just once")
73a4f6dbe70a1b ! ("kbuild: add LEX and YACC variables")
033dba2ec06c47 ! ("kbuild: prepare to remove C files pre-generated by flex and bison")
29c833061c1d8c ("kconfig: generate lexer and parser during build instead of shipping")
26e47a3c11a25c ("kconfig: Don't leak symbol names during parsing")
24161a6711c945 ("kconfig: Don't leak 'source' filenames during parsing")
bc28fe1d5ede88 ("kconfig: Don't leak 'option' arguments during parsing")
0724a7c32a54e3 ("kconfig: Don't leak main menus during parsing")
ae7440ef0c8013 ("kconfig: Fix automatic menu creation mem leak")
5b1374b3b3c2fc ("kconfig: Fix expr_free() E_NOT leak")
7cf33f88e29410 ("kconfig: Fix choice symbol expression leak")
05cccce580456d ("kconfig: Document automatic submenu creation code")
0735f7e5def2ab ("kconfig: Document important expression functions")
df60f4b92d3d0b ("kconfig: Remove menu_end_entry()")
b92d804a51796b ("kconfig: drop 'boolean' keyword")
6479f327dea60d ("kconfig: Warn if there is more than one help text")
52e58a3caeba5d ("kconfig: make input_mode static")
5a3dc717b3c785 ("kconfig: make xfgets() really static")
84dd95d4f87a0d ("kconfig: make conf_unsaved a local variable of conf_read()")
765f4cdef6f80d ("kconfig: use default 'yy' prefix for lexer and parser")
eea199b445f64c ("kbuild: remove unnecessary LEX_PREFIX and YACC_PREFIX")
e71de5ee08dcb0 ("kbuild: remove remaining use of undefined YACC_PREFIX")
d59fbbd09d5d6b ! ("kbuild: replace hardcoded bison in cmd_bison_h with $(YACC)")
3e41ba05b6d60c ("kconfig: Document SYMBOL_OPTIONAL logic")
d3465af60f4471 ("kconfig: Clarify choice dependency propagation")
9d1a9e8bc18bea ("kconfig: Document 'if' flattening logic")
b53688014e3325 ("kconfig: Clarify menu and 'if' dependency propagation")
d0fd0428ecf04b ("kconfig: fix make xconfig when gettext is missing")
312ee68752faaa ("kconfig: announce removal of oldnoconfig if used")
1ccb27143360bd ("kconfig: make "Selected by:" and "Implied by:" readable")
cedd55d49dee94 ! ("kconfig: Remove silentoldconfig from help and docs; fix kconfig/conf's help")
1b9eda2e4892cb ("kconfig: Warn if help text is blank")
cb67ab2cd2b8ab ("kconfig: do not write choice values when their dependency becomes n")
4f208f392103e8 ("kconfig: show '?' prompt even if no help text is available")
cd58a91def2acc ("kconfig: remove 'config*' pattern from .gitignnore")
d2a04648a5dbc3 ("kconfig: remove check_stdin()")
f3ff6fb5db68bc ("kconfig: echo stdin to stdout if either is redirected")
9e3e10c725360b ("kconfig: send error messages to stderr")
d717f24d8c6808 ("kconfig: add xrealloc() helper")
523ca58b7db2e3 ("kconfig: remove const qualifier from sym_expand_string_value()")
cd81fc82b93fa4 ("kconfig: add xstrdup() helper")
f4bc1eefc1608e ("kconfig: set SYMBOL_AUTO to the symbol marked with defconfig_list")
bf0bbdcf100322 ("kconfig: Don't leak choice names during parsing")
1a90ce36c6eff6 ("kconfig: Update ncurses package names for menuconfig")
5ae6fcc4bb82bd ("kconfig: fix line number in recursive inclusion error message")
07a422bb213adb ! ("kbuild: restore autoksyms.h touch to the top Makefile")
9a47ceec543bfb ("kconfig: clean-up reverse dependency help implementation")
d9119b5925a03b ("kconfig: Print reverse dependencies in groups")
f467c5640c29ad ("kconfig: only write '# CONFIG_FOO is not set' for visible symbols")
59a80b5e892dde ("kconfig: do not call check_conf() for olddefconfig")
4bb3a5b085cd6f ("kconfig: remove unneeded input_mode test in conf()")
99f0b6578bab44 ("kconfig: remove redundant input_mode test for check_conf() loop")
2aad9b89621386 ("kconfig: hide irrelevant sub-menus for oldconfig")
81d2bc2273052e ("kconfig: invoke oldconfig instead of silentoldconfig from local*config")
911a91c39cabcb ! ("kconfig: rename silentoldconfig to syncconfig")
2a61625835c7c8 ! ("kconfig: remove redundant streamline_config.pl prerequisite")
022a4bf6b59dfd ("kconfig: tests: add framework for Kconfig unit testing")
1903c511905984 ("kconfig: tests: add basic choice tests")
49ac3c0c3aa3b7 ("kconfig: tests: test automatic submenu creation")
b76960c0f6b25d ("kconfig: tests: test if new symbols in choice are asked")
930c429a656fdb ("kconfig: tests: check unneeded "is not set" with unmet dependency")
ee236610653ede ("kconfig: tests: check visibility of tristate choice values in y choice")
beaaddb625400e ("kconfig: tests: test defconfig when two choices interact")
3e4888c2e3d77d ("kconfig: tests: test randconfig for choice in choice")
29c434f367ea7b ("kconfig: tests: test if recursive dependencies are detected")
e2c75e7667c737 ("kconfig: tests: test if recursive inclusion is detected")
f622f827958162 ("kconfig: warn unmet direct dependency of tristate symbols selected by y")
f8f69dc0b4e070 ("kconfig: make unmet dependency warnings readable")
26561514cc9def ("kconfig: do not include both curses.h and ncurses.h for nconfig")
32a94b8b0c3e5a ("kconfig: remove duplicated file name and lineno of recursive inclusion")
379a8eb8eb1a55 ("kconfig: detect recursive inclusion earlier")
18492685e479fd ("kconfig: use yylineno option instead of manual lineno increments")
59889300274569 ! (".gitignore: move *.lex.c *.tab.[ch] patterns to the top-level .gitignore")
9a8dfb394c0467 ! ("kbuild: clean up *.lex.c and *.tab.[ch] patterns from top-level Makefile")
833e622459432e ! ("genksyms: generate lexer and parser during build instead of shipping")
b23d1a241f4eb4 ! ("kbuild: add %.lex.c and %.tab.[ch] to 'targets' automatically")
17baab68d337a0 ("kconfig: extend output of 'listnewconfig'")
e9781b52d4e0e3 ! ("kbuild: add PYTHON2 and PYTHON3 variables")
The current Kconfig update generates below build-time warnings:
YACC scripts/dtc/dtc-parser.tab.h
scripts/dtc/dtc-parser.y: warning: 3 shift/reduce conflicts [-Wconflicts-sr]
YACC scripts/dtc/dtc-parser.tab.c
scripts/dtc/dtc-parser.y: warning: 3 shift/reduce conflicts [-Wconflicts-sr]
This seems to happen because the Kbuild updates apparently didn't make
room for both "*shipped"-based builds and flex/bison-based builds. A
similar problem has been reported for genksyms parser in v4.17-rc1
commit 833e622459432e ("genksyms: generate lexer and parser during build
instead of shipping"). I have figured out empirically that the warnings
are healed after updating the in-tree U-boot DTC to upstream v1.4.6-9,
same as done by Linux v4.17-rc1 commit 9130ba88464032 ("scripts/dtc:
Update to upstream version v1.4.6-9-gaadd0b65c987"). Whether fixing the
DTC-related yacc warnings should be done together with the Kconfig
re-sync, I would like to hear from community.
My testing was limited to:
- make defconfig all
- make ARCH=arm CROSS_COMPILE=aarch64-linux-gnu- r8a7795_ulcb_defconfig all
- comparing .config before and after the re-sync
- running the newly imported Kconfig unit tests as seen below:
$ make testconfig
Tested-by: Petr Vorel <petr.vorel@gmail.com>
============================= test session starts =============================
scripts/kconfig/tests/auto_submenu/__init__.py::test PASSED [ 7%]
scripts/kconfig/tests/choice/__init__.py::test_oldask0 PASSED [ 14%]
scripts/kconfig/tests/choice/__init__.py::test_oldask1 PASSED [ 21%]
scripts/kconfig/tests/choice/__init__.py::test_allyes PASSED [ 28%]
scripts/kconfig/tests/choice/__init__.py::test_allmod PASSED [ 35%]
scripts/kconfig/tests/choice/__init__.py::test_allno PASSED [ 42%]
scripts/kconfig/tests/choice/__init__.py::test_alldef PASSED [ 50%]
scripts/kconfig/tests/choice_value_with_m_dep/__init__.py::test PASSED [ 57%]
scripts/kconfig/tests/err_recursive_inc/__init__.py::test PASSED [ 64%]
scripts/kconfig/tests/inter_choice/__init__.py::test PASSED [ 71%]
scripts/kconfig/tests/new_choice_with_dep/__init__.py::test PASSED [ 78%]
scripts/kconfig/tests/no_write_if_dep_unmet/__init__.py::test PASSED [ 85%]
scripts/kconfig/tests/rand_nested_choice/__init__.py::test PASSED [ 92%]
scripts/kconfig/tests/warn_recursive_dep/__init__.py::test PASSED [100%]
========================== 14 passed in 0.34 seconds ==========================
Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com>
Reviewed-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Tested-by: Petr Vorel <petr.vorel@gmail.com>
2018-05-19 12:13:50 +00:00
|
|
|
use warnings;
|
2014-07-30 05:08:13 +00:00
|
|
|
use strict;
|
|
|
|
use Getopt::Long;
|
|
|
|
|
|
|
|
# set the environment variable LOCALMODCONFIG_DEBUG to get
|
|
|
|
# debug output.
|
|
|
|
my $debugprint = 0;
|
|
|
|
$debugprint = 1 if (defined($ENV{LOCALMODCONFIG_DEBUG}));
|
|
|
|
|
|
|
|
sub dprint {
|
|
|
|
return if (!$debugprint);
|
|
|
|
print STDERR @_;
|
|
|
|
}
|
|
|
|
|
|
|
|
my $config = ".config";
|
|
|
|
|
|
|
|
my $uname = `uname -r`;
|
|
|
|
chomp $uname;
|
|
|
|
|
|
|
|
my @searchconfigs = (
|
|
|
|
{
|
|
|
|
"file" => ".config",
|
|
|
|
"exec" => "cat",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"file" => "/proc/config.gz",
|
|
|
|
"exec" => "zcat",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"file" => "/boot/config-$uname",
|
|
|
|
"exec" => "cat",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"file" => "/boot/vmlinuz-$uname",
|
|
|
|
"exec" => "scripts/extract-ikconfig",
|
|
|
|
"test" => "scripts/extract-ikconfig",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"file" => "vmlinux",
|
|
|
|
"exec" => "scripts/extract-ikconfig",
|
|
|
|
"test" => "scripts/extract-ikconfig",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"file" => "/lib/modules/$uname/kernel/kernel/configs.ko",
|
|
|
|
"exec" => "scripts/extract-ikconfig",
|
|
|
|
"test" => "scripts/extract-ikconfig",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"file" => "kernel/configs.ko",
|
|
|
|
"exec" => "scripts/extract-ikconfig",
|
|
|
|
"test" => "scripts/extract-ikconfig",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"file" => "kernel/configs.o",
|
|
|
|
"exec" => "scripts/extract-ikconfig",
|
|
|
|
"test" => "scripts/extract-ikconfig",
|
|
|
|
},
|
|
|
|
);
|
|
|
|
|
|
|
|
sub read_config {
|
|
|
|
foreach my $conf (@searchconfigs) {
|
|
|
|
my $file = $conf->{"file"};
|
|
|
|
|
|
|
|
next if ( ! -f "$file");
|
|
|
|
|
|
|
|
if (defined($conf->{"test"})) {
|
|
|
|
`$conf->{"test"} $conf->{"file"} 2>/dev/null`;
|
|
|
|
next if ($?);
|
|
|
|
}
|
|
|
|
|
|
|
|
my $exec = $conf->{"exec"};
|
|
|
|
|
|
|
|
print STDERR "using config: '$file'\n";
|
|
|
|
|
|
|
|
open(my $infile, '-|', "$exec $file") || die "Failed to run $exec $file";
|
|
|
|
my @x = <$infile>;
|
|
|
|
close $infile;
|
|
|
|
return @x;
|
|
|
|
}
|
|
|
|
die "No config file found";
|
|
|
|
}
|
|
|
|
|
|
|
|
my @config_file = read_config;
|
|
|
|
|
|
|
|
# Parse options
|
|
|
|
my $localmodconfig = 0;
|
|
|
|
my $localyesconfig = 0;
|
|
|
|
|
|
|
|
GetOptions("localmodconfig" => \$localmodconfig,
|
|
|
|
"localyesconfig" => \$localyesconfig);
|
|
|
|
|
|
|
|
# Get the build source and top level Kconfig file (passed in)
|
|
|
|
my $ksource = ($ARGV[0] ? $ARGV[0] : '.');
|
|
|
|
my $kconfig = $ARGV[1];
|
|
|
|
my $lsmod_file = $ENV{'LSMOD'};
|
|
|
|
|
2017-02-11 03:39:54 +00:00
|
|
|
my @makefiles = `find $ksource -name Makefile -or -name Kbuild 2>/dev/null`;
|
2014-07-30 05:08:13 +00:00
|
|
|
chomp @makefiles;
|
|
|
|
|
|
|
|
my %depends;
|
|
|
|
my %selects;
|
|
|
|
my %prompts;
|
|
|
|
my %objects;
|
|
|
|
my $var;
|
|
|
|
my $iflevel = 0;
|
|
|
|
my @ifdeps;
|
|
|
|
|
|
|
|
# prevent recursion
|
|
|
|
my %read_kconfigs;
|
|
|
|
|
|
|
|
sub read_kconfig {
|
|
|
|
my ($kconfig) = @_;
|
|
|
|
|
|
|
|
my $state = "NONE";
|
|
|
|
my $config;
|
|
|
|
|
|
|
|
my $cont = 0;
|
|
|
|
my $line;
|
|
|
|
|
|
|
|
my $source = "$ksource/$kconfig";
|
|
|
|
my $last_source = "";
|
|
|
|
|
|
|
|
# Check for any environment variables used
|
|
|
|
while ($source =~ /\$(\w+)/ && $last_source ne $source) {
|
|
|
|
my $env = $1;
|
|
|
|
$last_source = $source;
|
|
|
|
$source =~ s/\$$env/$ENV{$env}/;
|
|
|
|
}
|
|
|
|
|
|
|
|
open(my $kinfile, '<', $source) || die "Can't open $kconfig";
|
|
|
|
while (<$kinfile>) {
|
|
|
|
chomp;
|
|
|
|
|
|
|
|
# Make sure that lines ending with \ continue
|
|
|
|
if ($cont) {
|
|
|
|
$_ = $line . " " . $_;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (s/\\$//) {
|
|
|
|
$cont = 1;
|
|
|
|
$line = $_;
|
|
|
|
next;
|
|
|
|
}
|
|
|
|
|
|
|
|
$cont = 0;
|
|
|
|
|
|
|
|
# collect any Kconfig sources
|
2017-02-11 03:39:54 +00:00
|
|
|
if (/^source\s+"?([^"]+)/) {
|
2014-07-30 05:08:13 +00:00
|
|
|
my $kconfig = $1;
|
|
|
|
# prevent reading twice.
|
|
|
|
if (!defined($read_kconfigs{$kconfig})) {
|
|
|
|
$read_kconfigs{$kconfig} = 1;
|
|
|
|
read_kconfig($kconfig);
|
|
|
|
}
|
|
|
|
next;
|
|
|
|
}
|
|
|
|
|
|
|
|
# configs found
|
|
|
|
if (/^\s*(menu)?config\s+(\S+)\s*$/) {
|
|
|
|
$state = "NEW";
|
|
|
|
$config = $2;
|
|
|
|
|
|
|
|
# Add depends for 'if' nesting
|
|
|
|
for (my $i = 0; $i < $iflevel; $i++) {
|
|
|
|
if ($i) {
|
|
|
|
$depends{$config} .= " " . $ifdeps[$i];
|
|
|
|
} else {
|
|
|
|
$depends{$config} = $ifdeps[$i];
|
|
|
|
}
|
|
|
|
$state = "DEP";
|
|
|
|
}
|
|
|
|
|
|
|
|
# collect the depends for the config
|
|
|
|
} elsif ($state eq "NEW" && /^\s*depends\s+on\s+(.*)$/) {
|
|
|
|
$state = "DEP";
|
|
|
|
$depends{$config} = $1;
|
|
|
|
} elsif ($state eq "DEP" && /^\s*depends\s+on\s+(.*)$/) {
|
|
|
|
$depends{$config} .= " " . $1;
|
|
|
|
} elsif ($state eq "DEP" && /^\s*def(_(bool|tristate)|ault)\s+(\S.*)$/) {
|
|
|
|
my $dep = $3;
|
|
|
|
if ($dep !~ /^\s*(y|m|n)\s*$/) {
|
|
|
|
$dep =~ s/.*\sif\s+//;
|
|
|
|
$depends{$config} .= " " . $dep;
|
|
|
|
dprint "Added default depends $dep to $config\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
# Get the configs that select this config
|
|
|
|
} elsif ($state ne "NONE" && /^\s*select\s+(\S+)/) {
|
|
|
|
my $conf = $1;
|
|
|
|
if (defined($selects{$conf})) {
|
|
|
|
$selects{$conf} .= " " . $config;
|
|
|
|
} else {
|
|
|
|
$selects{$conf} = $config;
|
|
|
|
}
|
|
|
|
|
|
|
|
# configs without prompts must be selected
|
2017-02-11 03:39:54 +00:00
|
|
|
} elsif ($state ne "NONE" && /^\s*(tristate\s+\S|prompt\b)/) {
|
2014-07-30 05:08:13 +00:00
|
|
|
# note if the config has a prompt
|
|
|
|
$prompts{$config} = 1;
|
|
|
|
|
|
|
|
# Check for if statements
|
|
|
|
} elsif (/^if\s+(.*\S)\s*$/) {
|
|
|
|
my $deps = $1;
|
|
|
|
# remove beginning and ending non text
|
|
|
|
$deps =~ s/^[^a-zA-Z0-9_]*//;
|
|
|
|
$deps =~ s/[^a-zA-Z0-9_]*$//;
|
|
|
|
|
|
|
|
my @deps = split /[^a-zA-Z0-9_]+/, $deps;
|
|
|
|
|
|
|
|
$ifdeps[$iflevel++] = join ':', @deps;
|
|
|
|
|
|
|
|
} elsif (/^endif/) {
|
|
|
|
|
|
|
|
$iflevel-- if ($iflevel);
|
|
|
|
|
2017-02-11 03:39:54 +00:00
|
|
|
# stop on "help" and keywords that end a menu entry
|
|
|
|
} elsif (/^\s*(---)?help(---)?\s*$/ || /^(comment|choice|menu)\b/) {
|
2014-07-30 05:08:13 +00:00
|
|
|
$state = "NONE";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
close($kinfile);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($kconfig) {
|
|
|
|
read_kconfig($kconfig);
|
|
|
|
}
|
|
|
|
|
|
|
|
# Makefiles can use variables to define their dependencies
|
|
|
|
sub convert_vars {
|
|
|
|
my ($line, %vars) = @_;
|
|
|
|
|
|
|
|
my $process = "";
|
|
|
|
|
|
|
|
while ($line =~ s/^(.*?)(\$\((.*?)\))//) {
|
|
|
|
my $start = $1;
|
|
|
|
my $variable = $2;
|
|
|
|
my $var = $3;
|
|
|
|
|
|
|
|
if (defined($vars{$var})) {
|
|
|
|
$process .= $start . $vars{$var};
|
|
|
|
} else {
|
|
|
|
$process .= $start . $variable;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$process .= $line;
|
|
|
|
|
|
|
|
return $process;
|
|
|
|
}
|
|
|
|
|
|
|
|
# Read all Makefiles to map the configs to the objects
|
|
|
|
foreach my $makefile (@makefiles) {
|
|
|
|
|
|
|
|
my $line = "";
|
|
|
|
my %make_vars;
|
|
|
|
|
|
|
|
open(my $infile, '<', $makefile) || die "Can't open $makefile";
|
|
|
|
while (<$infile>) {
|
|
|
|
# if this line ends with a backslash, continue
|
|
|
|
chomp;
|
|
|
|
if (/^(.*)\\$/) {
|
|
|
|
$line .= $1;
|
|
|
|
next;
|
|
|
|
}
|
|
|
|
|
|
|
|
$line .= $_;
|
|
|
|
$_ = $line;
|
|
|
|
$line = "";
|
|
|
|
|
|
|
|
my $objs;
|
|
|
|
|
|
|
|
# Convert variables in a line (could define configs)
|
|
|
|
$_ = convert_vars($_, %make_vars);
|
|
|
|
|
|
|
|
# collect objects after obj-$(CONFIG_FOO_BAR)
|
|
|
|
if (/obj-\$\((CONFIG_[^\)]*)\)\s*[+:]?=\s*(.*)/) {
|
|
|
|
$var = $1;
|
|
|
|
$objs = $2;
|
|
|
|
|
|
|
|
# check if variables are set
|
|
|
|
} elsif (/^\s*(\S+)\s*[:]?=\s*(.*\S)/) {
|
|
|
|
$make_vars{$1} = $2;
|
|
|
|
}
|
|
|
|
if (defined($objs)) {
|
|
|
|
foreach my $obj (split /\s+/,$objs) {
|
|
|
|
$obj =~ s/-/_/g;
|
|
|
|
if ($obj =~ /(.*)\.o$/) {
|
|
|
|
# Objects may be enabled by more than one config.
|
|
|
|
# Store configs in an array.
|
|
|
|
my @arr;
|
|
|
|
|
|
|
|
if (defined($objects{$1})) {
|
|
|
|
@arr = @{$objects{$1}};
|
|
|
|
}
|
|
|
|
|
|
|
|
$arr[$#arr+1] = $var;
|
|
|
|
|
|
|
|
# The objects have a hash mapping to a reference
|
|
|
|
# of an array of configs.
|
|
|
|
$objects{$1} = \@arr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
close($infile);
|
|
|
|
}
|
|
|
|
|
|
|
|
my %modules;
|
|
|
|
my $linfile;
|
|
|
|
|
|
|
|
if (defined($lsmod_file)) {
|
|
|
|
if ( ! -f $lsmod_file) {
|
|
|
|
if ( -f $ENV{'objtree'}."/".$lsmod_file) {
|
|
|
|
$lsmod_file = $ENV{'objtree'}."/".$lsmod_file;
|
|
|
|
} else {
|
|
|
|
die "$lsmod_file not found";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
my $otype = ( -x $lsmod_file) ? '-|' : '<';
|
|
|
|
open($linfile, $otype, $lsmod_file);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
# see what modules are loaded on this system
|
|
|
|
my $lsmod;
|
|
|
|
|
|
|
|
foreach my $dir ( ("/sbin", "/bin", "/usr/sbin", "/usr/bin") ) {
|
|
|
|
if ( -x "$dir/lsmod" ) {
|
|
|
|
$lsmod = "$dir/lsmod";
|
|
|
|
last;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!defined($lsmod)) {
|
|
|
|
# try just the path
|
|
|
|
$lsmod = "lsmod";
|
|
|
|
}
|
|
|
|
|
|
|
|
open($linfile, '-|', $lsmod) || die "Can not call lsmod with $lsmod";
|
|
|
|
}
|
|
|
|
|
|
|
|
while (<$linfile>) {
|
|
|
|
next if (/^Module/); # Skip the first line.
|
|
|
|
if (/^(\S+)/) {
|
|
|
|
$modules{$1} = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
close ($linfile);
|
|
|
|
|
|
|
|
# add to the configs hash all configs that are needed to enable
|
|
|
|
# a loaded module. This is a direct obj-${CONFIG_FOO} += bar.o
|
|
|
|
# where we know we need bar.o so we add FOO to the list.
|
|
|
|
my %configs;
|
|
|
|
foreach my $module (keys(%modules)) {
|
|
|
|
if (defined($objects{$module})) {
|
|
|
|
my @arr = @{$objects{$module}};
|
|
|
|
foreach my $conf (@arr) {
|
|
|
|
$configs{$conf} = $module;
|
|
|
|
dprint "$conf added by direct ($module)\n";
|
|
|
|
if ($debugprint) {
|
|
|
|
my $c=$conf;
|
|
|
|
$c =~ s/^CONFIG_//;
|
|
|
|
if (defined($depends{$c})) {
|
|
|
|
dprint " deps = $depends{$c}\n";
|
|
|
|
} else {
|
|
|
|
dprint " no deps\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
# Most likely, someone has a custom (binary?) module loaded.
|
|
|
|
print STDERR "$module config not found!!\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
# Read the current config, and see what is enabled. We want to
|
|
|
|
# ignore configs that we would not enable anyway.
|
|
|
|
|
|
|
|
my %orig_configs;
|
|
|
|
my $valid = "A-Za-z_0-9";
|
|
|
|
|
|
|
|
foreach my $line (@config_file) {
|
|
|
|
$_ = $line;
|
|
|
|
|
|
|
|
if (/(CONFIG_[$valid]*)=(m|y)/) {
|
|
|
|
$orig_configs{$1} = $2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
my $repeat = 1;
|
|
|
|
|
|
|
|
my $depconfig;
|
|
|
|
|
|
|
|
#
|
|
|
|
# Note, we do not care about operands (like: &&, ||, !) we want to add any
|
|
|
|
# config that is in the depend list of another config. This script does
|
|
|
|
# not enable configs that are not already enabled. If we come across a
|
|
|
|
# config A that depends on !B, we can still add B to the list of depends
|
|
|
|
# to keep on. If A was on in the original config, B would not have been
|
|
|
|
# and B would not be turned on by this script.
|
|
|
|
#
|
|
|
|
sub parse_config_depends
|
|
|
|
{
|
|
|
|
my ($p) = @_;
|
|
|
|
|
|
|
|
while ($p =~ /[$valid]/) {
|
|
|
|
|
|
|
|
if ($p =~ /^[^$valid]*([$valid]+)/) {
|
|
|
|
my $conf = "CONFIG_" . $1;
|
|
|
|
|
|
|
|
$p =~ s/^[^$valid]*[$valid]+//;
|
|
|
|
|
|
|
|
# We only need to process if the depend config is a module
|
2017-02-11 03:39:54 +00:00
|
|
|
if (!defined($orig_configs{$conf}) || $orig_configs{$conf} eq "y") {
|
2014-07-30 05:08:13 +00:00
|
|
|
next;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!defined($configs{$conf})) {
|
|
|
|
# We must make sure that this config has its
|
|
|
|
# dependencies met.
|
|
|
|
$repeat = 1; # do again
|
|
|
|
dprint "$conf selected by depend $depconfig\n";
|
|
|
|
$configs{$conf} = 1;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
die "this should never happen";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
# Select is treated a bit differently than depends. We call this
|
|
|
|
# when a config has no prompt and requires another config to be
|
|
|
|
# selected. We use to just select all configs that selected this
|
|
|
|
# config, but found that that can balloon into enabling hundreds
|
|
|
|
# of configs that we do not care about.
|
|
|
|
#
|
|
|
|
# The idea is we look at all the configs that select it. If one
|
|
|
|
# is already in our list of configs to enable, then there's nothing
|
|
|
|
# else to do. If there isn't, we pick the first config that was
|
|
|
|
# enabled in the orignal config and use that.
|
|
|
|
sub parse_config_selects
|
|
|
|
{
|
|
|
|
my ($config, $p) = @_;
|
|
|
|
|
|
|
|
my $next_config;
|
|
|
|
|
|
|
|
while ($p =~ /[$valid]/) {
|
|
|
|
|
|
|
|
if ($p =~ /^[^$valid]*([$valid]+)/) {
|
|
|
|
my $conf = "CONFIG_" . $1;
|
|
|
|
|
|
|
|
$p =~ s/^[^$valid]*[$valid]+//;
|
|
|
|
|
|
|
|
# Make sure that this config exists in the current .config file
|
|
|
|
if (!defined($orig_configs{$conf})) {
|
|
|
|
dprint "$conf not set for $config select\n";
|
|
|
|
next;
|
|
|
|
}
|
|
|
|
|
|
|
|
# Check if something other than a module selects this config
|
|
|
|
if (defined($orig_configs{$conf}) && $orig_configs{$conf} ne "m") {
|
|
|
|
dprint "$conf (non module) selects config, we are good\n";
|
|
|
|
# we are good with this
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (defined($configs{$conf})) {
|
|
|
|
dprint "$conf selects $config so we are good\n";
|
|
|
|
# A set config selects this config, we are good
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
# Set this config to be selected
|
|
|
|
if (!defined($next_config)) {
|
|
|
|
$next_config = $conf;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
die "this should never happen";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
# If no possible config selected this, then something happened.
|
|
|
|
if (!defined($next_config)) {
|
|
|
|
print STDERR "WARNING: $config is required, but nothing in the\n";
|
|
|
|
print STDERR " current config selects it.\n";
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
# If we are here, then we found no config that is set and
|
|
|
|
# selects this config. Repeat.
|
|
|
|
$repeat = 1;
|
|
|
|
# Make this config need to be selected
|
|
|
|
$configs{$next_config} = 1;
|
|
|
|
dprint "$next_config selected by select $config\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
my %process_selects;
|
|
|
|
|
|
|
|
# loop through all configs, select their dependencies.
|
|
|
|
sub loop_depend {
|
|
|
|
$repeat = 1;
|
|
|
|
|
|
|
|
while ($repeat) {
|
|
|
|
$repeat = 0;
|
|
|
|
|
|
|
|
forloop:
|
|
|
|
foreach my $config (keys %configs) {
|
|
|
|
|
|
|
|
# If this config is not a module, we do not need to process it
|
|
|
|
if (defined($orig_configs{$config}) && $orig_configs{$config} ne "m") {
|
|
|
|
next forloop;
|
|
|
|
}
|
|
|
|
|
|
|
|
$config =~ s/^CONFIG_//;
|
|
|
|
$depconfig = $config;
|
|
|
|
|
|
|
|
if (defined($depends{$config})) {
|
|
|
|
# This config has dependencies. Make sure they are also included
|
|
|
|
parse_config_depends $depends{$config};
|
|
|
|
}
|
|
|
|
|
|
|
|
# If the config has no prompt, then we need to check if a config
|
|
|
|
# that is enabled selected it. Or if we need to enable one.
|
|
|
|
if (!defined($prompts{$config}) && defined($selects{$config})) {
|
|
|
|
$process_selects{$config} = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
sub loop_select {
|
|
|
|
|
|
|
|
foreach my $config (keys %process_selects) {
|
|
|
|
$config =~ s/^CONFIG_//;
|
|
|
|
|
|
|
|
dprint "Process select $config\n";
|
|
|
|
|
|
|
|
# config has no prompt and must be selected.
|
|
|
|
parse_config_selects $config, $selects{$config};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
while ($repeat) {
|
|
|
|
# Get the first set of configs and their dependencies.
|
|
|
|
loop_depend;
|
|
|
|
|
|
|
|
$repeat = 0;
|
|
|
|
|
|
|
|
# Now we need to see if we have to check selects;
|
|
|
|
loop_select;
|
|
|
|
}
|
|
|
|
|
|
|
|
my %setconfigs;
|
|
|
|
|
|
|
|
# Finally, read the .config file and turn off any module enabled that
|
|
|
|
# we could not find a reason to keep enabled.
|
|
|
|
foreach my $line (@config_file) {
|
|
|
|
$_ = $line;
|
|
|
|
|
|
|
|
if (/CONFIG_IKCONFIG/) {
|
|
|
|
if (/# CONFIG_IKCONFIG is not set/) {
|
|
|
|
# enable IKCONFIG at least as a module
|
|
|
|
print "CONFIG_IKCONFIG=m\n";
|
|
|
|
# don't ask about PROC
|
|
|
|
print "# CONFIG_IKCONFIG_PROC is not set\n";
|
|
|
|
} else {
|
|
|
|
print;
|
|
|
|
}
|
|
|
|
next;
|
|
|
|
}
|
|
|
|
|
2017-02-11 03:39:54 +00:00
|
|
|
if (/CONFIG_MODULE_SIG_KEY="(.+)"/) {
|
|
|
|
my $orig_cert = $1;
|
|
|
|
my $default_cert = "certs/signing_key.pem";
|
|
|
|
|
|
|
|
# Check that the logic in this script still matches the one in Kconfig
|
|
|
|
if (!defined($depends{"MODULE_SIG_KEY"}) ||
|
|
|
|
$depends{"MODULE_SIG_KEY"} !~ /"\Q$default_cert\E"/) {
|
|
|
|
print STDERR "WARNING: MODULE_SIG_KEY assertion failure, ",
|
|
|
|
"update needed to ", __FILE__, " line ", __LINE__, "\n";
|
|
|
|
print;
|
|
|
|
} elsif ($orig_cert ne $default_cert && ! -f $orig_cert) {
|
|
|
|
print STDERR "Module signature verification enabled but ",
|
|
|
|
"module signing key \"$orig_cert\" not found. Resetting ",
|
|
|
|
"signing key to default value.\n";
|
|
|
|
print "CONFIG_MODULE_SIG_KEY=\"$default_cert\"\n";
|
|
|
|
} else {
|
|
|
|
print;
|
|
|
|
}
|
|
|
|
next;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (/CONFIG_SYSTEM_TRUSTED_KEYS="(.+)"/) {
|
|
|
|
my $orig_keys = $1;
|
|
|
|
|
|
|
|
if (! -f $orig_keys) {
|
|
|
|
print STDERR "System keyring enabled but keys \"$orig_keys\" ",
|
|
|
|
"not found. Resetting keys to default value.\n";
|
|
|
|
print "CONFIG_SYSTEM_TRUSTED_KEYS=\"\"\n";
|
|
|
|
} else {
|
|
|
|
print;
|
|
|
|
}
|
|
|
|
next;
|
|
|
|
}
|
|
|
|
|
2014-07-30 05:08:13 +00:00
|
|
|
if (/^(CONFIG.*)=(m|y)/) {
|
|
|
|
if (defined($configs{$1})) {
|
|
|
|
if ($localyesconfig) {
|
|
|
|
$setconfigs{$1} = 'y';
|
|
|
|
print "$1=y\n";
|
|
|
|
next;
|
|
|
|
} else {
|
|
|
|
$setconfigs{$1} = $2;
|
|
|
|
}
|
|
|
|
} elsif ($2 eq "m") {
|
|
|
|
print "# $1 is not set\n";
|
|
|
|
next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
print;
|
|
|
|
}
|
|
|
|
|
|
|
|
# Integrity check, make sure all modules that we want enabled do
|
|
|
|
# indeed have their configs set.
|
|
|
|
loop:
|
|
|
|
foreach my $module (keys(%modules)) {
|
|
|
|
if (defined($objects{$module})) {
|
|
|
|
my @arr = @{$objects{$module}};
|
|
|
|
foreach my $conf (@arr) {
|
|
|
|
if (defined($setconfigs{$conf})) {
|
|
|
|
next loop;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
print STDERR "module $module did not have configs";
|
|
|
|
foreach my $conf (@arr) {
|
|
|
|
print STDERR " " , $conf;
|
|
|
|
}
|
|
|
|
print STDERR "\n";
|
|
|
|
}
|
|
|
|
}
|