Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/56954 )

Change subject: scons: Hook up the savedefconfig kconfig helper.
......................................................................

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
---
M SConstruct
M site_scons/gem5_scons/kconfig.py
2 files changed, 37 insertions(+), 0 deletions(-)



diff --git a/SConstruct b/SConstruct
index 09dfbf8..cc823e0 100755
--- a/SConstruct
+++ b/SConstruct
@@ -214,6 +214,7 @@
     'guiconfig',
     'listnewconfig',
     'menuconfig',
+    'savedefconfig',
     'setconfig',
 )

@@ -651,6 +652,13 @@
         elif kconfig_action == 'menuconfig':
kconfig.menuconfig(env, kconfig_file.abspath, config_file.abspath,
                     variant_path)
+        elif kconfig_action == 'savedefconfig':
+            defconfig_key = 'DEFCONFIG'
+            defconfig_path = ARGUMENTS.get(defconfig_key, None)
+            if not defconfig_path:
+ error(f'Tried to savedefconfig, but {defconfig_key} not set.')
+            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)
diff --git a/site_scons/gem5_scons/kconfig.py b/site_scons/gem5_scons/kconfig.py
index 920101e..da7141b 100644
--- a/site_scons/gem5_scons/kconfig.py
+++ b/site_scons/gem5_scons/kconfig.py
@@ -33,6 +33,7 @@
     'GUICONFIG_PY': 'guiconfig.py',
     'LISTNEWCONFIG_PY': 'listnewconfig.py',
     'MENUCONFIG_PY': 'menuconfig.py',
+    'SAVEDEFCONFIG_PY': 'savedefconfig.py',
     'SETCONFIG_PY': 'setconfig.py',
 }

@@ -93,6 +94,13 @@
     if kconfig_env.Execute('"${MENUCONFIG_PY}" "${BASE_KCONFIG}"') != 0:
         error("Failed to run menuconfig")

+def savedefconfig(env, base_kconfig, config_in, config_out):
+    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):
     kconfig_env = _prep_env(env, base_kconfig, config_path)


--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/56954
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: Ifd344278638c59b48c261b36058832034c009c78
Gerrit-Change-Number: 56954
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to