Skip to contentSkip to conversation

systemd based initrd and modular kernel support

PATCH Superseded Mikko Rapeli 4 participants 13 messages Mar 14, 2025 – Mar 17, 2025

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

cover systemd based initrd and modular kernel support

systemd based initrd supports more security, encryption etc features than custom shell script ones but oe-core lacks support for it. Convert core-image-initramfs-boot to create systemd based initrd if "systemd-initramfs" is set in DISTRO_FEATURES. Includes a test for this initrd to mount rootfs via Unified Kernel Image uki.py.

Sadly the boot time is really slow, e.g. over 30 seconds with systemd based initrd. One of the major reasons is the large amount of kernel modules built into the linux-yocto kernel and processing of their udev events in userspace. Thus add kernel-initrd-modules meta package to easily install subset of all kernel modules to initrd. The subset supports "mount rootfs from any block device" but doesn't include graphics, UBS etc support. Without this generated meta package, initrd recipe needs to manually define which exact kernel modules to include which breaks if those modules are built into the kernel. Thus the initrd becomes machine and kernel config specific and hard to maintain. With this meta package a generic initrd can be created.

Separate changes to linux-yocto compile a lot more drivers as modules but they depend on these initrd changes.

Mikko Rapeli (6):
systemd: use serial-getty-generator on genericarm64
systemd: enable efi support if in MACHINE_FEATURES too uki.bbclass: drop serial console from kernel command line kernel.bbclass: add kernel-initrd-modules meta package
core-image-initramfs-boot: add option to build systemd based initrd oeqa selftest uki.py: add aarch64/arm test with systemd based initrd

 .../recipes-core/systemd/systemd_%.bbappend   |  3 +
 .../kernel-module-split.bbclass               | 46 +++++++++++
 meta/classes-recipe/kernel.bbclass            |  5 +-
 meta/classes-recipe/module.bbclass            | 37 +++++++++
 meta/classes-recipe/uki.bbclass               |  2 +-
 meta/lib/oeqa/selftest/cases/uki.py           | 76 +++++++++++++++++++
 .../images/core-image-initramfs-boot.bb       | 28 ++++++-
 meta/recipes-core/systemd/systemd_257.3.bb    |  1 +
 8 files changed, 193 insertions(+), 5 deletions(-)
 create mode 100644 meta-yocto-bsp/recipes-core/systemd/systemd_%.bbappend
Signature · 1 line
2.43.0
#1 lore raw

PATCH 2/6 systemd: enable efi support if in MACHINE_FEATURES too

For example genericarm64 enables "efi" in MACHINE_FEATURES and in u-boot. Boot without "efi" in systemd works with EFI protocols but for example efivars is not mounted at all so various checks fail in userspace. Fix these by enabling "efi" support if it's in MACHINE_FEATURES. Fixes efivars mount to /sys/firmware/efi/efivars etc.

---
 meta/recipes-core/systemd/systemd_257.3.bb | 1 +
 1 file changed, 1 insertion(+)
meta/recipes-core/systemd/systemd_257.3.bb +1 -0
index 64fb8fe69a..9bc4532021 100644
@@ -69,6 +69,7 @@ PAM_PLUGINS = " \
 
 PACKAGECONFIG ??= " \
     ${@bb.utils.filter('DISTRO_FEATURES', 'acl audit apparmor efi ldconfig pam pni-names selinux smack polkit seccomp', d)} \
+    ${@bb.utils.filter('MACHINE_FEATURES', 'efi', d)} \
     ${@bb.utils.contains('DISTRO_FEATURES', 'minidebuginfo', 'coredump elfutils', '', d)} \
     ${@bb.utils.contains('DISTRO_FEATURES', 'wifi', 'rfkill', '', d)} \
     ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'xkbcommon', '', d)} \
Signature · 1 line
2.43.0
#2 lore raw

PATCH 3/6 uki.bbclass: drop serial console from kernel command line

In reply to Mikko Rapeli

The kernel will continue using console from firmware which is much better on HW when we may not know at build time which console HW and drivers are available, e.g. like on genericarm64 machine.

---
 meta/classes-recipe/uki.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes-recipe/uki.bbclass +1 -1
index d9a7fb0e6f..fedff222c6 100644
@@ -81,7 +81,7 @@ UKIFY_CMD ?= "ukify build"
 UKI_CONFIG_FILE ?= "${UNPACKDIR}/uki.conf"
 UKI_FILENAME ?= "uki.efi"
 UKI_KERNEL_FILENAME ?= "${KERNEL_IMAGETYPE}"
-UKI_CMDLINE ?= "rootwait root=LABEL=root console=${KERNEL_CONSOLE}"
+UKI_CMDLINE ?= "rootwait root=LABEL=root"
 # secure boot keys and cert, needs sbsign-tools-native (meta-secure-core)
 #UKI_SB_KEY ?= ""
 #UKI_SB_CERT ?= ""
Signature · 1 line
2.43.0
#3 lore raw

PATCH 4/6 kernel.bbclass: add kernel-initrd-modules meta package

In reply to Mikko Rapeli

