From 63919f6a682bc4ee3e9d74491ed0d3540b719670 Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Fri, 18 Feb 2022 01:11:33 -0800 Subject: [PATCH] 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 --- SConstruct | 23 +++++++++++++++++++++++ site_scons/gem5_scons/kconfig.py | 20 ++++++++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/SConstruct b/SConstruct index 57134b6863..c4782691ff 100755 --- a/SConstruct +++ b/SConstruct @@ -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 ') diff --git a/site_scons/gem5_scons/kconfig.py b/site_scons/gem5_scons/kconfig.py index 347e11277d..42b2eec482 100644 --- a/site_scons/gem5_scons/kconfig.py +++ b/site_scons/gem5_scons/kconfig.py @@ -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" ):