From: Mikko Rapeli <mikko.rapeli@linaro.org>
To: openembedded-core@lists.openembedded.org
Cc: Mikko Rapeli <mikko.rapeli@linaro.org>
Subject: [PATCH v3 07/11] oeqa selftest uki.py: add aarch64/arm test with systemd based initrd
Date: Fri, 4 Apr 2025 19:29:28 +0300 [thread overview]
Message-ID: <20250404162932.447699-8-mikko.rapeli@linaro.org> (raw)
In-Reply-To: <20250404162932.447699-1-mikko.rapeli@linaro.org>
Use core-image-initramfs-boot with systemd to boot via UKI on
arm/aarch64. Tested on qemuarm, qemuarm64 and genericarm64
on aarch64 build host. The machines have different image
and qemuboot configs so they need to be configured in test.
Signed-off-by: Mikko Rapeli <mikko.rapeli@linaro.org>
---
meta/lib/oeqa/selftest/cases/uki.py | 76 +++++++++++++++++++++++++++++
1 file changed, 76 insertions(+)
diff --git a/meta/lib/oeqa/selftest/cases/uki.py b/meta/lib/oeqa/selftest/cases/uki.py
index 9a1aa4e269..4830fb3403 100644
--- a/meta/lib/oeqa/selftest/cases/uki.py
+++ b/meta/lib/oeqa/selftest/cases/uki.py
@@ -139,3 +139,79 @@ IMAGE_CLASSES:remove = 'testimage'
cmd = "echo $( cat /sys/firmware/efi/efivars/LoaderEntrySelected-4a67b082-0a4c-41cf-b6c7-440b29bb8c4f ) | grep '%s'" % (uki_filename)
status, output = qemu.run_serial(cmd)
self.assertEqual(1, status, 'Failed to run command "%s": %s' % (cmd, output))
+
+ @skipIfNotArch(['aarch64', 'arm'])
+ @OETestTag("runqemu")
+ def test_uki_boot_systemd_initrd(self):
+ """Build and boot into UEFI firmware (u-boot), systemd-boot, initrd with systemd, rootfs with systemd"""
+ image = "core-image-base"
+ runqemu_params = get_bb_var('TEST_RUNQEMUPARAMS', image) or ""
+ cmd = "runqemu %s nographic serial wic" % (runqemu_params)
+
+ self.write_config("""
+# efi firmware must load systemd-boot, not grub
+EFI_PROVIDER = "systemd-boot"
+
+# image format must be wic, needs esp partition for firmware etc
+IMAGE_FSTYPES:pn-%s:append = " wic"
+WKS_FILE = "efi-uki-bootdisk.wks.in"
+
+# efi, uki and systemd features must be enabled
+INIT_MANAGER = "systemd"
+DISTRO_FEATURES += "systemd-initramfs"
+MACHINE_FEATURES:append = " efi"
+IMAGE_CLASSES:append:pn-core-image-base = " uki"
+
+# uki embeds also an initrd
+INITRAMFS_IMAGE = "core-image-initramfs-boot"
+
+# runqemu must not load kernel separately, it's in the uki
+QB_KERNEL_ROOT = ""
+QB_DEFAULT_KERNEL = "none"
+
+# u-boot, not all qemu* machines set this correctly
+QB_DEFAULT_BIOS = "u-boot.bin"
+# machines may not set this correctly
+QB_DEFAULT_FSTYPE = "wic"
+
+# u-boot needs to find ESP partition so use virtio block device instead of default scsi
+QB_ROOTFS_OPT = "-drive id=root,file=@ROOTFS@,if=none,format=raw -device virtio-blk-pci,drive=root"
+QB_DRIVE_TYPE = "/dev/vd"
+
+# boot command line provided via uki, not via bootloader
+UKI_CMDLINE = "rootwait root=LABEL=root"
+# enable if debug output is needed
+# UKI_CMDLINE += "systemd.log_level=debug systemd.log_target=console systemd.journald.forward_to_console=1"
+
+# disable kvm, breaks boot
+QEMU_USE_KVM = ""
+
+IMAGE_CLASSES:remove = 'testimage'
+""" % (image))
+
+ uki_filename = get_bb_var('UKI_FILENAME', image)
+
+ bitbake(image + " u-boot")
+ with runqemu(image, ssh=False, launch_cmd=cmd) as qemu:
+ self.assertTrue(qemu.runner.logged, "Failed: %s" % cmd)
+
+ # Verify from efivars that firmware was:
+ # aarch64
+ cmd = "echo $( cat /sys/firmware/efi/efivars/LoaderFirmwareInfo-4a67b082-0a4c-41cf-b6c7-440b29bb8c4f ) | grep 'Das U-Boot'"
+ status, output = qemu.run_serial(cmd)
+ self.assertEqual(1, status, 'Failed to run command "%s": %s' % (cmd, output))
+
+ # Check that systemd-boot was the loader
+ cmd = "echo $( cat /sys/firmware/efi/efivars/LoaderInfo-4a67b082-0a4c-41cf-b6c7-440b29bb8c4f ) | grep systemd-boot"
+ status, output = qemu.run_serial(cmd)
+ self.assertEqual(1, status, 'Failed to run command "%s": %s' % (cmd, output))
+
+ # Check that systemd-stub was used
+ cmd = "echo $( cat /sys/firmware/efi/efivars/StubInfo-4a67b082-0a4c-41cf-b6c7-440b29bb8c4f ) | grep systemd-stub"
+ status, output = qemu.run_serial(cmd)
+ self.assertEqual(1, status, 'Failed to run command "%s": %s' % (cmd, output))
+
+ # Check that the compiled uki file was booted into
+ cmd = "echo $( cat /sys/firmware/efi/efivars/LoaderEntrySelected-4a67b082-0a4c-41cf-b6c7-440b29bb8c4f ) | grep '%s'" % (uki_filename)
+ status, output = qemu.run_serial(cmd)
+ self.assertEqual(1, status, 'Failed to run command "%s": %s' % (cmd, output))
--
2.43.0
next prev parent reply other threads:[~2025-04-04 16:30 UTC|newest]
Thread overview: 76+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-04 16:29 [PATCH v3 00/11] systemd based initrd and modular kernel support Mikko Rapeli
2025-04-04 16:29 ` [PATCH v3 01/11] systemd: enable efi support by default Mikko Rapeli
2025-04-10 10:16 ` [OE-core] " Adrian Freihofer
2025-04-10 11:12 ` Mikko Rapeli
2025-04-10 11:45 ` Ilias Apalodimas
2025-04-10 12:12 ` Ilias Apalodimas
2025-04-10 17:44 ` Alexander Kanavin
2025-04-10 17:48 ` Ilias Apalodimas
2025-04-10 19:19 ` Alexander Kanavin
2025-04-11 10:56 ` Ilias Apalodimas
2025-04-10 20:53 ` Adrian Freihofer
2025-04-11 10:38 ` Ilias Apalodimas
2025-04-10 12:13 ` Alexander Kanavin
2025-04-10 12:54 ` Ilias Apalodimas
2025-04-10 14:20 ` Alexander Kanavin
2025-04-10 14:38 ` Ilias Apalodimas
2025-04-10 14:51 ` Alexander Kanavin
2025-04-10 15:16 ` Ilias Apalodimas
2025-04-10 15:27 ` Mikko Rapeli
2025-04-11 8:40 ` Mike Looijmans
2025-04-11 10:45 ` Mikko Rapeli
2025-04-11 11:08 ` mike.looijmans
2025-04-14 16:28 ` Adrian Freihofer
2025-04-15 9:51 ` Mikko Rapeli
2025-04-15 10:39 ` Jose Quaresma
2025-04-15 16:20 ` Peter Kjellerstedt
2025-04-16 6:08 ` Mikko Rapeli
2025-04-16 9:07 ` Koen Kooi
2025-04-16 10:10 ` Adrian Freihofer
2025-04-16 12:54 ` Peter Kjellerstedt
2025-04-04 16:29 ` [PATCH v3 02/11] uki.bbclass: drop serial console from kernel command line Mikko Rapeli
2025-04-04 16:29 ` [PATCH v3 03/11] kernel.bbclass: add kernel-initrd-modules meta package Mikko Rapeli
2025-04-08 3:42 ` [OE-core] " Bruce Ashfield
2025-04-10 12:42 ` Richard Purdie
2025-04-10 13:00 ` Mikko Rapeli
2025-04-10 13:15 ` Bruce Ashfield
2025-04-11 7:48 ` Mikko Rapeli
2025-04-11 12:52 ` Bruce Ashfield
2025-04-11 13:12 ` Mikko Rapeli
2025-04-11 13:39 ` Bruce Ashfield
2025-04-11 13:45 ` Richard Purdie
2025-04-22 10:18 ` Mikko Rapeli
2025-04-23 12:48 ` Bruce Ashfield
[not found] ` <1834F69070219745.7383@lists.openembedded.org>
2025-04-11 8:07 ` Mikko Rapeli
2025-04-04 16:29 ` [PATCH v3 04/11] core-image-initramfs-boot: add option to build systemd based initrd Mikko Rapeli
2025-04-07 6:01 ` [OE-core] " Koen Kooi
2025-04-07 6:12 ` Mikko Rapeli
2025-04-07 8:58 ` Koen Kooi
2025-04-07 9:08 ` Mikko Rapeli
2025-04-10 12:45 ` Richard Purdie
2025-04-10 13:05 ` Mikko Rapeli
2025-04-04 16:29 ` [PATCH v3 05/11] core-image-initramfs-boot: don't install RRECOMMENDS to reduce size Mikko Rapeli
2025-04-10 12:47 ` [OE-core] " Richard Purdie
2025-04-10 13:09 ` Mikko Rapeli
2025-04-04 16:29 ` [PATCH v3 06/11] core-image-initramfs-boot: install kernel-initrd-modules by default Mikko Rapeli
2025-04-04 16:29 ` Mikko Rapeli [this message]
2025-04-04 16:29 ` [PATCH v3 08/11] test_efi_plugin_plain_systemd-boot: don't set console Mikko Rapeli
2025-04-04 16:29 ` [PATCH v3 09/11] image_types_wic.bbclass: capture verbose wic output by default Mikko Rapeli
2025-04-14 20:43 ` [OE-core] " Trevor Woerner
2025-04-15 5:19 ` Mikko Rapeli
2025-04-22 14:25 ` Alexander Kanavin
2025-04-04 16:29 ` [PATCH v3 10/11] wic bootimg-efi.py: fail build if no binaries installed Mikko Rapeli
2025-04-14 20:51 ` [OE-core] " Trevor Woerner
2025-04-15 5:03 ` Mikko Rapeli
2025-04-04 16:29 ` [PATCH v3 11/11] image_types_wic.bbclass: depend on grub-efi and systemd-boot on aarch64, systemd-boot on arm Mikko Rapeli
2025-04-14 20:48 ` [OE-core] " Trevor Woerner
2025-04-15 5:01 ` Mikko Rapeli
2025-04-07 7:53 ` [OE-core] [PATCH v3 00/11] systemd based initrd and modular kernel support Mathieu Dubois-Briand
2025-04-07 8:10 ` Mikko Rapeli
2025-04-07 8:51 ` Mathieu Dubois-Briand
2025-04-07 9:24 ` Mikko Rapeli
2025-04-07 9:52 ` Mathieu Dubois-Briand
2025-04-07 10:26 ` Mikko Rapeli
[not found] ` <18340261181AE46F.21691@lists.openembedded.org>
2025-04-07 11:13 ` Mikko Rapeli
2025-04-08 11:26 ` Mathieu Dubois-Briand
2025-04-08 11:39 ` Mikko Rapeli
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250404162932.447699-8-mikko.rapeli@linaro.org \
--to=mikko.rapeli@linaro.org \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox