common: support disable CLI for verified-boot

Not allow any interactive from CLI.

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I207da3f2c54df1a81100c404f045023ac763da73
This commit is contained in:
Joseph Chen 2020-03-28 15:27:34 +08:00 committed by Jianhong Chen
parent 4ab50248f6
commit 37526a5172
5 changed files with 9 additions and 9 deletions

View File

@ -250,10 +250,12 @@ config CONSOLE_RECORD_IN_SIZE
The buffer is allocated immediately after the malloc() region is The buffer is allocated immediately after the malloc() region is
ready. ready.
config CONSOLE_DISABLE_CTRLC config CONSOLE_DISABLE_CLI
bool "disable ctrlc" bool "disable ctrlc"
depends on BOOTDELAY = 0
default y if AVB_VBMETA_PUBLIC_KEY_VALIDATE || FIT_SIGNATURE
help help
This disable ctrl+c when CONFIG_BOOTDELAY is 0. This disable CLI interactive in verified-boot.
config DISABLE_CONSOLE config DISABLE_CONSOLE
bool "disable console in & out" bool "disable console in & out"

View File

@ -220,7 +220,7 @@ static int __abortboot(int bootdelay)
#endif #endif
#ifdef CONFIG_ARCH_ROCKCHIP #ifdef CONFIG_ARCH_ROCKCHIP
if (ctrlc()) { /* we press ctrl+c ? */ if (!IS_ENABLED(CONFIG_CONSOLE_DISABLE_CLI) && ctrlc()) { /* we press ctrl+c ? */
#else #else
/* /*
* Check if key already pressed * Check if key already pressed

View File

@ -212,6 +212,7 @@ err:
} }
#endif /* CONFIG_IS_ENABLED(OF_CONTROL) */ #endif /* CONFIG_IS_ENABLED(OF_CONTROL) */
#ifndef CONFIG_CONSOLE_DISABLE_CLI
void cli_loop(void) void cli_loop(void)
{ {
#ifdef CONFIG_HUSH_PARSER #ifdef CONFIG_HUSH_PARSER
@ -224,6 +225,9 @@ void cli_loop(void)
printf("## U-Boot command line is disabled. Please enable CONFIG_CMDLINE\n"); printf("## U-Boot command line is disabled. Please enable CONFIG_CMDLINE\n");
#endif /*CONFIG_HUSH_PARSER*/ #endif /*CONFIG_HUSH_PARSER*/
} }
#else
void cli_loop(void) { }
#endif
void cli_init(void) void cli_init(void)
{ {

View File

@ -655,11 +655,6 @@ static int ctrlc_disabled = 0; /* see disable_ctrl() */
static int ctrlc_was_pressed = 0; static int ctrlc_was_pressed = 0;
int ctrlc(void) int ctrlc(void)
{ {
#if defined(CONFIG_CONSOLE_DISABLE_CTRLC) && \
defined(CONFIG_BOOTDELAY) && (CONFIG_BOOTDELAY <= 0)
return 0;
#endif
#ifndef CONFIG_SANDBOX #ifndef CONFIG_SANDBOX
if (!ctrlc_disabled && gd->have_console) { if (!ctrlc_disabled && gd->have_console) {
if (tstc()) { if (tstc()) {

View File

@ -9,7 +9,6 @@ config AVB_LIBAVB_USER
config AVB_VBMETA_PUBLIC_KEY_VALIDATE config AVB_VBMETA_PUBLIC_KEY_VALIDATE
bool "Support vbmeta public key validate" bool "Support vbmeta public key validate"
depends on AVB_LIBAVB_USER depends on AVB_LIBAVB_USER
select CONSOLE_DISABLE_CTRLC
help help
support vbmeta public key validate, system bootflow would be support vbmeta public key validate, system bootflow would be
uninterruptale when it is enabled: uninterruptale when it is enabled: