kernel: banner: cleanup #ifdef
's
Cleanup the mess of duplicate function definitions, unnecessary variables and duplicate strings. All banner strings are now constant in ROM. Also fixes a double space between the end of the version string and the trailing `***` when there is no boot delay. Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
This commit is contained in:
parent
635f8951e1
commit
d1d20c08cd
1 changed files with 15 additions and 30 deletions
|
@ -10,42 +10,27 @@
|
||||||
#include <zephyr/device.h>
|
#include <zephyr/device.h>
|
||||||
#include <version.h>
|
#include <version.h>
|
||||||
|
|
||||||
/* boot banner items */
|
#if defined(CONFIG_BOOT_DELAY) && (CONFIG_BOOT_DELAY > 0)
|
||||||
#if defined(CONFIG_MULTITHREADING) && defined(CONFIG_BOOT_DELAY) && \
|
#define DELAY_STR STRINGIFY(CONFIG_BOOT_DELAY)
|
||||||
CONFIG_BOOT_DELAY > 0
|
#define BANNER_POSTFIX " (delayed boot " DELAY_STR "ms)"
|
||||||
#define BOOT_DELAY_BANNER " (delayed boot " STRINGIFY(CONFIG_BOOT_DELAY) "ms)"
|
|
||||||
#else
|
#else
|
||||||
#define BOOT_DELAY_BANNER ""
|
#define BANNER_POSTFIX ""
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_BOOT_DELAY) || CONFIG_BOOT_DELAY > 0
|
|
||||||
void boot_banner(void)
|
|
||||||
{
|
|
||||||
#if defined(CONFIG_BOOT_DELAY) && CONFIG_BOOT_DELAY > 0
|
|
||||||
static const unsigned int boot_delay = CONFIG_BOOT_DELAY;
|
|
||||||
#else
|
|
||||||
static const unsigned int boot_delay;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (boot_delay > 0 && IS_ENABLED(CONFIG_MULTITHREADING)) {
|
|
||||||
printk("***** delaying boot " STRINGIFY(
|
|
||||||
CONFIG_BOOT_DELAY) "ms (per build configuration) *****\n");
|
|
||||||
k_busy_wait(CONFIG_BOOT_DELAY * USEC_PER_MSEC);
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(CONFIG_BOOT_BANNER)
|
|
||||||
#ifdef BUILD_VERSION
|
#ifdef BUILD_VERSION
|
||||||
printk("*** Booting Zephyr OS build %s %s ***\n",
|
#define BANNER_VERSION STRINGIFY(BUILD_VERSION)
|
||||||
STRINGIFY(BUILD_VERSION), BOOT_DELAY_BANNER);
|
|
||||||
#else
|
#else
|
||||||
printk("*** Booting Zephyr OS version %s %s ***\n",
|
#define BANNER_VERSION KERNEL_VERSION_STRING
|
||||||
KERNEL_VERSION_STRING, BOOT_DELAY_BANNER);
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
void boot_banner(void)
|
void boot_banner(void)
|
||||||
{
|
{
|
||||||
/* do nothing */
|
#if defined(CONFIG_BOOT_DELAY) && (CONFIG_BOOT_DELAY > 0)
|
||||||
|
printk("***** delaying boot " DELAY_STR "ms (per build configuration) *****\n");
|
||||||
|
k_busy_wait(CONFIG_BOOT_DELAY * USEC_PER_MSEC);
|
||||||
|
#endif /* defined(CONFIG_BOOT_DELAY) && (CONFIG_BOOT_DELAY > 0) */
|
||||||
|
|
||||||
|
#if CONFIG_BOOT_BANNER
|
||||||
|
printk("*** Booting Zephyr OS build " BANNER_VERSION BANNER_POSTFIX " ***\n");
|
||||||
|
#endif /* CONFIG_BOOT_BANNER */
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue