public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH 1/2] Fix usage of CONFIG_PREBOOT
@ 2022-07-10 11:42 Pali Rohár
  2022-07-10 11:42 ` [PATCH 2/2] Nokia RX-51: Remove CONFIG_PREBOOT from defconfig Pali Rohár
                   ` (2 more replies)
  0 siblings, 3 replies; 24+ messages in thread
From: Pali Rohár @ 2022-07-10 11:42 UTC (permalink / raw)
  To: Troy Kisky, Joe Hershberger, Wolfgang Denk, Simon Glass; +Cc: u-boot

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 <pali@kernel.org>
---
 board/boundary/nitrogen6x/nitrogen6x.c | 4 ++--
 boot/Kconfig                           | 4 ++++
 include/env_default.h                  | 2 +-
 3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/board/boundary/nitrogen6x/nitrogen6x.c b/board/boundary/nitrogen6x/nitrogen6x.c
index 83bb445d481a..382c01ddf4e0 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 08451c65a56b..5e7ae61d5116 100644
--- a/boot/Kconfig
+++ b/boot/Kconfig
@@ -1309,6 +1309,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 7004a6fef29b..62a73b939cf2 100644
--- a/include/env_default.h
+++ b/include/env_default.h
@@ -62,7 +62,7 @@ const char default_environment[] = {
 #ifdef	CONFIG_SYS_AUTOLOAD
 	"autoload="	CONFIG_SYS_AUTOLOAD		"\0"
 #endif
-#ifdef	CONFIG_PREBOOT
+#ifdef	CONFIG_PREBOOT_DEFINED
 	"preboot="	CONFIG_PREBOOT			"\0"
 #endif
 #ifdef	CONFIG_ROOTPATH
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2022-11-21 17:34 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-10 11:42 [PATCH 1/2] Fix usage of CONFIG_PREBOOT Pali Rohár
2022-07-10 11:42 ` [PATCH 2/2] Nokia RX-51: Remove CONFIG_PREBOOT from defconfig Pali Rohár
2022-07-11 23:23   ` Tom Rini
2022-07-12  8:11     ` Pali Rohár
2022-07-12 21:39       ` Tom Rini
2022-07-12 21:52         ` Pali Rohár
2022-07-12 22:58           ` Tom Rini
2022-07-12 23:11             ` Pali Rohár
2022-07-12 23:15               ` Tom Rini
2022-07-13  8:36                 ` Pali Rohár
2022-07-25 21:21   ` Tom Rini
2022-07-27 18:34     ` Pali Rohár
2022-07-27 18:48       ` Tom Rini
2022-07-27 18:52         ` Pali Rohár
2022-07-27 18:58           ` Tom Rini
2022-07-27 19:01             ` Pali Rohár
2022-07-27 19:08               ` Tom Rini
2022-10-09 13:03                 ` Pali Rohár
2022-11-01 22:58                   ` Pali Rohár
2022-11-01 23:29                     ` Tom Rini
2022-11-20 16:37                       ` Pali Rohár
2022-07-12 10:58 ` [PATCH 1/2] Fix usage of CONFIG_PREBOOT Simon Glass
2022-07-12 11:18   ` Pali Rohár
2022-11-21 17:33 ` Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox