[PATCH 3/3] zboot: Correct use of state_mask argument

Simon Glass sjg at chromium.org
Wed Jun 19 14:34:52 CEST 2024


There is confusion in this function between the flag and state_mask
parameters, which prevents the boot from actually happening. Correct
this by using state_mask instead of flag for deciding which states to go
through.

This fixes booting of some 32-bit Debian kernels.

Note: Some sort of CI for this is in the works.

Fixes: 228c6722d44 ("x86: zboot: Avoid iteration in do_zboot_states()")

Signed-off-by: Simon Glass <sjg at chromium.org>
---

 cmd/x86/zboot.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/cmd/x86/zboot.c b/cmd/x86/zboot.c
index c14219f19e9..94e602b8a5b 100644
--- a/cmd/x86/zboot.c
+++ b/cmd/x86/zboot.c
@@ -122,18 +122,18 @@ U_BOOT_SUBCMDS(zboot,
 int do_zboot_states(struct cmd_tbl *cmdtp, int flag, int argc,
 		    char *const argv[], int state_mask)
 {
-	int ret;
+	int ret = 0;
 
 	log_debug("state_mask %x\n", state_mask);
-	if (flag & ZBOOT_STATE_START)
+	if (state_mask & ZBOOT_STATE_START)
 		ret = do_zboot_start(cmdtp, flag, argc, argv);
-	if (!ret && (flag & ZBOOT_STATE_LOAD))
+	if (!ret && (state_mask & ZBOOT_STATE_LOAD))
 		ret = do_zboot_load(cmdtp, flag, argc, argv);
-	if (!ret && (flag & ZBOOT_STATE_SETUP))
+	if (!ret && (state_mask & ZBOOT_STATE_SETUP))
 		ret = do_zboot_setup(cmdtp, flag, argc, argv);
-	if (!ret && (flag & ZBOOT_STATE_INFO))
+	if (!ret && (state_mask & ZBOOT_STATE_INFO))
 		ret = do_zboot_info(cmdtp, flag, argc, argv);
-	if (!ret && (flag & ZBOOT_STATE_GO))
+	if (!ret && (state_mask & ZBOOT_STATE_GO))
 		ret = do_zboot_go(cmdtp, flag, argc, argv);
 	if (ret)
 		return ret;
-- 
2.34.1



More information about the U-Boot mailing list