At the moment linux-yocto kernels for various architectures are not very modular and a lot of drivers are built into the kernel even when they are not needed at runtime. These make the main kernel binary big and slow to boot. This also impacts udev in userspace which takes a long time processing events from all these built in drivers, for example when udev runs in initrd.

Then constructing the initrd is very device and kernel configuration specific. initrd image needs explicitly define which binary packages to install to avoid pulling in complex dependencies. A full set of kernel modules via kernel-modules meta package is too big for initrd and most of the drivers are not needed for use cases like "just load modules to mount main rootfs". Then the initrd configuration breaks if kernel driver is built into the kernel since the binary package doesn't exist.

Introduce kernel-initrd-modules meta package to solve these problems. The meta package adds dependencies to real kernel modules based on the kernel module file paths so that it will include several kernel subsystems and their drivers which are often needed to find main rootfs from some block device. This works when drivers are built as modules but does not break if drivers are built into the kernel.

The resulting initrd is also smaller since only a subset of drivers are needed for "mount the rootfs" usecase. Tested on genericarm64 kernel and qemu and AMD KV260 HW.

---
 .../kernel-module-split.bbclass               | 46 +++++++++++++++++++
 meta/classes-recipe/kernel.bbclass            |  5 +-
 meta/classes-recipe/module.bbclass            | 37 +++++++++++++++
 3 files changed, 87 insertions(+), 1 deletion(-)
meta/classes-recipe/kernel-module-split.bbclass +46 -0
index 9487365eb7..06e8fbed6e 100644
@@ -42,6 +42,40 @@ KERNEL_MODULE_PACKAGE_PREFIX ?= ""
 KERNEL_MODULE_PACKAGE_SUFFIX ?= "-${KERNEL_VERSION}"
 KERNEL_MODULE_PROVIDE_VIRTUAL ?= "1"
 
