kernel: init: move banner handling
Move banner and boot delay handling out of init.c The code for banner was all over the place in init.c making it unreadable. Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
parent
de69edbf42
commit
4b59312a94
3 changed files with 54 additions and 34 deletions
51
kernel/banner.c
Normal file
51
kernel/banner.c
Normal file
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* Copyright (c) 2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <kernel.h>
|
||||
#include <sys/util.h>
|
||||
#include <init.h>
|
||||
#include <device.h>
|
||||
#include <version.h>
|
||||
|
||||
/* boot banner items */
|
||||
#if defined(CONFIG_MULTITHREADING) && defined(CONFIG_BOOT_DELAY) && \
|
||||
CONFIG_BOOT_DELAY > 0
|
||||
#define BOOT_DELAY_BANNER " (delayed boot " STRINGIFY(CONFIG_BOOT_DELAY) "ms)"
|
||||
#else
|
||||
#define BOOT_DELAY_BANNER ""
|
||||
#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
|
||||
printk("*** Booting Zephyr OS build %s %s ***\n",
|
||||
STRINGIFY(BUILD_VERSION), BOOT_DELAY_BANNER);
|
||||
#else
|
||||
printk("*** Booting Zephyr OS version %s %s ***\n",
|
||||
KERNEL_VERSION_STRING, BOOT_DELAY_BANNER);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
void boot_banner(void)
|
||||
{
|
||||
/* do nothing */
|
||||
}
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue