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

Bin Meng bmeng.cn at gmail.com
Sat Jul 22 16:22:25 CEST 2023


Hi Heinrich,

On Sat, Jul 22, 2023 at 7:10 PM Heinrich Schuchardt
<heinrich.schuchardt at canonical.com> wrote:
>
> 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
>

Please include instructions on how to boot U-Boot proper from these
additional devices in qemu-riscv.rst

Regards,
Bin


More information about the U-Boot mailing list