[PATCH 3/3] qemu: Try to automatically boot from the QEMU firmware device (qfw)
Andre Przywara
andre.przywara at arm.com
Mon Oct 10 19:01:22 CEST 2022
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 <andre.przywara at arm.com>
---
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 dd2faebbbb2..535762ecb24 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.25.1
More information about the U-Boot
mailing list