[PATCH 08/44] commands: version: print value of CONFIG_NAME

Ahmad Fatoum a.fatoum at barebox.org
Mon Aug 11 05:27:48 PDT 2025


A project may contain multiple barebox configurations, e.g. for first
stage and second stage or for development and release.

Make it possible to encode that information directly into the config via
a name CONFIG_NAME option.

Signed-off-by: Ahmad Fatoum <a.fatoum at barebox.org>
---
 commands/version.c | 5 ++++-
 common/Kconfig     | 8 ++++++++
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/commands/version.c b/commands/version.c
index 0ad8e587de87..d6da1bba6e31 100644
--- a/commands/version.c
+++ b/commands/version.c
@@ -7,7 +7,10 @@
 
 static int do_version(int argc, char *argv[])
 {
-	printf ("\n%s\n\n", version_string);
+	printf ("\n%s", version_string);
+	if (*CONFIG_NAME)
+		printf (" (%s)", CONFIG_NAME);
+	printf ("\n\n");
 	return 0;
 }
 
diff --git a/common/Kconfig b/common/Kconfig
index a8e62600c4ee..159cd271d748 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -112,6 +112,14 @@ config FASTBOOT_BASE
 
 menu "General Settings"
 
+config NAME
+	string "Informational config name to include in binary"
+	help
+	  Unless left empty, this compiles into barebox an informational
+	  string describing the config used. This is reproduced by the
+	  version command, but does not influence any runtime or
+	  compile-time behavior.
+
 config LOCALVERSION
 	string "Local version - append to the version string"
 	help
-- 
2.39.5




More information about the barebox mailing list