Atlas - defconfig_oldconfig.py
Home / ext / kconfiglib / examples Lines: 1 | Size: 902 bytes [Download] [Show on GitHub] [Search similar files] [Raw] [Raw (proxy)][FILE BEGIN]1# Produces exactly the same output as the following script: 2# 3# make defconfig 4# echo CONFIG_ETHERNET=n >> .config 5# make oldconfig 6# echo CONFIG_ETHERNET=y >> .config 7# yes n | make oldconfig 8# 9# This came up in https://github.com/ulfalizer/Kconfiglib/issues/15. 10# 11# Usage: 12# 13# $ make [ARCH=<arch>] scriptconfig SCRIPT=Kconfiglib/examples/defconfig_oldconfig.py 14 15import sys 16 17import kconfiglib 18 19 20kconf = kconfiglib.Kconfig(sys.argv[1]) 21 22# Mirrors defconfig 23kconf.load_config("arch/x86/configs/x86_64_defconfig") 24kconf.write_config() 25 26# Mirrors the first oldconfig 27kconf.load_config() 28kconf.syms["ETHERNET"].set_value(0) 29kconf.write_config() 30 31# Mirrors the second oldconfig 32kconf.load_config() 33kconf.syms["ETHERNET"].set_value(2) 34for s in kconf.unique_defined_syms: 35 if s.user_value is None and 0 in s.assignable: 36 s.set_value(0) 37 38# Write the final configuration 39print(kconf.write_config()) 40[FILE END](C) 2025 0x4248 (C) 2025 4248 Media and 4248 Systems, All part of 0x4248 See LICENCE files for more information. Not all files are by 0x4248 always check Licencing.