[PATCH 1/1] riscv: qemu: provide more SPL boot methods

Heinrich Schuchardt heinrich.schuchardt at canonical.com
Sat Jul 22 13:10:33 CEST 2023


QEMU can supply block devices or semihosting to U-Boot SPL. Allow booting
from these.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt at canonical.com>
---
 board/emulation/qemu-riscv/qemu-riscv.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/board/emulation/qemu-riscv/qemu-riscv.c b/board/emulation/qemu-riscv/qemu-riscv.c
index ae3b7a3295..b2fe3e9f0c 100644
--- a/board/emulation/qemu-riscv/qemu-riscv.c
+++ b/board/emulation/qemu-riscv/qemu-riscv.c
@@ -69,10 +69,21 @@ int board_late_init(void)
 }
 
 #ifdef CONFIG_SPL
-u32 spl_boot_device(void)
+void board_boot_order(u32 *spl_boot_list)
 {
-	/* RISC-V QEMU only supports RAM as SPL boot device */
-	return BOOT_DEVICE_RAM;
+	int index = 0;
+
+	if (IS_ENABLED(CONFIG_SPL_NVME))
+		spl_boot_list[index++] = BOOT_DEVICE_NVME;
+	if (IS_ENABLED(CONFIG_SPL_SATA))
+		spl_boot_list[index++] = BOOT_DEVICE_SATA;
+	if (IS_ENABLED(CONFIG_SPL_USB_STORAGE))
+		spl_boot_list[index++] = BOOT_DEVICE_USB;
+	if (IS_ENABLED(CONFIG_SPL_SEMIHOSTING))
+		spl_boot_list[index++] = BOOT_DEVICE_SMH;
+	/* RAM last as CONFIG_SPL_RAW_IMAGE_SUPPORT=y may lead to crash */
+	if (IS_ENABLED(CONFIG_SPL_RAM_SUPPORT))
+		spl_boot_list[index++] = BOOT_DEVICE_RAM;
 }
 #endif
 
-- 
2.40.1



More information about the U-Boot mailing list