emulation: Allow booting without CMDLINE

Use programmatic boot so that it is possible to boot without
CONFIG_CMDLINE enabled.

Series-to: u-boot
Cover-letter:
emulation: Improve support for booting from QFW
U-Boot supports booting Linux from QFW which means that the kernel and
any initrd are provided on the QEMU command line instead of being found
in boot media.

This series improves this support in several ways:
- Enhances bootstd to implement 'bootflow read', thus allowing the
  files to be loaded and inspected (with potential cmdline changes)
  before booting
- Updates bootstd to use programmatic boot, so that it works even when
  CONFIG_CMDLINE is disabled
- Expands build-qemu script to allow providing cmdline and root disk

It also includes a rough script to time U-Boot when running QEMU with
kvm, making use of the qemu-boot-time repo:

   https://github.com/stefano-garzarella/qemu-boot-time.git
END

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2025-06-07 11:24:33 -06:00
parent 28548b43b6
commit 3cac4dd7a4
2 changed files with 10 additions and 10 deletions

View File

@@ -161,13 +161,12 @@ static int qfw_boot(struct udevice *dev, struct bootflow *bflow)
rimg->size);
bmi.conf_ramdisk = conf_ramdisk;
ret = run_command("booti ${kernel_addr_r} ${ramdisk_addr_r}:${filesize} ${fdtcontroladdr}",
0);
if (ret) {
ret = run_command("bootz ${kernel_addr_r} ${ramdisk_addr_r}:${filesize} "
"${fdtcontroladdr}", 0);
}
if (ret && simg) {
ret = -ENOENT;
if (IS_ENABLED(CONFIG_CMD_BOOTI))
ret = booti_run(&bmi);
if (ret && IS_ENABLED(CONFIG_CMD_BOOTZ))
ret = bootz_run(&bmi);
if (ret && IS_ENABLED(CONFIG_ZBOOT) && simg) {
ret = zboot_run_args(kimg->addr, kimg->size,
rimg->addr, rimg->size, simg->addr,
*bflow->cmdline ? bflow->cmdline : NULL);

View File

@@ -12,9 +12,10 @@ provided by the QEMU `-kernel` argument, the initial ramdisk provided by
`-initrd` and the boot arguments (command line) provided by `-append` into
memory ready for booting.
When the bootflow is booted, the bootmeth tries the `booti` command first, then
falls back to the `bootz` command, then `zboot`. U-Boot's 'control' devicetree
is passed through to the kernel on non-x86 devices.
When the bootflow is booted, the bootmeth tries the `booti` option first, then
falls back to the `bootz` option, then `zboot`. U-Boot's 'control' devicetree
is passed through to the kernel on non-x86 devices. This works without needing
`CONFIG_CMDLINE` enabled.
The `bootflow read` command is supported, so it is possible to read the files
and then check the kernel command-line before using `bootflow boot` to boot.