scons: Hook up the savedefconfig kconfig helper.

This helper utility lets you save the defconfig which would give rise to
a given config. For instance, you could use menuconfig to set up a
config how you want it with the options you cared about configured, and
then use savedefconfig to save a defconfig of that somewhere to the
side, in the gem5 defconfig directory, etc. Then later, you could use
that defconfig to set up a new build directory with that same config,
even if the kconfig options have changed a little bit since then.

A saved defconfig like that can also be a good way to visually see what
options have been set to something interesting, and an easier way to
pass a config to someone else to use, to put in bug reports, etc.

Change-Id: Ifd344278638c59b48c261b36058832034c009c78
This commit is contained in:
Gabe Black
2022-02-18 00:59:58 -08:00
committed by Roger Chang
parent 51b8cfcede
commit ec76214f68
2 changed files with 35 additions and 0 deletions

View File

@@ -33,6 +33,7 @@ _kconfig_helpers = {
"GUICONFIG_PY": "guiconfig.py",
"LISTNEWCONFIG_PY": "listnewconfig.py",
"MENUCONFIG_PY": "menuconfig.py",
"SAVEDEFCONFIG_PY": "savedefconfig.py",
"SETCONFIG_PY": "setconfig.py",
}
@@ -130,6 +131,22 @@ def menuconfig(
error("Failed to run menuconfig")
def savedefconfig(env, base_kconfig, config_in, config_out):
"""
Interface of handling savedefconfig.py of Kconfiglib
"""
kconfig_env = _prep_env(env, base_kconfig, config_in)
kconfig_env["CONFIG_OUT"] = config_out
if (
kconfig_env.Execute(
'"${SAVEDEFCONFIG_PY}" '
'--kconfig "${BASE_KCONFIG}" --out "${CONFIG_OUT}"'
)
!= 0
):
error("Failed to run savedefconfig")
def setconfig(env, base_kconfig, config_path, assignments):
"""
Interface of handling setconfig.py of Kconfiglib