+# subset of kernel modules needed in initrd, to e.g. mount rootfs from block device
+KERNEL_INITRD_MODULES_META_PACKAGE ?= "${@ d.getVar("KERNEL_PACKAGE_NAME") or "kernel" }-initrd-modules"
+
+# match regex to path or file name. E.g. include all drivers with files in path /drivers/ata/
+KERNEL_INITRD_MODULES_REGEX ?= "(.*)(\
+/drivers/acpi/|\
+/drivers/ata/|\
+/drivers/block/|\
+/drivers/cdrom/|\
+/drivers/char/hw_random/|\
+/drivers/char/tpm/|\
+/drivers/char/|\
+/drivers/crypto/|\
+/drivers/dax/|\
+/drivers/firmware/arm_scmi/|\
+/drivers/gpu/drm/|\
+/drivers/md/|\
+/drivers/mmc/|\
+/drivers/mtd/|\
+/drivers/nvdimm/|\
+/drivers/nvme/|\
+/drivers/pci/|\
+/drivers/scsi/|\
+/drivers/tee/|\
+/drivers/tty/serial/|\
+/drivers/virtio/|\
+/drivers/watchdog/|\
+/kernel/arch/|\
+/kernel/block/|\
+/kernel/crypto/|\
+/kernel/fs/|\
+/kernel/lib/\
+)(.*)"
+
 python split_kernel_module_packages () {
     import re
 
@@ -183,6 +217,18 @@ python split_kernel_module_packages () {
     modules = do_split_packages(d, root='${nonarch_base_libdir}/modules', file_regex=module_regex, output_pattern=module_pattern, description='%s kernel module', postinst=postinst, postrm=postrm, recursive=True, hook=frob_metadata, extra_depends='%s-%s' % (kernel_package_name, kernel_version))
     if modules:
         d.appendVar('RDEPENDS:' + metapkg, ' '+' '.join(modules))
+
+    initrd_metapkg = d.getVar('KERNEL_INITRD_MODULES_META_PACKAGE')
+    initrd_module_regex = re.compile(d.getVar('KERNEL_INITRD_MODULES_REGEX'))
+    initrd_modules = []
+    for module in modules:
+        files = d.getVar('FILES:' + module)
+        m = re.match(initrd_module_regex, files)
+        if m:
+            initrd_modules.append(module)
+
+    if initrd_modules:
+        d.appendVar('RDEPENDS:' + initrd_metapkg, ' '+' '.join(initrd_modules))
 }
 
 do_package[vardeps] += '${@" ".join(map(lambda s: "module_conf_" + s, (d.getVar("KERNEL_MODULE_PROBECONF") or "").split()))}'
meta/classes-recipe/kernel.bbclass +4 -1
index 64a685a964..8fda61574d 100644
@@ -695,13 +695,14 @@ EXPORT_FUNCTIONS do_compile do_transform_kernel do_transform_bundled_initramfs d
 
 # kernel-base becomes kernel-${KERNEL_VERSION}
 # kernel-image becomes kernel-image-${KERNEL_VERSION}
-PACKAGES = "${KERNEL_PACKAGE_NAME} ${KERNEL_PACKAGE_NAME}-base ${KERNEL_PACKAGE_NAME}-vmlinux ${KERNEL_PACKAGE_NAME}-image ${KERNEL_PACKAGE_NAME}-dev ${KERNEL_PACKAGE_NAME}-modules ${KERNEL_PACKAGE_NAME}-dbg"
+PACKAGES = "${KERNEL_PACKAGE_NAME} ${KERNEL_PACKAGE_NAME}-base ${KERNEL_PACKAGE_NAME}-vmlinux ${KERNEL_PACKAGE_NAME}-image ${KERNEL_PACKAGE_NAME}-dev ${KERNEL_PACKAGE_NAME}-modules ${KERNEL_PACKAGE_NAME}-initrd-modules ${KERNEL_PACKAGE_NAME}-dbg"
 FILES:${PN} = ""
 FILES:${KERNEL_PACKAGE_NAME}-base = "${nonarch_base_libdir}/modules/${KERNEL_VERSION}/modules.order ${nonarch_base_libdir}/modules/${KERNEL_VERSION}/modules.builtin ${nonarch_base_libdir}/modules/${KERNEL_VERSION}/modules.builtin.modinfo"
 FILES:${KERNEL_PACKAGE_NAME}-image = ""
 FILES:${KERNEL_PACKAGE_NAME}-dev = "/${KERNEL_IMAGEDEST}/System.map* /${KERNEL_IMAGEDEST}/Module.symvers* /${KERNEL_IMAGEDEST}/config* ${KERNEL_SRC_PATH} ${nonarch_base_libdir}/modules/${KERNEL_VERSION}/build"
 FILES:${KERNEL_PACKAGE_NAME}-vmlinux = "/${KERNEL_IMAGEDEST}/vmlinux-${KERNEL_VERSION_NAME}"
 FILES:${KERNEL_PACKAGE_NAME}-modules = ""
+FILES:${KERNEL_PACKAGE_NAME}-initrd-modules = ""
 FILES:${KERNEL_PACKAGE_NAME}-dbg = "/usr/lib/debug /usr/src/debug"
 RDEPENDS:${KERNEL_PACKAGE_NAME} = "${KERNEL_PACKAGE_NAME}-base (= ${EXTENDPKGV})"
 # Allow machines to override this dependency if kernel image files are
@@ -716,7 +717,9 @@ ALLOW_EMPTY:${KERNEL_PACKAGE_NAME} = "1"
 ALLOW_EMPTY:${KERNEL_PACKAGE_NAME}-base = "1"
 ALLOW_EMPTY:${KERNEL_PACKAGE_NAME}-image = "1"
 ALLOW_EMPTY:${KERNEL_PACKAGE_NAME}-modules = "1"
+ALLOW_EMPTY:${KERNEL_PACKAGE_NAME}-initrd-modules = "1"
 DESCRIPTION:${KERNEL_PACKAGE_NAME}-modules = "Kernel modules meta package"
+DESCRIPTION:${KERNEL_PACKAGE_NAME}-initrd-modules = "Kernel initrd modules meta package"
 
 pkg_postinst:${KERNEL_PACKAGE_NAME}-base () {
 	if [ ! -e "$D/lib/modules/${KERNEL_VERSION}" ]; then
meta/classes-recipe/module.bbclass +37 -0
index f2f0b25a2d..51f864f1f9 100644
@@ -86,3 +86,40 @@ EXPORT_FUNCTIONS do_compile do_install
 KERNEL_MODULES_META_PACKAGE = "${PN}"
 FILES:${PN} = ""
 ALLOW_EMPTY:${PN} = "1"
+
+# subset of kernel modules needed in initrd, to e.g. mount rootfs from block device
+KERNEL_INITRD_MODULES_META_PACKAGE ?= "${@ d.getVar("KERNEL_PACKAGE_NAME") or "kernel" }-initrd-modules"
+
+# match regex to path or file name. E.g. include all drivers with files in path /drivers/ata/
+KERNEL_INITRD_MODULES_REGEX ?= "(.*)(\
+/drivers/acpi/|\
+/drivers/ata/|\
+/drivers/block/|\
+/drivers/cdrom/|\
+/drivers/char/hw_random/|\
+/drivers/char/tpm/|\
+/drivers/char/|\
+/drivers/crypto/|\
+/drivers/dax/|\
+/drivers/firmware/arm_scmi/|\
+/drivers/gpu/drm/|\
+/drivers/md/|\
+/drivers/mmc/|\
+/drivers/mtd/|\
+/drivers/nvdimm/|\
+/drivers/nvme/|\
+/drivers/pci/|\
+/drivers/scsi/|\
+/drivers/tee/|\
+/drivers/tty/serial/|\
+/drivers/virtio/|\
+/drivers/watchdog/|\
+/kernel/arch/|\
+/kernel/block/|\
+/kernel/crypto/|\
+/kernel/fs/|\
+/kernel/lib/\
+)(.*)"
+
+FILES:${PN}-initrd = ""
+ALLOW_EMPTY:${PN}-initrd = "1"
Signature · 1 line
2.43.0
#4 lore raw

PATCH 5/6 core-image-initramfs-boot: add option to build systemd based initrd

In reply to Mikko Rapeli

If "systemd-initramfs" is in DISTRO_FEATURES then convert core-image-initramfs-boot from shell scripts to systemd. The resulting initramfs is much bigger than shell script one but supports much more features like disk encryption and TPM devices. Also includes udev which can load any drivers needed to mount rootfs. Uses kernel-initrd-modules meta package to install a subset of kernel modules needed for mounting rootfs on multiple platforms.

---
 .../images/core-image-initramfs-boot.bb       | 28 +++++++++++++++++--
 1 file changed, 25 insertions(+), 3 deletions(-)
meta/recipes-core/images/core-image-initramfs-boot.bb +25 -3
index 7258944751..215d32fd3d 100644
@@ -4,7 +4,31 @@ LICENSE = "MIT"
 
 INITRAMFS_SCRIPTS ?= "initramfs-framework-base initramfs-module-udev"
 
-PACKAGE_INSTALL = "${INITRAMFS_SCRIPTS} ${VIRTUAL-RUNTIME_base-utils} base-passwd"
+inherit image
+
+PACKAGE_INSTALL = " \
+    ${VIRTUAL-RUNTIME_base-utils} \
+    ${@bb.utils.contains('DISTRO_FEATURES', 'systemd-initramfs', ' \
+        base-files \
+        coreutils \
+        e2fsprogs-mke2fs \
+        kernel-initrd-modules \
+        os-release-initrd \
+        util-linux-blkid \
+        util-linux-mount \
+        util-linux-umount \
+        ${VIRTUAL-RUNTIME_init_manager} \
+        ${VIRTUAL-RUNTIME_dev_manager} \
+    ', '${INITRAMFS_SCRIPTS}', d)} \
+    base-passwd \
+"
+
+# reduce size
+NO_RECOMMENDATIONS = "1"
+
+# don't install automatically, pick manually instead
+MACHINE_EXTRA_RDEPENDS = ""
+MACHINE_EXTRA_RRECOMMENDS = ""
 
 # Ensure the initramfs only contains the bare minimum
 IMAGE_FEATURES = ""
@@ -18,5 +42,3 @@ IMAGE_FSTYPES = "${INITRAMFS_FSTYPES}"
 IMAGE_NAME_SUFFIX ?= ""
 IMAGE_ROOTFS_SIZE = "8192"
 IMAGE_ROOTFS_EXTRA_SPACE = "0"
-
-inherit image
Signature · 1 line
2.43.0
#5 lore raw

PATCH 6/6 oeqa selftest uki.py: add aarch64/arm test with systemd based initrd

In reply to Mikko Rapeli

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.

---
 meta/lib/oeqa/selftest/cases/uki.py | 76 +++++++++++++++++++++++++++++
 1 file changed, 76 insertions(+)
meta/lib/oeqa/selftest/cases/uki.py +76 -0
index 9a1aa4e269..4830fb3403 100644
@@ -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))
Signature · 1 line
2.43.0
#6 lore raw

