* [PATCH 1/4] Makefile: add buildsystem version variable
@ 2020-09-23 10:34 Steffen Trumtrar
2020-09-23 10:34 ` [PATCH 2/4] common: print buildsystem version in barebox banner Steffen Trumtrar
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Steffen Trumtrar @ 2020-09-23 10:34 UTC (permalink / raw)
To: Barebox List
Introduce a new variable to store a buildsystem version information.
The exact information that is stored here (git commit, git tag,...) is
defined by the buildsystem.
It is intended to have the possibility to get information about the
exact barebox binary, environment and configuration.
The variable is utilized the same as KERNELVERSION for linux:
make BUILDSYSTEM_VERSION=$COMMITISH
Via scripts/mkcompile_h this information is injected into the barebox
codebase.
Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
---
Makefile | 3 ++-
scripts/mkcompile_h | 3 +++
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index d27b78201bda..d829e33c4621 100644
--- a/Makefile
+++ b/Makefile
@@ -311,7 +311,8 @@ include scripts/Kbuild.include
# Read KERNELRELEASE from include/config/kernel.release (if it exists)
KERNELRELEASE = $(shell cat include/config/kernel.release 2> /dev/null)
KERNELVERSION = $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if $(SUBLEVEL),.$(SUBLEVEL)))$(EXTRAVERSION)
-export VERSION PATCHLEVEL SUBLEVEL KERNELRELEASE KERNELVERSION
+BUILDSYSTEM_VERSION =
+export VERSION PATCHLEVEL SUBLEVEL KERNELRELEASE KERNELVERSION BUILDSYSTEM_VERSION
# Cross compiling and selecting different set of gcc/bin-utils
# ---------------------------------------------------------------------------
diff --git a/scripts/mkcompile_h b/scripts/mkcompile_h
index 60b20cafc65e..49aadc153d44 100755
--- a/scripts/mkcompile_h
+++ b/scripts/mkcompile_h
@@ -54,6 +54,7 @@ fi
UTS_VERSION="#$VERSION"
CONFIG_FLAGS=""
UTS_VERSION="$UTS_VERSION $CONFIG_FLAGS $TIMESTAMP"
+BUILDSYSTEM_VERSION="$BUILDSYSTEM_VERSION"
# Truncate to maximum length
@@ -69,6 +70,8 @@ UTS_TRUNCATE="cut -b -$UTS_LEN"
echo \#define UTS_VERSION \"`echo $UTS_VERSION | $UTS_TRUNCATE`\"
+ echo \#define BUILDSYSTEM_VERSION \"`echo $BUILDSYSTEM_VERSION`\"
+
echo \#define BAREBOX_COMPILE_BY \"`echo $BAREBOX_COMPILE_BY | $UTS_TRUNCATE`\"
echo \#define BAREBOX_COMPILE_HOST \"`echo $BAREBOX_COMPILE_HOST | $UTS_TRUNCATE`\"
--
2.28.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2/4] common: print buildsystem version in barebox banner
2020-09-23 10:34 [PATCH 1/4] Makefile: add buildsystem version variable Steffen Trumtrar
@ 2020-09-23 10:34 ` Steffen Trumtrar
2020-09-23 10:34 ` [PATCH 3/4] common: globalvar: add variable for buildsystem_version_string Steffen Trumtrar
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Steffen Trumtrar @ 2020-09-23 10:34 UTC (permalink / raw)
To: Barebox List
When the barebox banner is enabled and printed during startup, also show
information about the buildsystem version: the exact state of the
barebox binary and its config.
Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
---
common/version.c | 6 ++++++
include/common.h | 1 +
2 files changed, 7 insertions(+)
diff --git a/common/version.c b/common/version.c
index 8b1fd4dbe756..54cec5335d9c 100644
--- a/common/version.c
+++ b/common/version.c
@@ -10,11 +10,17 @@ const char release_string[] =
"barebox-" UTS_RELEASE;
EXPORT_SYMBOL(release_string);
+const char buildsystem_version_string[] =
+ BUILDSYSTEM_VERSION;
+EXPORT_SYMBOL(buildsystem_version_string);
+
#ifdef CONFIG_BANNER
void barebox_banner (void)
{
printf("\n\n");
pr_info("%s", version_string);
+ if (strlen(buildsystem_version_string) > 0)
+ pr_info("Buildsystem version: %s", buildsystem_version_string);
printf("\n\n");
pr_info("Board: %s\n", barebox_get_model());
}
diff --git a/include/common.h b/include/common.h
index ceb0b358bd44..693f5bf97029 100644
--- a/include/common.h
+++ b/include/common.h
@@ -124,6 +124,7 @@ int memcpy_parse_options(int argc, char *argv[], int *sourcefd,
extern const char version_string[];
extern const char release_string[];
+extern const char buildsystem_version_string[];
#ifdef CONFIG_BANNER
void barebox_banner(void);
#else
--
2.28.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 3/4] common: globalvar: add variable for buildsystem_version_string
2020-09-23 10:34 [PATCH 1/4] Makefile: add buildsystem version variable Steffen Trumtrar
2020-09-23 10:34 ` [PATCH 2/4] common: print buildsystem version in barebox banner Steffen Trumtrar
@ 2020-09-23 10:34 ` Steffen Trumtrar
2020-09-23 10:34 ` [PATCH 4/4] imd: add buildsystem version to metadata Steffen Trumtrar
2020-09-25 14:35 ` [PATCH 1/4] Makefile: add buildsystem version variable Sascha Hauer
3 siblings, 0 replies; 5+ messages in thread
From: Steffen Trumtrar @ 2020-09-23 10:34 UTC (permalink / raw)
To: Barebox List
Now that the buildsystem version is available, make it accessible as a
global variable for runtime usage. If the buildsystem version is not
present (i.e. empty), don't add the variable at all.
Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
---
common/globalvar.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/common/globalvar.c b/common/globalvar.c
index 98a028a68aa7..e38ad0c2c668 100644
--- a/common/globalvar.c
+++ b/common/globalvar.c
@@ -595,6 +595,9 @@ static int globalvar_init(void)
globalvar_add_simple("version", UTS_RELEASE);
+ if (strlen(buildsystem_version_string) > 0)
+ globalvar_add_simple("buildsystem.version", buildsystem_version_string);
+
return 0;
}
pure_initcall(globalvar_init);
--
2.28.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 4/4] imd: add buildsystem version to metadata
2020-09-23 10:34 [PATCH 1/4] Makefile: add buildsystem version variable Steffen Trumtrar
2020-09-23 10:34 ` [PATCH 2/4] common: print buildsystem version in barebox banner Steffen Trumtrar
2020-09-23 10:34 ` [PATCH 3/4] common: globalvar: add variable for buildsystem_version_string Steffen Trumtrar
@ 2020-09-23 10:34 ` Steffen Trumtrar
2020-09-25 14:35 ` [PATCH 1/4] Makefile: add buildsystem version variable Sascha Hauer
3 siblings, 0 replies; 5+ messages in thread
From: Steffen Trumtrar @ 2020-09-23 10:34 UTC (permalink / raw)
To: Barebox List
To have information about the exact state of a barebox binary from
userspace, add the buildsystem version to the IMD.
Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
---
common/imd-barebox.c | 1 +
common/imd.c | 3 +++
include/image-metadata.h | 1 +
3 files changed, 5 insertions(+)
diff --git a/common/imd-barebox.c b/common/imd-barebox.c
index e5cdfd1aed34..06731d0600cf 100644
--- a/common/imd-barebox.c
+++ b/common/imd-barebox.c
@@ -23,4 +23,5 @@ __BAREBOX_IMD_SECTION(.barebox_imd_end) = {
BAREBOX_IMD_TAG_STRING(imd_build_tag, IMD_TYPE_BUILD, UTS_VERSION, 1);
BAREBOX_IMD_TAG_STRING(imd_release_tag, IMD_TYPE_RELEASE, UTS_RELEASE, 1);
+BAREBOX_IMD_TAG_STRING(imd_buildsystem_version_tag, IMD_TYPE_BUILDSYSTEM, BUILDSYSTEM_VERSION, 1);
BAREBOX_IMD_CRC(imd_crc32, 0x0, 1);
diff --git a/common/imd.c b/common/imd.c
index 96496514a54a..6970edaf96f1 100644
--- a/common/imd.c
+++ b/common/imd.c
@@ -168,6 +168,9 @@ static struct imd_type_names imd_types[] = {
}, {
.type = IMD_TYPE_CRC32,
.name = "crc32",
+ }, {
+ .type = IMD_TYPE_BUILDSYSTEM,
+ .name = "buildsystem version",
},
};
diff --git a/include/image-metadata.h b/include/image-metadata.h
index 42ddf2fab02a..a9cb9cfe8f16 100644
--- a/include/image-metadata.h
+++ b/include/image-metadata.h
@@ -26,6 +26,7 @@
#define IMD_TYPE_MODEL 0x640c8004 /* The board name this image is for */
#define IMD_TYPE_OF_COMPATIBLE 0x640c8005 /* the device tree compatible string */
#define IMD_TYPE_PARAMETER 0x640c8006 /* A generic parameter. Use key=value as data */
+#define IMD_TYPE_BUILDSYSTEM 0x640c8007 /* The buildsystem version barebox was built with */
#define IMD_TYPE_CRC32 0x640c1007 /* the checksum of the barebox images */
#define IMD_TYPE_END 0x640c7fff
#define IMD_TYPE_INVALID 0xffffffff
--
2.28.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/4] Makefile: add buildsystem version variable
2020-09-23 10:34 [PATCH 1/4] Makefile: add buildsystem version variable Steffen Trumtrar
` (2 preceding siblings ...)
2020-09-23 10:34 ` [PATCH 4/4] imd: add buildsystem version to metadata Steffen Trumtrar
@ 2020-09-25 14:35 ` Sascha Hauer
3 siblings, 0 replies; 5+ messages in thread
From: Sascha Hauer @ 2020-09-25 14:35 UTC (permalink / raw)
To: Steffen Trumtrar; +Cc: Barebox List
On Wed, Sep 23, 2020 at 12:34:15PM +0200, Steffen Trumtrar wrote:
> Introduce a new variable to store a buildsystem version information.
> The exact information that is stored here (git commit, git tag,...) is
> defined by the buildsystem.
> It is intended to have the possibility to get information about the
> exact barebox binary, environment and configuration.
>
> The variable is utilized the same as KERNELVERSION for linux:
>
> make BUILDSYSTEM_VERSION=$COMMITISH
>
> Via scripts/mkcompile_h this information is injected into the barebox
> codebase.
>
> Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
> ---
> Makefile | 3 ++-
> scripts/mkcompile_h | 3 +++
> 2 files changed, 5 insertions(+), 1 deletion(-)
Applied, thanks
Sascha
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-09-25 14:36 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-23 10:34 [PATCH 1/4] Makefile: add buildsystem version variable Steffen Trumtrar
2020-09-23 10:34 ` [PATCH 2/4] common: print buildsystem version in barebox banner Steffen Trumtrar
2020-09-23 10:34 ` [PATCH 3/4] common: globalvar: add variable for buildsystem_version_string Steffen Trumtrar
2020-09-23 10:34 ` [PATCH 4/4] imd: add buildsystem version to metadata Steffen Trumtrar
2020-09-25 14:35 ` [PATCH 1/4] Makefile: add buildsystem version variable Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox