From: Simon Glass <sjg@chromium.org>
Date: Mon, 2 Oct 2023 01:15:24 +0000 (-0600)
Subject: sandbox: Add a dummy booti command
X-Git-Tag: v2025.01-rc5-pxa1908~581^2~16
X-Git-Url: http://git.dujemihanovic.xyz/projects?a=commitdiff_plain;h=6b8f26bca4854ea6826d8d9f3b1f644e349c9b7e;p=u-boot.git

sandbox: Add a dummy booti command

Add basic sandbox support for 'booti' so we can start to boot the test
ARMbian image. This is helpful in checking that it is parsed correctly.

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

diff --git a/arch/sandbox/lib/bootm.c b/arch/sandbox/lib/bootm.c
index dc8b8e46cb..a748ba650b 100644
--- a/arch/sandbox/lib/bootm.c
+++ b/arch/sandbox/lib/bootm.c
@@ -78,3 +78,10 @@ int do_bootm_linux(int flag, int argc, char *argv[], struct bootm_headers *image
 
 	return 0;
 }
+
+/* used for testing 'booti' command */
+int booti_setup(ulong image, ulong *relocated_addr, ulong *size,
+		bool force_reloc)
+{
+	return 0;
+}
diff --git a/cmd/Kconfig b/cmd/Kconfig
index bebe816b07..748b959961 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -285,7 +285,7 @@ config CMD_BOOTZ
 
 config CMD_BOOTI
 	bool "booti"
-	depends on ARM64 || RISCV
+	depends on ARM64 || RISCV || SANDBOX
 	default y
 	help
 	  Boot an AArch64 Linux Kernel image from memory.
diff --git a/cmd/booti.c b/cmd/booti.c
index 2db8f4a16f..41d40c962e 100644
--- a/cmd/booti.c
+++ b/cmd/booti.c
@@ -75,7 +75,7 @@ static int booti_start(struct cmd_tbl *cmdtp, int flag, int argc,
 	unmap_sysmem((void *)ld);
 
 	ret = booti_setup(ld, &relocated_addr, &image_size, false);
-	if (ret != 0)
+	if (ret || IS_ENABLED(CONFIG_SANDBOX))
 		return 1;
 
 	/* Handle BOOTM_STATE_LOADOS */
diff --git a/configs/tools-only_defconfig b/configs/tools-only_defconfig
index fa1ff4a73f..b54d2cefa1 100644
--- a/configs/tools-only_defconfig
+++ b/configs/tools-only_defconfig
@@ -16,6 +16,7 @@ CONFIG_USE_BOOTCOMMAND=y
 CONFIG_BOOTCOMMAND="run distro_bootcmd"
 # CONFIG_CMD_BOOTD is not set
 # CONFIG_CMD_BOOTM is not set
+# CONFIG_CMD_BOOTI is not set
 # CONFIG_CMD_ELF is not set
 # CONFIG_CMD_EXTENSION is not set
 # CONFIG_CMD_DATE is not set