PATCH v2 1/6 systemd: use serial-getty-generator on genericarm64

In reply to Mikko Rapeli

systemd-serialgetty recipe sets serial consoles based on SERIAL_CONSOLES build time variable. These fail to be detected on multiple devices including qemu and the resulting failures delay boot to systemd "running" state by one minute on an example aarch64 build machine and qemu. Serial console login works with both since udev will trigger agetty on correct devices. Using systemd side serial-getty-generator disables systemd-serialgetty.

qemu-system-aarch64 core-image-base boot time with systemd-serialgetty before this patch:

$ systemd-analyze
Startup finished in 8.314s (firmware) + 9.805s (loader) + 14.338s (kernel) + 1min 34.392s (userspace) = 2min 6.851s
multi-user.target reached after 1min 34.387s in userspace.

with this patch:

Startup finished in 8.312s (firmware) + 9.804s (loader) + 14.295s (kernel) + 29.808s (userspace) = 1min 2.220s multi-user.target reached after 29.802s in userspace.

---
 meta-yocto-bsp/recipes-core/systemd/systemd_%.bbappend | 3 +++
 1 file changed, 3 insertions(+)
 create mode 100644 meta-yocto-bsp/recipes-core/systemd/systemd_%.bbappend

v1: https://lists.yoctoproject.org/g/poky/message/13522

meta-yocto-bsp/recipes-core/systemd/systemd_%.bbappend new file +3 -0
new file mode 100644
index 0000000000..f23852a351
@@ -0,0 +1,3 @@
+# auto detection instead of build time configured via SERIAL_CONSOLES
+# to support multiple devices
+PACKAGECONFIG:append:genericarm64 = " serial-getty-generator"
Signature · 1 line
2.43.0
#7 lore raw

Patchtest results for [PATCH v2 1/6] systemd: use serial-getty-generator on genericarm64

Thank you for your submission. Patchtest identified one or more issues with the patch. Please see the log below for more information:

---
Testing patch /home/patchtest/share/mboxes/v2-1-6-systemd-use-serial-getty-generator-on-genericarm64.patch

FAIL: test target mailing list: Series sent to the wrong mailing list or some patches from the series correspond to different mailing lists (test_mbox.TestMbox.test_target_mailing_list)

