From fbaf7dfdc1fba38c981946932b76fde81b403929 Mon Sep 17 00:00:00 2001 From: Yong Cong Sin Date: Tue, 2 Apr 2024 14:48:02 +0800 Subject: [PATCH] kernel: banner: use BUILD_VERSION only if not empty The `BUILD_VERSION` can be defined but empty when built without git, causing version to be missing from the banner: ``` *** Booting Zephyr OS build *** Hello World! qemu_riscv64 ``` Let's check if it is empty before using it, so that `KERNEL_VERSION_STRING`, which is generated independently with cmake can be used as a fallback: ``` *** Booting Zephyr OS build 3.5.0 *** Hello World! qemu_riscv64 ``` Signed-off-by: Yong Cong Sin --- kernel/banner.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/banner.c b/kernel/banner.c index 5274c3e0d6..dc2506fb9b 100644 --- a/kernel/banner.c +++ b/kernel/banner.c @@ -17,7 +17,7 @@ #endif /* defined(CONFIG_BOOT_DELAY) && (CONFIG_BOOT_DELAY > 0) */ #ifndef BANNER_VERSION -#ifdef BUILD_VERSION +#if defined(BUILD_VERSION) && !IS_EMPTY(BUILD_VERSION) #define BANNER_VERSION STRINGIFY(BUILD_VERSION) #else #define BANNER_VERSION KERNEL_VERSION_STRING