From bbe3aee9ca336515ff6679eea44277339a9e43e4 Mon Sep 17 00:00:00 2001 From: Ulf Magnusson Date: Mon, 5 Mar 2018 03:58:45 +0100 Subject: Do not write the defconfig_list symbol to .config Mirrors the following change to the C tools, now in linux-next: commit c21a6e352766005d42c1ccae32b31e0438903eb9 Author: Masahiro Yamada Date: Sat Feb 17 03:38:32 2018 +0900 kconfig: set SYMBOL_AUTO to the symbol marked with defconfig_list The 'defconfig_list' is a weird attribute. If the '.config' is missing, conf_read_simple() iterates over all visible defaults, then it uses the first one for which fopen() succeeds. config DEFCONFIG_LIST string depends on !UML option defconfig_list default "/lib/modules/$UNAME_RELEASE/.config" default "/etc/kernel-config" default "/boot/config-$UNAME_RELEASE" default "$ARCH_DEFCONFIG" default "arch/$ARCH/defconfig" However, like other symbols, the first visible default is always written out to the .config file. This might be different from what has been actually used. For example, on my machine, the third one "/boot/config-$UNAME_RELEASE" is opened, like follows: $ rm .config $ make oldconfig 2>/dev/null scripts/kconfig/conf --oldconfig Kconfig # # using defaults found in /boot/config-4.4.0-112-generic # * * Restart config... * * * IRQ subsystem * Expose irq internals in debugfs (GENERIC_IRQ_DEBUGFS) [N/y/?] (NEW) However, the resulted .config file contains the first one since it is visible: $ grep CONFIG_DEFCONFIG_LIST .config CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" In order to stop confusing people, prevent this CONFIG option from being written to the .config file. Signed-off-by: Masahiro Yamada --- kconfiglib.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'kconfiglib.py') diff --git a/kconfiglib.py b/kconfiglib.py index afd480e..0788ef7 100644 --- a/kconfiglib.py +++ b/kconfiglib.py @@ -2790,8 +2790,12 @@ class Symbol(object): self._write_to_conf = True break - # Corresponds to SYMBOL_AUTO in the C implementation - if self.env_var is not None: + # env_var corresponds to SYMBOL_AUTO in the C implementation, and is + # also set on the defconfig_list symbol there. Test for the + # defconfig_list symbol explicitly instead here, to avoid a nonsensical + # env_var setting and the defconfig_list being printed incorrectly. + # This code is pretty cold anyway. + if self.env_var is not None or self is self.kconfig.defconfig_list: self._write_to_conf = False self._cached_str_val = val -- cgit v1.2.3