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.fat...@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


Reply via email to