mbox series

[meta-oe,v2,0/3] add support for building "system extension images"

Message ID 20250621-discoverable-disk-image-v2-0-52df3053fc1f@leica-geosystems.com
Headers show
Series add support for building "system extension images" | expand

Message

Johannes Schneider June 21, 2025, 8:46 p.m. UTC
This patch-stack adds support for building "system extension images" to meta-oe - to quote the man-page [1]:
"The primary use case for system images are immutable environments where debugging and development tools shall optionally be made available, but not included in the immutable base OS image itself (e.g. strace(1) and gdb(1) shall be an optionally installable addition in order to make debugging/development easier). System extension images should not be misunderstood as a generic software packaging framework, as no dependency scheme is available: system extensions should carry all files they need themselves, except for those already shipped in the underlying host system image. Typically, system extension images are built at the same time as the base OS image — within the same build system."

Link: https://www.freedesktop.org/software/systemd/man/latest/systemd-sysext.html

These patches are added to meta-oe - instead of oe-core - because systemd-repart-native requires 'cryptsetup' to build discoverable-disk-images with verity and optional signature partitions - and cryptsetup is currently only/still in meta-oe.

Note that erofs-utils and systemd-repart-native have to be of a recent version, to support features like compression and signing through PKCS#11 (e.g. as provided by the classes/signing.bbclass)

As an example consider this simple image recipe:
SUMMARY = "An example image to showcase a system extension image."
LICENSE = "MIT"
inherit discoverable-disk-image sysext-image
IMAGE_FEATURES = ""
IMAGE_LINGUAS = ""
IMAGE_INSTALL = "gdb"

After building, the resulting 'extension-image-example-*sysext.rootfs.ddi' can be deployed to an embedded system (running from a RO rootfs) and 'merged' into the OS by following steps:
place a symlink into the systemd-sysext image search path:
$> mkdir /run/extensions
$> ln -s /tmp/extension-example.sysext.ddi /run/extensions/example.raw
list all available extensions:
$> systemd-sysext list
and enable the found extensions:
$> SYSTEMD_LOG_LEVEL=debug systemd-sysext merge

---
Version history:
v1: initial submission
v2: extend inline documentation with examples and clarification
---

To: openembedded-devel@lists.openembedded.org
Cc: Enrico Jörns <ejo@pengutronix.de>
Cc: raj.khem@gmail.com
Cc: mikko.rapeli@linaro.org
Cc: erik@riscstar.com
Cc: bsp-development.geo@leica-geosystems.com

---
Johannes Schneider (3):
      systemd: add recipe for systemd-repart-native 257.6
      classes: add discoverable disk image class
      classes: add a systemd-sysext image class

 meta-oe/classes/discoverable-disk-image.bbclass    | 137 +++++++++++++++++++++
 meta-oe/classes/sysext-image.bbclass               |  87 +++++++++++++
 .../systemd/systemd-repart-native_257.6.bb         |  59 +++++++++
 3 files changed, 283 insertions(+)
---
base-commit: 820047afe48a0d48056f4752defc3d2803c9d906
change-id: 20250621-discoverable-disk-image-961a7759b146

Best regards,