Skip to content

Commit

Permalink
qemu: Try to automatically boot from the QEMU firmware device (qfw)
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
Andre-ARM authored and trini committed Oct 21, 2022
1 parent 2f6c45e commit d6d8720
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions include/configs/qemu-arm.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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) \
Expand Down

0 comments on commit d6d8720

Please sign in to comment.