Skip to content

Commit fd32792

Browse files
junjiemao1wenlingz
authored andcommitted
kconfig: update .config on missed or conflicting symbol values
The existing .config may have missed or conflicting values if the file is manually edited or Kconfig is changed. Kconfiglib will assign default values to missed symbols and resolve conflicts when loading .config, but the current silentoldconfig.py fails to write the updated symbol values back to .config. This patch checks if any missed or conflicting symbol value is fixed by Kconfiglib and write the updated values back to .config if necessary. Tracked-On: #2371 Signed-off-by: Junjie Mao <junjie.mao@intel.com>
1 parent ca925f0 commit fd32792

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

scripts/kconfig/silentoldconfig.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,19 @@ def main():
7575
kconfig = kdefconfig
7676
sys.stdout.write("Overwrite with default configuration based on %s.\n" % defconfig_path)
7777
need_update = True
78+
else:
79+
# Use the existing .config as the base.
80+
#
81+
# Mark need_update if any visible symbol picks a different value
82+
# from what is specified in .config.
83+
for sym in [x for x in kconfig.unique_defined_syms if x.visibility]:
84+
if sym.type in [kconfiglib.BOOL, kconfiglib.TRISTATE]:
85+
picked_value = sym.tri_value
86+
else:
87+
picked_value = sym.str_value
88+
need_update = (picked_value != sym.user_value)
89+
if need_update:
90+
break
7891
else:
7992
# base on a default configuration
8093
if kdefconfig:

0 commit comments

Comments
 (0)