From d6d8720c3f273f412ca1e2f6436b1ae11904161d Mon Sep 17 00:00:00 2001 From: Andre Przywara Date: Mon, 10 Oct 2022 18:01:22 +0100 Subject: [PATCH] qemu: Try to automatically boot from the QEMU firmware device (qfw) At the moment the QEMU boot sequence tries various (storage) devices when trying to find a payload to boot. To simplify starting a specific kernel and initrd, there is also the qfw command, which can use the files specified on the QEMU command line, via the -kernel and -initrd options. Add this command to the list of boot options to try. Since users specifying those options on the command line probably explicitly want to run them, let's place the new command first. Without those options, the qfw command will just gracefully fail, and we continue with the existing order. This allows auto-booting of specific kernels in QEMU, for instance in CI systems. Signed-off-by: Andre Przywara --- include/configs/qemu-arm.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/configs/qemu-arm.h b/include/configs/qemu-arm.h index dd2faeb..535762e 100644 --- a/include/configs/qemu-arm.h +++ b/include/configs/qemu-arm.h @@ -21,6 +21,17 @@ EFI_GUID(0x058b7d83, 0x50d5, 0x4c47, 0xa1, 0x95, \ 0x60, 0xd8, 0x6a, 0xd3, 0x41, 0xc4) +/* 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 " + /* For timer, QEMU emulates an ARMv7/ARMv8 architected timer */ /* Environment options */ @@ -56,6 +67,7 @@ #endif #define BOOT_TARGET_DEVICES(func) \ + func(QFW, qfw, na) \ BOOT_TARGET_USB(func) \ BOOT_TARGET_SCSI(func) \ BOOT_TARGET_VIRTIO(func) \ -- 2.7.4