PASS: test Signed-off-by presence (test_mbox.TestMbox.test_signed_off_by_presence)
PASS: test author valid (test_mbox.TestMbox.test_author_valid)
PASS: test commit message presence (test_mbox.TestMbox.test_commit_message_presence)
PASS: test commit message user tags (test_mbox.TestMbox.test_commit_message_user_tags)
PASS: test max line length (test_metadata.TestMetadata.test_max_line_length)
PASS: test mbox format (test_mbox.TestMbox.test_mbox_format)
PASS: test non-AUH upgrade (test_mbox.TestMbox.test_non_auh_upgrade)
PASS: test shortlog format (test_mbox.TestMbox.test_shortlog_format)
PASS: test shortlog length (test_mbox.TestMbox.test_shortlog_length)

SKIP: pretest pylint: No python related patches, skipping test (test_python_pylint.PyLint.pretest_pylint)
SKIP: pretest src uri left files: No modified recipes, skipping pretest (test_metadata.TestMetadata.pretest_src_uri_left_files)
SKIP: test CVE check ignore: No modified recipes or older target branch, skipping test (test_metadata.TestMetadata.test_cve_check_ignore)
SKIP: test CVE tag format: No new CVE patches introduced (test_patch.TestPatch.test_cve_tag_format)
SKIP: test Signed-off-by presence: No new CVE patches introduced (test_patch.TestPatch.test_signed_off_by_presence)
SKIP: test Upstream-Status presence: No new CVE patches introduced (test_patch.TestPatch.test_upstream_status_presence_format)
SKIP: test bugzilla entry format: No bug ID found (test_mbox.TestMbox.test_bugzilla_entry_format)
SKIP: test lic files chksum modified not mentioned: No modified recipes, skipping test (test_metadata.TestMetadata.test_lic_files_chksum_modified_not_mentioned)
SKIP: test lic files chksum presence: No added recipes, skipping test (test_metadata.TestMetadata.test_lic_files_chksum_presence)
SKIP: test license presence: No added recipes, skipping test (test_metadata.TestMetadata.test_license_presence)
SKIP: test pylint: No python related patches, skipping test (test_python_pylint.PyLint.test_pylint)
SKIP: test series merge on head: Merge test is disabled for now (test_mbox.TestMbox.test_series_merge_on_head)
SKIP: test src uri left files: No modified recipes, skipping pretest (test_metadata.TestMetadata.test_src_uri_left_files)
SKIP: test summary presence: No added recipes, skipping test (test_metadata.TestMetadata.test_summary_presence)

---

Please address the issues identified and
submit a new revision of the patch, or alternatively, reply to this email with an explanation of why the patch should be accepted. If you believe these results are due to an error in patchtest, please submit a bug at https://bugzilla.yoctoproject.org/ (use the 'Patchtest' category under 'Yocto Project Subprojects'). For more information on specific failures, see: https://wiki.yoctoproject.org/wiki/Patchtest. Thank you!

#8 lore raw
In reply to Mikko Rapeli

Note that the feature freeze is now. This has to wait.

Alex

Quoted 55 lines · Mikko Rapeli via lists.openembedded.org

systemd based initrd supports more security, encryption etc features than custom shell script ones but oe-core lacks support for it. Convert core-image-initramfs-boot to create systemd based initrd if "systemd-initramfs" is set in DISTRO_FEATURES. Includes a test for this initrd to mount rootfs via Unified Kernel Image uki.py.

Sadly the boot time is really slow, e.g. over 30 seconds with systemd based initrd. One of the major reasons is the large amount of kernel modules built into the linux-yocto kernel and processing of their udev events in userspace. Thus add kernel-initrd-modules meta package to easily install subset of all kernel modules to initrd. The subset supports "mount rootfs from any block device" but doesn't include graphics, UBS etc support. Without this generated meta package, initrd recipe needs to manually define which exact kernel modules to include which breaks if those modules are built into the kernel. Thus the initrd becomes machine and kernel config specific and hard to maintain. With this meta package a generic initrd can be created.

Separate changes to linux-yocto compile a lot more drivers as modules but they depend on these initrd changes.

Mikko Rapeli (6):
systemd: use serial-getty-generator on genericarm64
systemd: enable efi support if in MACHINE_FEATURES too uki.bbclass: drop serial console from kernel command line kernel.bbclass: add kernel-initrd-modules meta package
core-image-initramfs-boot: add option to build systemd based initrd oeqa selftest uki.py: add aarch64/arm test with systemd based initrd

 .../recipes-core/systemd/systemd_%.bbappend   |  3 +
 .../kernel-module-split.bbclass               | 46 +++++++++++
 meta/classes-recipe/kernel.bbclass            |  5 +-
 meta/classes-recipe/module.bbclass            | 37 +++++++++
 meta/classes-recipe/uki.bbclass               |  2 +-
 meta/lib/oeqa/selftest/cases/uki.py           | 76 +++++++++++++++++++
 .../images/core-image-initramfs-boot.bb       | 28 ++++++-
 meta/recipes-core/systemd/systemd_257.3.bb    |  1 +
 8 files changed, 193 insertions(+), 5 deletions(-)
 create mode 100644 meta-yocto-bsp/recipes-core/systemd/systemd_%.bbappend

