risc-v/virt: enable gradeful shutdown in kernel build
This enables graceful shutdown via `poweroff` command in `knsh64` and `knsh32` configs. Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
This commit is contained in:
parent
c352b04155
commit
c9a2e4a6c5
|
@ -42,6 +42,7 @@ CONFIG_ARCH_USE_MMU=y
|
|||
CONFIG_ARCH_USE_MPU=y
|
||||
CONFIG_ARCH_USE_S_MODE=y
|
||||
CONFIG_BINFMT_ELF_EXECUTABLE=y
|
||||
CONFIG_BOARDCTL_POWEROFF=y
|
||||
CONFIG_BOARD_LOOPSPERMSEC=6366
|
||||
CONFIG_BUILD_KERNEL=y
|
||||
CONFIG_DEBUG_ASSERTIONS=y
|
||||
|
|
|
@ -42,6 +42,7 @@ CONFIG_ARCH_USE_MMU=y
|
|||
CONFIG_ARCH_USE_MPU=y
|
||||
CONFIG_ARCH_USE_S_MODE=y
|
||||
CONFIG_BINFMT_ELF_EXECUTABLE=y
|
||||
CONFIG_BOARDCTL_POWEROFF=y
|
||||
CONFIG_BOARD_LOOPSPERMSEC=6366
|
||||
CONFIG_BUILD_KERNEL=y
|
||||
CONFIG_DEBUG_ASSERTIONS=y
|
||||
|
@ -62,7 +63,6 @@ CONFIG_INIT_MOUNT_FSTYPE="hostfs"
|
|||
CONFIG_INIT_MOUNT_SOURCE=""
|
||||
CONFIG_INIT_MOUNT_TARGET="/system"
|
||||
CONFIG_INIT_STACKSIZE=3072
|
||||
CONFIG_INTELHEX_BINARY=y
|
||||
CONFIG_LIBC_ENVPATH=y
|
||||
CONFIG_LIBC_EXECFUNCS=y
|
||||
CONFIG_LIBC_PERROR_STDOUT=y
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
|
||||
#include <sys/mount.h>
|
||||
|
||||
#include "riscv_internal.h"
|
||||
#include "romfs.h"
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -177,3 +178,17 @@ void board_late_initialize(void)
|
|||
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef CONFIG_BOARDCTL_POWEROFF
|
||||
int board_power_off(int status)
|
||||
{
|
||||
#ifdef CONFIG_BUILD_KERNEL
|
||||
riscv_sbi_system_reset(SBI_SRST_TYPE_SHUTDOWN, SBI_SRST_REASON_NONE);
|
||||
#else
|
||||
#warning "to be done"
|
||||
#endif
|
||||
|
||||
UNUSED(status);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue