From 77a00f13525b1aff0cbf2c449164639338c855eb Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Fri, 18 Aug 2023 09:47:26 +0100 Subject: [PATCH] kernel: banner: Allow for customising version This allows for further (out of tree) customisation of the boot banner version string when devices boot. Signed-off-by: Torsten Rasmussen Signed-off-by: Jamie McCrae --- CMakeLists.txt | 2 ++ kernel/banner.c | 2 ++ version.h.in | 1 + 3 files changed, 5 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0f03c70eb24..6e2ede86fd9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -557,6 +557,7 @@ add_custom_command( -DOUT_FILE=${PROJECT_BINARY_DIR}/include/generated/version.h -DVERSION_TYPE=KERNEL -DVERSION_FILE=${ZEPHYR_BASE}/VERSION + -DKERNEL_VERSION_CUSTOMIZATION="${KERNEL_VERSION_CUSTOMIZATION}" ${build_version_argument} -P ${ZEPHYR_BASE}/cmake/gen_version_h.cmake DEPENDS ${ZEPHYR_BASE}/VERSION ${git_dependency} @@ -570,6 +571,7 @@ if(EXISTS ${APPLICATION_SOURCE_DIR}/VERSION) -DOUT_FILE=${PROJECT_BINARY_DIR}/include/generated/app_version.h -DVERSION_TYPE=APP -DVERSION_FILE=${APPLICATION_SOURCE_DIR}/VERSION + -DAPP_VERSION_CUSTOMIZATION="${APP_VERSION_CUSTOMIZATION}" ${build_version_argument} -P ${ZEPHYR_BASE}/cmake/gen_version_h.cmake DEPENDS ${APPLICATION_SOURCE_DIR}/VERSION ${git_dependency} diff --git a/kernel/banner.c b/kernel/banner.c index e1165e44ec8..a9925ea7b54 100644 --- a/kernel/banner.c +++ b/kernel/banner.c @@ -16,11 +16,13 @@ #define BANNER_POSTFIX "" #endif +#ifndef BANNER_VERSION #ifdef BUILD_VERSION #define BANNER_VERSION STRINGIFY(BUILD_VERSION) #else #define BANNER_VERSION KERNEL_VERSION_STRING #endif +#endif void boot_banner(void) { diff --git a/version.h.in b/version.h.in index 96b8ecb2041..c60fb721804 100644 --- a/version.h.in +++ b/version.h.in @@ -17,5 +17,6 @@ #define @VERSION_TYPE@_VERSION_STRING "@@VERSION_TYPE@_VERSION_STRING@" #define @BUILD_VERSION_NAME@ @@BUILD_VERSION_NAME@@ +@@VERSION_TYPE@_VERSION_CUSTOMIZATION@ #endif /* _@VERSION_TYPE@_VERSION_H_ */