shell: modules: kernel: include EXTRAVERSION when printing version

Include the full version in the output of the "kernel version" shell
subcommand. Previously, EXTRAVERSION was not included, causing
e.g. "3.6.0-rc1" to be printed as "3.6.0".

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
This commit is contained in:
Henrik Brix Andersen 2024-02-05 22:21:50 +01:00 committed by Henrik Brix Andersen
commit 14fa9f3e21

View file

@ -5,6 +5,8 @@
* SPDX-License-Identifier: Apache-2.0
*/
#include <version.h>
#include <zephyr/sys/printk.h>
#include <zephyr/shell/shell.h>
#include <zephyr/init.h>
@ -32,15 +34,10 @@
static int cmd_kernel_version(const struct shell *sh,
size_t argc, char **argv)
{
uint32_t version = sys_kernel_version_get();
ARG_UNUSED(argc);
ARG_UNUSED(argv);
shell_print(sh, "Zephyr version %d.%d.%d",
SYS_KERNEL_VER_MAJOR(version),
SYS_KERNEL_VER_MINOR(version),
SYS_KERNEL_VER_PATCHLEVEL(version));
shell_print(sh, "Zephyr version %s", KERNEL_VERSION_STRING);
return 0;
}