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:
18
SConstruct
18
SConstruct
@@ -264,6 +264,7 @@ kconfig_actions = (
|
||||
'guiconfig',
|
||||
'listnewconfig',
|
||||
'menuconfig',
|
||||
'savedefconfig',
|
||||
'setconfig',
|
||||
)
|
||||
|
||||
@@ -316,6 +317,17 @@ Kconfig tools:
|
||||
scons menuconfig 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
|
||||
it with the options you cared about, and then use savedefconfig to save
|
||||
a minimal config file. These files would be suitable to use in the
|
||||
defconfig directory. The second argument specifies the filename for
|
||||
the new defconfig file.
|
||||
|
||||
scons savedefconfig build/foo/bar new_def_config
|
||||
|
||||
|
||||
setconfig:
|
||||
Set values in an existing config directory as specified on the command
|
||||
line. For example, to enable gem5's built in systemc kernel:
|
||||
@@ -856,6 +868,12 @@ for variant_path in variant_paths:
|
||||
elif kconfig_action == 'menuconfig':
|
||||
kconfig.menuconfig(env, kconfig_file.abspath, config_file.abspath,
|
||||
variant_path)
|
||||
elif kconfig_action == 'savedefconfig':
|
||||
if len(kconfig_args) != 1:
|
||||
error('Usage: scons defconfig <build dir> <defconfig file>')
|
||||
defconfig_path = makePathAbsolute(kconfig_args[0])
|
||||
kconfig.savedefconfig(env, kconfig_file.abspath,
|
||||
config_file.abspath, defconfig_path)
|
||||
elif kconfig_action == 'setconfig':
|
||||
kconfig.setconfig(env, kconfig_file.abspath, config_file.abspath,
|
||||
ARGUMENTS)
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user