From: Pali Rohár Date: Sun, 10 Jul 2022 11:42:55 +0000 (+0200) Subject: Fix usage of CONFIG_PREBOOT X-Git-Url: http://git.dujemihanovic.xyz/?a=commitdiff_plain;h=2827c2f07d6a5c498262cee7fe78aacfbf44f174;p=u-boot.git Fix usage of CONFIG_PREBOOT Due to usage of PREBOOT in Kconfig, macro CONFIG_PREBOOT is always defined when CONFIG_USE_PREBOOT is enabled. In case CONFIG_PREBOOT is not explicitly enabled it is set to empty C string and therefore '#ifdef CONFIG_PREBOOT' guard does not work. Fix this issue by introducing a new Kconfig symbol PREBOOT_DEFINED which cause to define new C macro CONFIG_PREBOOT_DEFINED only when CONFIG_PREBOOT is really defined. Change usage of '#ifdef CONFIG_PREBOOT' by '#ifdef CONFIG_USE_PREBOOT' for code which checks if preboot code would be called and by '#ifdef CONFIG_PREBOOT_DEFINED' for defining preboot code. Signed-off-by: Pali Rohár --- diff --git a/board/boundary/nitrogen6x/nitrogen6x.c b/board/boundary/nitrogen6x/nitrogen6x.c index 83bb445d48..382c01ddf4 100644 --- a/board/boundary/nitrogen6x/nitrogen6x.c +++ b/board/boundary/nitrogen6x/nitrogen6x.c @@ -929,7 +929,7 @@ U_BOOT_CMD( "Returns 0 (true) to shell if key is pressed." ); -#ifdef CONFIG_PREBOOT +#ifdef CONFIG_USE_PREBOOT static char const kbd_magic_prefix[] = "key_magic"; static char const kbd_command_prefix[] = "key_cmd"; @@ -989,7 +989,7 @@ int misc_init_r(void) gpio_request(IMX_GPIO_NR(2, 3), "search"); gpio_request(IMX_GPIO_NR(7, 13), "volup"); gpio_request(IMX_GPIO_NR(4, 5), "voldown"); -#ifdef CONFIG_PREBOOT +#ifdef CONFIG_USE_PREBOOT preboot_keys(); #endif diff --git a/boot/Kconfig b/boot/Kconfig index d5c582ebe8..4a001bcee8 100644 --- a/boot/Kconfig +++ b/boot/Kconfig @@ -1492,6 +1492,10 @@ config PREBOOT help This is the default of "preboot" environment variable. +config PREBOOT_DEFINED + bool + default y if PREBOOT != "" + config DEFAULT_FDT_FILE string "Default fdt file" help diff --git a/include/env_default.h b/include/env_default.h index 4e461c815a..7c9c00a969 100644 --- a/include/env_default.h +++ b/include/env_default.h @@ -62,7 +62,7 @@ const char default_environment[] = { #ifdef CONFIG_SYS_DISABLE_AUTOLOAD "autoload=0\0" #endif -#ifdef CONFIG_PREBOOT +#ifdef CONFIG_PREBOOT_DEFINED "preboot=" CONFIG_PREBOOT "\0" #endif #ifdef CONFIG_ROOTPATH