--
2.43.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#212832): https://lists.openembedded.org/g/openembedded-core/message/212832
Mute This Topic: https://lists.openembedded.org/mt/111696849/1686489
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#9 lore raw

Hi,

Quoted 1 line · Alexander Kanavin

Note that the feature freeze is now. This has to wait.

Yes, I'm aware. Just posted this out as it is 'done' on my side and need feedback.

The kernel config change RFC is also out but that in current form breaks things so need feedback how this could be fixed, for example in specific machines configure features to compile as modules, and/or which usecases must work with the single kernel binary without initrd.

Cheers,

-Mikko

Quoted 59 lines

Alex

Quoted 55 lines · Mikko Rapeli via lists.openembedded.org

systemd based initrd supports more security, encryption etc features than custom shell script ones but oe-core lacks support for it. Convert core-image-initramfs-boot to create systemd based initrd if "systemd-initramfs" is set in DISTRO_FEATURES. Includes a test for this initrd to mount rootfs via Unified Kernel Image uki.py.

Sadly the boot time is really slow, e.g. over 30 seconds with systemd based initrd. One of the major reasons is the large amount of kernel modules built into the linux-yocto kernel and processing of their udev events in userspace. Thus add kernel-initrd-modules meta package to easily install subset of all kernel modules to initrd. The subset supports "mount rootfs from any block device" but doesn't include graphics, UBS etc support. Without this generated meta package, initrd recipe needs to manually define which exact kernel modules to include which breaks if those modules are built into the kernel. Thus the initrd becomes machine and kernel config specific and hard to maintain. With this meta package a generic initrd can be created.

Separate changes to linux-yocto compile a lot more drivers as modules but they depend on these initrd changes.

Mikko Rapeli (6):
systemd: use serial-getty-generator on genericarm64
systemd: enable efi support if in MACHINE_FEATURES too uki.bbclass: drop serial console from kernel command line kernel.bbclass: add kernel-initrd-modules meta package
core-image-initramfs-boot: add option to build systemd based initrd oeqa selftest uki.py: add aarch64/arm test with systemd based initrd

 .../recipes-core/systemd/systemd_%.bbappend   |  3 +
 .../kernel-module-split.bbclass               | 46 +++++++++++
 meta/classes-recipe/kernel.bbclass            |  5 +-
 meta/classes-recipe/module.bbclass            | 37 +++++++++
 meta/classes-recipe/uki.bbclass               |  2 +-
 meta/lib/oeqa/selftest/cases/uki.py           | 76 +++++++++++++++++++
 .../images/core-image-initramfs-boot.bb       | 28 ++++++-
 meta/recipes-core/systemd/systemd_257.3.bb    |  1 +
 8 files changed, 193 insertions(+), 5 deletions(-)
 create mode 100644 meta-yocto-bsp/recipes-core/systemd/systemd_%.bbappend

--
2.43.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#212832): https://lists.openembedded.org/g/openembedded-core/message/212832
Mute This Topic: https://lists.openembedded.org/mt/111696849/1686489
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#10 lore raw
In reply to Mikko Rapeli
Quoted 39 lines · Mikko Rapeli via lists.openembedded.org

systemd based initrd supports more security, encryption etc features than custom shell script ones but oe-core lacks support for it. Convert core-image-initramfs-boot to create systemd based initrd if "systemd-initramfs" is set in DISTRO_FEATURES. Includes a test for this initrd to mount rootfs via Unified Kernel Image uki.py.

Sadly the boot time is really slow, e.g. over 30 seconds with systemd based initrd. One of the major reasons is the large amount of kernel modules built into the linux-yocto kernel and processing of their udev events in userspace. Thus add kernel-initrd-modules meta package to easily install subset of all kernel modules to initrd. The subset supports "mount rootfs from any block device" but doesn't include graphics, UBS etc support. Without this generated meta package, initrd recipe needs to manually define which exact kernel modules to include which breaks if those modules are built into the kernel. Thus the initrd becomes machine and kernel config specific and hard to maintain. With this meta package a generic initrd can be created.

Separate changes to linux-yocto compile a lot more drivers as modules but they depend on these initrd changes.

Mikko Rapeli (6):
  systemd: use serial-getty-generator on genericarm64
  systemd: enable efi support if in MACHINE_FEATURES too uki.bbclass: drop serial console from kernel command line kernel.bbclass: add kernel-initrd-modules meta package
  core-image-initramfs-boot: add option to build systemd based initrd oeqa selftest uki.py: add aarch64/arm test with systemd based initrd

 .../recipes-core/systemd/systemd_%.bbappend   |  3 + .../kernel-module-split.bbclass               | 46 +++++++++++ meta/classes-recipe/kernel.bbclass            |  5 +- meta/classes-recipe/module.bbclass            | 37 +++++++++ meta/classes-recipe/uki.bbclass               |  2 +- meta/lib/oeqa/selftest/cases/uki.py           | 76 +++++++++++++++++++ .../images/core-image-initramfs-boot.bb       | 28 ++++++- meta/recipes-core/systemd/systemd_257.3.bb    |  1 +

