| Message ID | 20250522134116.254270-1-mikko.rapeli@linaro.org |
|---|---|
| State | New |
| Headers | show |
| Series | [v3,1/3] u-boot: disable CONFIG_BLOBLIST on genericarm64 and qemuarm64 | expand |
Hi, On Thu, May 22, 2025 at 04:41:16PM +0300, Mikko Rapeli via lists.openembedded.org wrote: > Add a test case to boot target system via u-boot > using qemu with KVM. This was broken recently > and workaround proposed to u-boot. Test case > works with genericarm64 and qemuarm64 target machines > compiled and tested on aarch64 build host with KVM > support. > > Test execution time with full sstate cache is > around 170 seconds. qemu boot itself takes just > a few seconds to full userspace. > > Signed-off-by: Mikko Rapeli <mikko.rapeli@linaro.org> > --- > meta/lib/oeqa/selftest/cases/uboot.py | 55 ++++++++++++++++++++++++++- > 1 file changed, 53 insertions(+), 2 deletions(-) > > diff --git a/meta/lib/oeqa/selftest/cases/uboot.py b/meta/lib/oeqa/selftest/cases/uboot.py > index 39e48f8bdb..982822b389 100644 > --- a/meta/lib/oeqa/selftest/cases/uboot.py > +++ b/meta/lib/oeqa/selftest/cases/uboot.py > @@ -6,8 +6,8 @@ > # > > from oeqa.selftest.case import OESelftestTestCase > -from oeqa.utils.commands import bitbake, runqemu, get_bb_var > -from oeqa.core.decorator.data import skipIfNotArch > +from oeqa.utils.commands import bitbake, runqemu, get_bb_var, runCmd > +from oeqa.core.decorator.data import skipIfNotArch, skipIfNotMachine > from oeqa.core.decorator import OETestTag > > uboot_boot_patterns = { > @@ -42,3 +42,54 @@ QEMU_USE_KVM = "False" > status, output = qemu.run_serial(cmd) > self.assertEqual(status, 1, msg=output) > self.assertTrue("U-Boot" in output, msg=output) > + > + @skipIfNotArch(['aarch64']) > + # Also works on genericarm64 but no way to encode that currently > + @skipIfNotMachine('qemuarm64', 'KVM depends that host and target architectures match, e.g. aarch64 and qemuarm64') On second thought, these are not quite right. I think HOST_ARCH limit to "aarch64" is ok but will still cause this to run on x86_64 build machines which will not work. I think I need to add a BUILD_ARCH decorator to limit this to run on 'aarch64' build host when building 'aarch64' targets. Then KVM can work. I'll update the changes. Cheers, -Mikko > + @OETestTag("runqemu") > + def test_boot_uboot_kvm_to_full_target(self): > + """ > + Tests building u-boot and booting it with QEMU and KVM. > + Requires working KVM on build host. See "kvm-ok" output. > + """ > + > + runCmd("kvm-ok") > + > + self.write_config(""" > +QEMU_USE_KVM = "1" > + > +# Using u-boot in EFI mode, need ESP partition for grub/systemd-boot/kernel etc > +IMAGE_FSTYPES:pn-core-image-minimal:append = " wic" > + > +# easiest to follow genericarm64 setup with wks file, initrd and EFI loader > +INITRAMFS_IMAGE="core-image-initramfs-boot" > +EFI_PROVIDER = "${@bb.utils.contains("DISTRO_FEATURES", "systemd", "systemd-boot", "grub-efi", d)}" > +WKS_FILE = "genericarm64.wks.in" > + > +# use wic image with ESP for u-boot, not ext4 > +QB_DEFAULT_FSTYPE = "wic" > + > +PREFERRED_PROVIDER_virtual/bootloader = "u-boot" > +QB_DEFAULT_BIOS = "u-boot.bin" > + > +# let u-boot or EFI loader load kernel from ESP > +QB_DEFAULT_KERNEL = "none" > + > +# virt pci, not scsi because support not in u-boot to find ESP > +QB_DRIVE_TYPE = "vd" > +# qemu usb causes u-boot reset atm > +QB_OPT_APPEND = "" > +""") > + bitbake("virtual/bootloader core-image-minimal") > + > + runqemu_params = get_bb_var('TEST_RUNQEMUPARAMS', "core-image-minimal") or "" > + with runqemu('core-image-minimal', ssh=False, runqemuparams='nographic kvm %s' % runqemu_params) as qemu: > + > + # boot to target and login worked, should have been fast with kvm > + cmd = "dmesg" > + status, output = qemu.run_serial(cmd) > + self.assertEqual(status, 1, msg=output) > + # Machine is qemu > + self.assertTrue("Machine model: linux,dummy-virt" in output, msg=output) > + # with KVM enabled > + self.assertTrue("KVM: hypervisor services detected" in output, msg=output) > -- > 2.43.0 > > > -=-=-=-=-=-=-=-=-=-=-=- > Links: You receive all messages sent to this group. > View/Reply Online (#217107): https://lists.openembedded.org/g/openembedded-core/message/217107 > Mute This Topic: https://lists.openembedded.org/mt/113247084/7159507 > Group Owner: openembedded-core+owner@lists.openembedded.org > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [mikko.rapeli@linaro.org] > -=-=-=-=-=-=-=-=-=-=-=- >
diff --git a/meta/recipes-bsp/u-boot/files/disable-CONFIG_BLOBLIST.cfg b/meta/recipes-bsp/u-boot/files/disable-CONFIG_BLOBLIST.cfg new file mode 100644 index 0000000000..d01d3d12d8 --- /dev/null +++ b/meta/recipes-bsp/u-boot/files/disable-CONFIG_BLOBLIST.cfg @@ -0,0 +1 @@ +# CONFIG_BLOBLIST is not set diff --git a/meta/recipes-bsp/u-boot/u-boot-common.inc b/meta/recipes-bsp/u-boot/u-boot-common.inc index fd1eab5cdd..a77c49cb8b 100644 --- a/meta/recipes-bsp/u-boot/u-boot-common.inc +++ b/meta/recipes-bsp/u-boot/u-boot-common.inc @@ -16,6 +16,10 @@ SRCREV = "34820924edbc4ec7803eb89d9852f4b870fa760a" SRC_URI = "git://source.denx.de/u-boot/u-boot.git;protocol=https;branch=master;tag=v${PV}" +# workaround for aarch64 kvm qemu boot regression +SRC_URI:append:qemuarm64 = " file://disable-CONFIG_BLOBLIST.cfg" +SRC_URI:append:genericarm64 = " file://disable-CONFIG_BLOBLIST.cfg" + S = "${WORKDIR}/git" B = "${WORKDIR}/build"
Booting u-boot on qemu with kvm is currently hanging on aarch64 build host. Root cause is in u-boot and CONFIG_BLOBLIST can be disabled as a workaround. To reproduce, build on kvm enabled host where "kvm-ok" succeeds. For example genericarm64 machine and core-image-base should then boot with: $ runqemu slirp nographic novga snapshot kvm On qemuarm64, default kvm setup will boot directly to kernel and is not affected by this. If build enables u-boot as bios then the same issue happens. Without this config workaround, the boot hangs without any messages in qemu output but ctrl-a-c to qemu console can shutdown the emulated machine. This seems to have regressed after u-boot 2025.04 update. KVM boot can be detected from speed, for example genericarm64 boots in 550 ms with KVM and without in over 5 seconds. Fixes: [YOCTO #15872] Upstream u-boot discussion: https://lists.denx.de/pipermail/u-boot/2025-May/590101.html Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org> Signed-off-by: Mikko Rapeli <mikko.rapeli@linaro.org> --- meta/recipes-bsp/u-boot/files/disable-CONFIG_BLOBLIST.cfg | 1 + meta/recipes-bsp/u-boot/u-boot-common.inc | 4 ++++ 2 files changed, 5 insertions(+) create mode 100644 meta/recipes-bsp/u-boot/files/disable-CONFIG_BLOBLIST.cfg v3: added u-boot discussion link to commit message v2: applying to genericarm64 and qemuarm64 machines only https://lists.openembedded.org/g/openembedded-core/message/217054 v1: https://lists.openembedded.org/g/openembedded-core/message/217030