[PATCH 1/1] boot: provide CONFIG_BOOTMETH_QFW Kconfig parameter

Heinrich Schuchardt heinrich.schuchardt at canonical.com
Tue Jul 16 10:23:59 CEST 2024


On 7/16/24 09:04, Simon Glass wrote:
> Hi Heinrich,
> 
> On Tue, 16 Jul 2024 at 03:40, Heinrich Schuchardt
> <heinrich.schuchardt at canonical.com> wrote:
>>
>> U-Boot is often used conjunction with QEMU to boot via EFI or syslinux.
>> Here the QFW boot method is not needed.
>>
>> At least for qemu-riscv64_smode_defconfig the kernel parameter is used
>> to specify the U-Boot binary. Trying to run U-Boot as a kernel makes
>> no sense.
>>
>> Provide Kconfig parameter CONFIG_BOOTMETH_QFW to decide if the QFW boot
>> method shall be provided.
>>
>> Disable the QFW boot method for all architectures but the sandbox by
>> default.
>>
>> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt at canonical.com>
>> ---
>>   boot/Kconfig  | 9 +++++++++
>>   boot/Makefile | 2 +-
>>   2 files changed, 10 insertions(+), 1 deletion(-)
>>
>> diff --git a/boot/Kconfig b/boot/Kconfig
>> index 95300b008c5..d7e034c89e7 100644
>> --- a/boot/Kconfig
>> +++ b/boot/Kconfig
>> @@ -568,6 +568,15 @@ config BOOTMETH_EFI_BOOTMGR
>>            the EFI binary to be launched is determined. To set the EFI variables
>>            use the eficonfig command.
>>
>> +config BOOTMETH_QFW
>> +       bool "Boot method using QEMU parameters"
>> +       depends on QFW
>> +       default y if SANDBOX
>> +       help
>> +        Use QEMU parameters -kernel, -initrd, -append to determine the kernel,
>> +        initial RAM disk, and kernel command line parameters to boot an
>> +        operating system. U-Boot's control device-tree is passed to the kernel.
> 
> I added the bootmeth to deal with this part of the old qemu-arm.h :
> 
> /* Try files from QEMU's -kernel/-initrd, through the QEMU firmware device. */
> #define BOOTENV_DEV_QFW(devtypeu, devtypel, instance) \
> "bootcmd_qfw= " \
> "if qfw load $kernel_addr_r $ramdisk_addr_r; then " \
> "  booti $kernel_addr_r $ramdisk_addr_r:$filesize $fdtcontroladdr; " \
> "  if test $? -eq 1; then " \
> "    bootz $kernel_addr_r $ramdisk_addr_r:$filesize $fdtcontroladdr; " \
> "  fi ; " \
> "fi\0"
> #define BOOTENV_DEV_NAME_QFW(devtypeu, devtypel, instance) "qfw "
> 
> Are you sure this is not used?

Those lines were only on ARM. On RISC-V the -bios parameter is used to 
replace the OpenSBI embedded in QEMU and -kernel is used for S-mode U-Boot.

So on RISC-V this boot method would only be usable for 
CONFIG_SPL_RISCV_MMODE=y or CONFIG_RISCV_MMODE=y.

Let me resubmit with default=y. That way the method is at least 
customizable.

Best regards

Heirnich

> 
>> +
>>   config BOOTMETH_VBE
>>          bool "Bootdev support for Verified Boot for Embedded"
>>          depends on FIT
>> diff --git a/boot/Makefile b/boot/Makefile
>> index 84ccfeaecec..92e6adb887c 100644
>> --- a/boot/Makefile
>> +++ b/boot/Makefile
>> @@ -11,7 +11,6 @@ obj-$(CONFIG_CMD_BOOTZ) += bootm.o bootm_os.o
>>   obj-$(CONFIG_CMD_BOOTI) += bootm.o bootm_os.o
>>
>>   obj-$(CONFIG_PXE_UTILS) += pxe_utils.o
>> -obj-$(CONFIG_QFW) += bootmeth_qfw.o
>>
>>   endif
>>
>> @@ -31,6 +30,7 @@ obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_EXTLINUX) += bootmeth_extlinux.o
>>   obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_EXTLINUX_PXE) += bootmeth_pxe.o
>>   obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_EFILOADER) += bootmeth_efi.o
>>   obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_CROS) += bootm.o bootm_os.o bootmeth_cros.o
>> +obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_QFW) += bootmeth_qfw.o
>>   obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_SANDBOX) += bootmeth_sandbox.o
>>   obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_SCRIPT) += bootmeth_script.o
>>   obj-$(CONFIG_$(SPL_TPL_)CEDIT) += cedit.o
>> --
>> 2.45.2
>>
> 
> Regards,
> Simon



More information about the U-Boot mailing list