Quoted 2 lines
 8 files changed, 193 insertions(+), 5 deletions(-)

 create mode 100644 meta-yocto-bsp/recipes-core/systemd/systemd_%.bbappend

Unfortunately this series seemed to result in oe-selftest failures on both aarch64 and x86-64:

https://autobuilder.yoctoproject.org/valkyrie/#/builders/23/builds/1242
https://autobuilder.yoctoproject.org/valkyrie/#/builders/48/builds/1110/steps/14/logs/stdio

Cheers,

Richard

#11 lore raw

Hi,

Quoted 43 lines · Richard Purdie
Quoted 31 lines · Mikko Rapeli via lists.openembedded.org

systemd based initrd supports more security, encryption etc features than custom shell script ones but oe-core lacks support for it. Convert core-image-initramfs-boot to create systemd based initrd if "systemd-initramfs" is set in DISTRO_FEATURES. Includes a test for this initrd to mount rootfs via Unified Kernel Image uki.py.

Sadly the boot time is really slow, e.g. over 30 seconds with systemd based initrd. One of the major reasons is the large amount of kernel modules built into the linux-yocto kernel and processing of their udev events in userspace. Thus add kernel-initrd-modules meta package to easily install subset of all kernel modules to initrd. The subset supports "mount rootfs from any block device" but doesn't include graphics, UBS etc support. Without this generated meta package, initrd recipe needs to manually define which exact kernel modules to include which breaks if those modules are built into the kernel. Thus the initrd becomes machine and kernel config specific and hard to maintain. With this meta package a generic initrd can be created.

Separate changes to linux-yocto compile a lot more drivers as modules but they depend on these initrd changes.

Mikko Rapeli (6):
� systemd: use serial-getty-generator on genericarm64
� systemd: enable efi support if in MACHINE_FEATURES too � uki.bbclass: drop serial console from kernel command line � kernel.bbclass: add kernel-initrd-modules meta package � core-image-initramfs-boot: add option to build systemd based initrd � oeqa selftest uki.py: add aarch64/arm test with systemd based initrd

Quoted 10 lines

�.../recipes-core/systemd/systemd_%.bbappend�� |� 3 + �.../kernel-module-split.bbclass�������������� | 46 +++++++++++ �meta/classes-recipe/kernel.bbclass����������� |� 5 +- �meta/classes-recipe/module.bbclass����������� | 37 +++++++++ �meta/classes-recipe/uki.bbclass�������������� |� 2 +- �meta/lib/oeqa/selftest/cases/uki.py���������� | 76 +++++++++++++++++++ �.../images/core-image-initramfs-boot.bb������ | 28 ++++++- �meta/recipes-core/systemd/systemd_257.3.bb��� |� 1 +
�8 files changed, 193 insertions(+), 5 deletions(-)
�create mode 100644 meta-yocto-bsp/recipes-core/systemd/systemd_%.bbappend

Quoted 5 lines

Unfortunately this series seemed to result in oe-selftest failures on both aarch64 and x86-64:

https://autobuilder.yoctoproject.org/valkyrie/#/builders/23/builds/1242
https://autobuilder.yoctoproject.org/valkyrie/#/builders/48/builds/1110/steps/14/logs/stdio

Thanks, I will investigate these. I ran into various issues when executing selftests on my aarch64 build machine.

Is the basehash error related to this series or something else?

https://autobuilder.yoctoproject.org/valkyrie/api/v2/logs/1782873/raw_inline

stdio: ERROR: When reparsing /tmp/selftest-fetchoxfe4t0p/test.bb:do_checkuri, the basehash value changed from 84b9e23a83a764e7a5d8a96ee523199e2b1c604f4280a45030e248de0ff52962 to 4123da244f465feffecb2b4fd2b132b64851981ec2fb70bf9445df8b0ea6a69e. The metadata is not deterministic and this needs to be fixed.
stdio: ERROR: The following commands may help:
stdio: ERROR: $ bitbake test -cdo_checkuri -Snone
stdio: ERROR: Then:
stdio: ERROR: $ bitbake test -cdo_checkuri -Sprintdiff
stdio: ERROR: When reparsing /tmp/selftest-fetchoxfe4t0p/test.bb:do_fetch, the basehash value changed from 6d55d6743729b615749dc016857d7e5f9c884a8b92f0d57f68e743f4910333d3 to fa7d6ea0563b60362418d2a6c5e41a6684183d01ec578b65abd0c64a9cfba7cf. The metadata is not deterministic and this needs to be fixed.
...

There are a lot of these.

If there are any boot failures in qemu then I will have a look. The changes were not supposed to change existing rootfs or initrd images. The new test in uki.py may fail on some configurations which I did no manage to test.
Maybe "uki.bbclass: drop serial console from kernel command line" is breaking serial console prompt on some machines. I'll try to reproduce.

Did the test run contain the linux-yocto changes which build a lot of kernel drivers as modules? I don't think that is ready for AB testing yet, hence RFC in
https://lists.yoctoproject.org/g/linux-yocto/message/14866
The changes were sent out in-reply-to this thread so it's possible some tool picked them up. That could explain shell script based initrd boot error message:

