scons: Hook up oldconfig and olddefconfig.

These two utilities help update an old config to add settings for new
config options. The difference between them is that oldconfig asks what
new settings you want to use, while olddefconfig automatically picks the
defaults.

Change-Id: Icd3e57f834684e620705beb884faa5b6e2cc7baa
This commit is contained in:
Gabe Black
2022-02-18 01:11:33 -08:00
committed by Roger Chang
parent ec76214f68
commit 63919f6a68
2 changed files with 43 additions and 0 deletions

View File

@@ -264,6 +264,8 @@ kconfig_actions = (
'guiconfig',
'listnewconfig',
'menuconfig',
'oldconfig',
'olddefconfig',
'savedefconfig',
'setconfig',
)
@@ -317,6 +319,22 @@ Kconfig tools:
scons menuconfig build/foo/bar
oldconfig:
Update an existing config by adding settings for new options. This is
the same as the olddefconfig tool, except it asks what values you want
for the new settings.
scons oldconfig build/foo/bar
olddefconfig:
Update an existing config by adding settings for new options. This is
the same as the oldconfig tool, except it uses the default for any new
setting.
scons olddefconfig build/foo/bar
savedefconfig:
Save a defconfig file which would give rise to the current config.
For instance, you could use menuconfig to set up a config how you want
@@ -868,6 +886,11 @@ for variant_path in variant_paths:
elif kconfig_action == 'menuconfig':
kconfig.menuconfig(env, kconfig_file.abspath, config_file.abspath,
variant_path)
elif kconfig_action == 'oldconfig':
kconfig.oldconfig(env, kconfig_file.abspath, config_file.abspath)
elif kconfig_action == 'olddefconfig':
kconfig.olddefconfig(env, kconfig_file.abspath,
config_file.abspath)
elif kconfig_action == 'savedefconfig':
if len(kconfig_args) != 1:
error('Usage: scons defconfig <build dir> <defconfig file>')

View File

@@ -33,6 +33,8 @@ _kconfig_helpers = {
"GUICONFIG_PY": "guiconfig.py",
"LISTNEWCONFIG_PY": "listnewconfig.py",
"MENUCONFIG_PY": "menuconfig.py",
"OLDCONFIG_PY": "oldconfig.py",
"OLDDEFCONFIG_PY": "olddefconfig.py",
"SAVEDEFCONFIG_PY": "savedefconfig.py",
"SETCONFIG_PY": "setconfig.py",
}
@@ -118,6 +120,24 @@ def listnewconfig(env, base_kconfig, config_path):
error("Failed to run listnewconfig")
def oldconfig(env, base_kconfig, config_path):
"""
Interface of handling oldconfig.py of Kconfiglib
"""
kconfig_env = _prep_env(env, base_kconfig, config_path)
if kconfig_env.Execute('"${OLDCONFIG_PY}" "${BASE_KCONFIG}"') != 0:
error("Failed to run oldconfig")
def olddefconfig(env, base_kconfig, config_path):
"""
Interface of handling olddefconfig.py of Kconfiglib
"""
kconfig_env = _prep_env(env, base_kconfig, config_path)
if kconfig_env.Execute('"${OLDDEFCONFIG_PY}" "${BASE_KCONFIG}"') != 0:
error("Failed to run oldconfig")
def menuconfig(
env, base_kconfig, config_path, main_menu_text, style="aquatic"
):