ERROR: There's no '/dev' on rootfs.

Cheers,

-Mikko

#12 lore raw
Quoted 67 lines · Mikko Rapeli

Hi,

Quoted 43 lines · Richard Purdie
Quoted 39 lines · Mikko Rapeli via lists.openembedded.org

systemd based initrd supports more security, encryption etc features than custom shell script ones but oe-core lacks support for it. Convert core-image-initramfs-boot to create systemd based initrd if "systemd-initramfs" is set in DISTRO_FEATURES. Includes a test for this initrd to mount rootfs via Unified Kernel Image uki.py.

Sadly the boot time is really slow, e.g. over 30 seconds with systemd based initrd. One of the major reasons is the large amount of kernel modules built into the linux-yocto kernel and processing of their udev events in userspace. Thus add kernel-initrd-modules meta package to easily install subset of all kernel modules to initrd. The subset supports "mount rootfs from any block device" but doesn't include graphics, UBS etc support. Without this generated meta package, initrd recipe needs to manually define which exact kernel modules to include which breaks if those modules are built into the kernel. Thus the initrd becomes machine and kernel config specific and hard to maintain. With this meta package a generic initrd can be created.

Separate changes to linux-yocto compile a lot more drivers as modules but they depend on these initrd changes.

Mikko Rapeli (6):
  systemd: use serial-getty-generator on genericarm64
  systemd: enable efi support if in MACHINE_FEATURES too uki.bbclass: drop serial console from kernel command line kernel.bbclass: add kernel-initrd-modules meta package
  core-image-initramfs-boot: add option to build systemd based initrd oeqa selftest uki.py: add aarch64/arm test with systemd based initrd

 .../recipes-core/systemd/systemd_%.bbappend   |  3 + .../kernel-module-split.bbclass               | 46 +++++++++++ meta/classes-recipe/kernel.bbclass            |  5 +- meta/classes-recipe/module.bbclass            | 37 +++++++++ meta/classes-recipe/uki.bbclass               |  2 +- meta/lib/oeqa/selftest/cases/uki.py           | 76 +++++++++++++++++++ .../images/core-image-initramfs-boot.bb       | 28 ++++++- meta/recipes-core/systemd/systemd_257.3.bb    |  1 +

Quoted 2 lines
 8 files changed, 193 insertions(+), 5 deletions(-)

 create mode 100644 meta-yocto-bsp/recipes-core/systemd/systemd_%.bbappend

Quoted 5 lines

Unfortunately this series seemed to result in oe-selftest failures on both aarch64 and x86-64:

https://autobuilder.yoctoproject.org/valkyrie/#/builders/23/builds/1242
https://autobuilder.yoctoproject.org/valkyrie/#/builders/48/builds/1110/steps/14/logs/stdio

Thanks, I will investigate these. I ran into various issues when executing selftests on my aarch64 build machine.

Is the basehash error related to this series or something else?

https://autobuilder.yoctoproject.org/valkyrie/api/v2/logs/1782873/raw_inline

stdio: ERROR: When reparsing /tmp/selftest-fetchoxfe4t0p/test.bb:do_checkuri, the basehash value changed from 84b9e23a83a764e7a5d8a96ee523199e2b1c604f4280a45030e248de0ff52962 to 4123da244f465feffecb2b4fd2b132b64851981ec2fb70bf9445df8b0ea6a69e. The metadata is not deterministic and this needs to be fixed.
stdio: ERROR: The following commands may help:
stdio: ERROR: $ bitbake test -cdo_checkuri -Snone
stdio: ERROR: Then:
stdio: ERROR: $ bitbake test -cdo_checkuri -Sprintdiff
stdio: ERROR: When reparsing /tmp/selftest-fetchoxfe4t0p/test.bb:do_fetch, the basehash value changed from 6d55d6743729b615749dc016857d7e5f9c884a8b92f0d57f68e743f4910333d3 to fa7d6ea0563b60362418d2a6c5e41a6684183d01ec578b65abd0c64a9cfba7cf. The metadata is not deterministic and this needs to be fixed.
...

Quoted 1 line

There are a lot of these.

I don't remember anything in the branch that would do that. It is possible these are normal test output and only show up due to the other failures. The test output shows everything from that execution thread of selftest (due to the way python unittest parallelism was enabled).

Quoted 6 lines

If there are any boot failures in qemu then I will have a look. The changes were not supposed to change existing rootfs or initrd images. The new test in uki.py may fail on some configurations which I did no manage to test.
Maybe "uki.bbclass: drop serial console from kernel command line" is breaking serial console prompt on some machines. I'll try to reproduce.

Quoted 7 lines

Did the test run contain the linux-yocto changes which build a lot of kernel drivers as modules? I don't think that is ready for AB testing yet, hence RFC in
https://lists.yoctoproject.org/g/linux-yocto/message/14866
The changes were sent out in-reply-to this thread so it's possible some tool picked them up. That could explain shell script based initrd boot error message:

ERROR: There's no '/dev' on rootfs.

Those were not included.

Cheers,

Richard