Skip to contentSkip to conversation

systemd: add packageconfigs for storage optimisation

PATCH In review Tan Siewert 3 participants 9 messages Oct 23 – Oct 28

lore
Share & tools
lore
#0 lore raw

cover systemd: add packageconfigs for storage optimisation

While investigating the storage usage in OpenBMC I noticed that several features are enabled by default because their meson options default to true or because they use .allowed() instead of .enabled() for the validation. This pollutes the storage which is expensive on some platforms (there are platforms that only have ~20 MiB for rofs).

This series adds packageconfigs for the features ukify, sysinstall, hwdb and fdisk.

ukify was enabled by default but only works on EFI systems. On non-EFI builds it will be disabled by default, but enabled by default when the efi DISTRO_FEATURE is set.

sysinstall is a neat feature that makes installation guidance easier, but for a lot of embedded systems it is just a waste of storage. It's not enabled by default as it has runtime dependencies on systemd-repart which weren't checked before. Enabling it by default would mean we'd have to enable OpenSSL and repart which does not seem viable to me.

For hwdb, it might be useful for systems that see PCI/USB/HID devices or for some laptops, but who needs ThinkPad keymaps on an ARM1176 SoC?

fdisk is recommended by libsystemd-shared, and disabling it drops util-linux-libfdisk. This is only required for sysupdate, repart and homed.

With all the changes I was able to free a significant amount of storage again (the hwdb alone was ~9 MiB uncompressed).

I've tested my changes with qemux86-64 by building systemd with the default configuration and with fdisk off, hwdb off, sysinstall on (with and without repart), ukify on, and with the efi DISTRO_FEATURE (with and without ukify), then checked the resulting packages, shipped binaries and RRECOMMENDS.
Enabling repart or homed without fdisk fails at parse time as expected.

The testimage with default and hwdb-off + usbutils configuration booted and passed the default tests.

---
Tan Siewert (4):
systemd: add ukify packageconfig
systemd: add sysinstall packageconfig
systemd: add hwdb packageconfig
systemd: add fdisk packageconfig

 meta/recipes-core/systemd/systemd_262.bb | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

---
base-commit: ae5cafacec8e99c5a27fa5b3b378eefc595910ef
change-id: 20261021-systemd-optimisations-dae99d91e807

Best regards,

Signature · 1 line
Tan Siewert <[email protected]>
#1 lore raw

PATCH 1/4 systemd: add ukify packageconfig

systemd gates ukify via allowed(), so it is built and installed unless explicitly disabled.

Add a packageconfig option that is enabled by default when the efi DISTRO_FEATURE is set. It can still be removed if wanted, which may be useful when using meta-tpm, which may include ukify implicitly.

---
 meta/recipes-core/systemd/systemd_262.bb | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
meta/recipes-core/systemd/systemd_262.bb +3 -1
index d70053182f..24797e2e08 100644
@@ -52,6 +52,7 @@ PACKAGECONFIG ??= " \
     ${@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)} \
+    ${@bb.utils.contains('DISTRO_FEATURES', 'efi', 'ukify', '', d)} \
     link-udev-shared \
     backlight \
     binfmt \
@@ -197,6 +198,7 @@ PACKAGECONFIG[set-time-epoch] = "${@build_epoch(d)},-Dtime-epoch=0"
 PACKAGECONFIG[timedated] = "-Dtimedated=true,-Dtimedated=false"
 PACKAGECONFIG[timesyncd] = "-Dtimesyncd=true,-Dtimesyncd=false"
 PACKAGECONFIG[sbinmerge] = "-Dsplit-bin=false,-Dsplit-bin=true"
+PACKAGECONFIG[ukify] = "-Dukify=enabled,-Dukify=disabled"
 PACKAGECONFIG[userdb] = "-Duserdb=true,-Duserdb=false"
 PACKAGECONFIG[utmp] = "-Dutmp=true,-Dutmp=false"
 PACKAGECONFIG[valgrind] = "-DVALGRIND=1,,valgrind"
@@ -405,7 +407,7 @@ PACKAGE_BEFORE_PN += "\
     ${PN}-networkd \
     ${PN}-rpm-macros \
     ${PN}-udev-rules \
-    ${PN}-ukify \
+    ${@bb.utils.contains('PACKAGECONFIG', 'ukify', '${PN}-ukify', '', d)} \
     ${PN}-vconsole-setup \
     ${PN}-zsh-completion \
     libsystemd-shared \
Signature · 1 line
2.53.0
#2 lore raw

Re: [PATCH 1/4] systemd: add ukify packageconfig

Quoted 8 lines · Tan Siewert

systemd gates ukify via allowed(), so it is built and installed unless explicitly disabled.

Add a packageconfig option that is enabled by default when the efi DISTRO_FEATURE is set. It can still be removed if wanted, which may be useful when using meta-tpm, which may include ukify implicitly.

[snip]

meta/recipes-core/systemd/systemd_262.bb PACKAGE_BEFORE_PN += "\ · line 410

Quoted 6 lines
meta/recipes-core/systemd/systemd_262.bb +1 -1
@@ -405,7 +407,7 @@ PACKAGE_BEFORE_PN += "\
     ${PN}-networkd \
     ${PN}-rpm-macros \
     ${PN}-udev-rules \
-    ${PN}-ukify \
+    ${@bb.utils.contains('PACKAGECONFIG', 'ukify', '${PN}-ukify', '', d)} \

Does the package really need to be removed here? If it is empty then do_package should not create it. If there are still files that would otherwise end up in ${PN}-ukify then removing the package entry may cause them to be silently included in a later package.

Best regards,

Signature · 1 line
Paul Barker
#3 lore raw

Re: [PATCH 1/4] systemd: add ukify packageconfig

Quoted 12 lines · Paul Barker
Quoted 8 lines · Tan Siewert

systemd gates ukify via allowed(), so it is built and installed unless explicitly disabled.

Add a packageconfig option that is enabled by default when the efi DISTRO_FEATURE is set. It can still be removed if wanted, which may be useful when using meta-tpm, which may include ukify implicitly.

[snip]

Quoted 12 lines

meta/recipes-core/systemd/systemd_262.bb PACKAGE_BEFORE_PN += "\ · line 410

Quoted 6 lines
meta/recipes-core/systemd/systemd_262.bb +1 -1
@@ -405,7 +407,7 @@ PACKAGE_BEFORE_PN += "\
      ${PN}-networkd \
      ${PN}-rpm-macros \
      ${PN}-udev-rules \
-    ${PN}-ukify \
+    ${@bb.utils.contains('PACKAGECONFIG', 'ukify', '${PN}-ukify', '', d)} \

Does the package really need to be removed here? If it is empty then do_package should not create it. If there are still files that would otherwise end up in ${PN}-ukify then removing the package entry may cause them to be silently included in a later package.

Sorry for the late response.

Probably not. I may have overlooked it when checking the logs if do_package built an empty package or not (and I didn't think about the side-effects of it that you describe).

I'll remove the condition in v2.

Thanks!
Tan

#4 lore raw

PATCH 2/4 systemd: add sysinstall packageconfig

In reply to Tan Siewert

sysinstall is a system installer tool and is unnecessary on some embedded systems. It calls systemd-repart at runtime, but repart is not enabled by default, so the shipped tool could not work in the default configuration anyway.

Add a packageconfig option, disabled by default, and warn when it is enabled without repart.

---
 meta/recipes-core/systemd/systemd_262.bb | 4 ++++
 1 file changed, 4 insertions(+)
meta/recipes-core/systemd/systemd_262.bb +4 -0
index 24797e2e08..60d8ed00d5 100644
@@ -188,6 +188,7 @@ PACKAGECONFIG[seccomp] = "-Dseccomp=enabled,-Dseccomp=disabled,libseccomp"
 PACKAGECONFIG[selinux] = "-Dselinux=enabled,-Dselinux=disabled,libselinux,initscripts-sushell"
 PACKAGECONFIG[smack] = "-Dsmack=true,-Dsmack=false"
 PACKAGECONFIG[sysext] = "-Dsysext=true, -Dsysext=false"
+PACKAGECONFIG[sysinstall] = "-Dsysinstall=true,-Dsysinstall=false"
 PACKAGECONFIG[sysusers] = "-Dsysusers=true,-Dsysusers=false"
 # When enabled use reproducible build timestamp if set as time epoch,
 # or build time if not. When disabled, time epoch is unset.
@@ -871,6 +872,9 @@ python __anonymous() {
 
     if bb.utils.contains('PACKAGECONFIG', 'homed', True, False, d) and not bb.utils.contains('PACKAGECONFIG', 'userdb openssl cryptsetup', True, False, d):
         bb.error("PACKAGECONFIG[homed] requires PACKAGECONFIG[userdb], PACKAGECONFIG[openssl] and PACKAGECONFIG[cryptsetup]")
+
+    if bb.utils.contains('PACKAGECONFIG', 'sysinstall', True, False, d) and not bb.utils.contains('PACKAGECONFIG', 'repart', True, False, d):
+        bb.warn("PACKAGECONFIG[sysinstall] may call commands from PACKAGECONFIG[repart]. Consider adding it")
 }
 
 ALTERNATIVE:${PN} = "halt reboot shutdown poweroff \
Signature · 1 line
2.53.0
#5 lore raw

PATCH 3/4 systemd: add hwdb packageconfig

In reply to Tan Siewert

The hwdb is not that useful on embedded devices which may never see HID or PCI devices, and it uses a fair amount of storage.

Add a packageconfig option which is enabled by default and only recommends udev-hwdb when it is enabled. usbutils and similar only RRECOMMEND it, so disabling it does not break them.

---
 meta/recipes-core/systemd/systemd_262.bb | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
meta/recipes-core/systemd/systemd_262.bb +3 -1
index 60d8ed00d5..03f4e049d5 100644
@@ -60,6 +60,7 @@ PACKAGECONFIG ??= " \
     gshadow \
     hibernate \
     hostnamed \
+    hwdb \
     idn \
     ima \
     kmod \
@@ -138,6 +139,7 @@ PACKAGECONFIG[homed] = "-Dhomed=enabled,-Dhomed=disabled"
 PACKAGECONFIG[gshadow] = "-Dgshadow=true,-Dgshadow=false"
 PACKAGECONFIG[hibernate] = "-Dhibernate=true,-Dhibernate=false"
 PACKAGECONFIG[hostnamed] = "-Dhostnamed=true,-Dhostnamed=false"
+PACKAGECONFIG[hwdb] = "-Dhwdb=true,-Dhwdb=false"
 PACKAGECONFIG[idn] = "-Didn=true,-Didn=false"
 PACKAGECONFIG[ima] = "-Dima=true,-Dima=false"
 # importd requires journal-upload/xz/zlib/bzip2/gcrypt
@@ -759,7 +761,7 @@ RDEPENDS:${PN} += "systemd-serialgetty"
 RDEPENDS:${PN} += "volatile-binds"
 
 RRECOMMENDS:${PN} += "${PN}-extra-utils \
-                      udev-hwdb \
+                      ${@bb.utils.contains('PACKAGECONFIG', 'hwdb', 'udev-hwdb', '', d)} \
                       e2fsprogs-e2fsck \
                       kernel-module-autofs4 kernel-module-unix kernel-module-ipv6 kernel-module-sch-fq-codel \
                       os-release \
Signature · 1 line
2.53.0
#6 lore raw

PATCH 4/4 systemd: add fdisk packageconfig

In reply to Tan Siewert

libfdisk is used only by repart, homed and sysupdate, but as a dlopen dependency of libsystemd-shared it always adds an RRECOMMENDS entry for util-linux-libfdisk, even when none of those features are enabled.

Add a packageconfig option and make repart and homed require it, as they would otherwise fail. sysupdate is auto-detected and silently dropped when fdisk is disabled.

---
 meta/recipes-core/systemd/systemd_262.bb | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
meta/recipes-core/systemd/systemd_262.bb +6 -4
index 03f4e049d5..65c6ce141d 100644
@@ -57,6 +57,7 @@ PACKAGECONFIG ??= " \
     backlight \
     binfmt \
     coredump \
+    fdisk \
     gshadow \
     hibernate \
     hostnamed \
@@ -131,6 +132,7 @@ PACKAGECONFIG[default-compression-xz] = "-Dxz=true -Ddefault-compression=xz,,xz"
 PACKAGECONFIG[default-compression-zstd] = "-Dzstd=true -Ddefault-compression=zstd,,zstd"
 PACKAGECONFIG[efi] = "-Defi=true -Dbootloader=enabled,-Defi=false -Dbootloader=disabled,python3-pyelftools-native"
 PACKAGECONFIG[elfutils] = "-Delfutils=enabled,-Delfutils=disabled,elfutils"
+PACKAGECONFIG[fdisk] = "-Dfdisk=enabled,-Dfdisk=disabled"
 PACKAGECONFIG[fido] = "-Dlibfido2=enabled,-Dlibfido2=disabled,libfido2-initial"
 PACKAGECONFIG[firstboot] = "-Dfirstboot=true,-Dfirstboot=false"
 PACKAGECONFIG[repart] = "-Drepart=enabled,-Drepart=disabled"
@@ -869,11 +871,11 @@ python __anonymous() {
     if bb.utils.contains('DISTRO_FEATURES', 'systemd-resolved', True, False, d) and not bb.utils.contains('PACKAGECONFIG', 'nss-resolve resolved', True, False, d):
         bb.error("DISTRO_FEATURES[systemd-resolved] requires PACKAGECONFIG[nss-resolve, resolved]")
 
-    if bb.utils.contains('PACKAGECONFIG', 'repart', True, False, d) and not bb.utils.contains('PACKAGECONFIG', 'openssl', True, False, d):
-        bb.error("PACKAGECONFIG[repart] requires PACKAGECONFIG[openssl]")
+    if bb.utils.contains('PACKAGECONFIG', 'repart', True, False, d) and not bb.utils.contains('PACKAGECONFIG', 'openssl fdisk', True, False, d):
+        bb.error("PACKAGECONFIG[repart] requires PACKAGECONFIG[openssl] and PACKAGECONFIG[fdisk]")
 
-    if bb.utils.contains('PACKAGECONFIG', 'homed', True, False, d) and not bb.utils.contains('PACKAGECONFIG', 'userdb openssl cryptsetup', True, False, d):
-        bb.error("PACKAGECONFIG[homed] requires PACKAGECONFIG[userdb], PACKAGECONFIG[openssl] and PACKAGECONFIG[cryptsetup]")
+    if bb.utils.contains('PACKAGECONFIG', 'homed', True, False, d) and not bb.utils.contains('PACKAGECONFIG', 'userdb openssl cryptsetup fdisk', True, False, d):
+        bb.error("PACKAGECONFIG[homed] requires PACKAGECONFIG[userdb], PACKAGECONFIG[openssl], PACKAGECONFIG[cryptsetup] and PACKAGECONFIG[fdisk]")
 
     if bb.utils.contains('PACKAGECONFIG', 'sysinstall', True, False, d) and not bb.utils.contains('PACKAGECONFIG', 'repart', True, False, d):
         bb.warn("PACKAGECONFIG[sysinstall] may call commands from PACKAGECONFIG[repart]. Consider adding it")
Signature · 1 line
2.53.0
#7 lore raw
In reply to Tan Siewert

Hi Tan,

Thanks for sharing the patch series.

Just wanted to mention that I've submitted a patch upgrading the systemd-related recipes from 262 to 262.1 to the OE-Core mailing list.

I noticed that your series also modifies systemd_262.bb, so there may be some overlap depending on the order in which the patches merge.

Just wanted to flag this for coordination.

Best,
Sai Sireesha T
Linux Engineer - Sys
OSS Platform Group
[cid:ac596a5b-203e-457d-afd1-523c98823918]

________________________________
From: Tan Siewert <[email protected]>
Sent: Friday, October 23, 2026 5:51 AM
To: [email protected] <[email protected]>
Cc: Tirumala Pudi, Sai Sireesha <[email protected]>; Patrick Williams <[email protected]>; Tan Siewert <[email protected]>
Subject: [PATCH 0/4] systemd: add packageconfigs for storage optimisation

CAUTION: This email comes from a non Wind River email account!
Do not click links or open attachments unless you recognize the sender and know the content is safe.

While investigating the storage usage in OpenBMC I noticed that several features are enabled by default because their meson options default to true or because they use .allowed() instead of .enabled() for the validation. This pollutes the storage which is expensive on some platforms (there are platforms that only have ~20 MiB for rofs).

This series adds packageconfigs for the features ukify, sysinstall, hwdb and fdisk.

ukify was enabled by default but only works on EFI systems. On non-EFI builds it will be disabled by default, but enabled by default when the efi DISTRO_FEATURE is set.

sysinstall is a neat feature that makes installation guidance easier, but for a lot of embedded systems it is just a waste of storage. It's not enabled by default as it has runtime dependencies on systemd-repart which weren't checked before. Enabling it by default would mean we'd have to enable OpenSSL and repart which does not seem viable to me.

For hwdb, it might be useful for systems that see PCI/USB/HID devices or for some laptops, but who needs ThinkPad keymaps on an ARM1176 SoC?

fdisk is recommended by libsystemd-shared, and disabling it drops util-linux-libfdisk. This is only required for sysupdate, repart and homed.

With all the changes I was able to free a significant amount of storage again (the hwdb alone was ~9 MiB uncompressed).

I've tested my changes with qemux86-64 by building systemd with the default configuration and with fdisk off, hwdb off, sysinstall on (with and without repart), ukify on, and with the efi DISTRO_FEATURE (with and without ukify), then checked the resulting packages, shipped binaries and RRECOMMENDS.
Enabling repart or homed without fdisk fails at parse time as expected.

The testimage with default and hwdb-off + usbutils configuration booted and passed the default tests.

---
Tan Siewert (4):
systemd: add ukify packageconfig
systemd: add sysinstall packageconfig
systemd: add hwdb packageconfig
systemd: add fdisk packageconfig

 meta/recipes-core/systemd/systemd_262.bb | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

---
base-commit: ae5cafacec8e99c5a27fa5b3b378eefc595910ef
change-id: 20261021-systemd-optimisations-dae99d91e807

Best regards,
--
Tan Siewert <[email protected]>

#8 lore raw
Quoted 6 lines · Sai Sireesha

Hi Tan,

Thanks for sharing the patch series.

Just wanted to mention that I've submitted a patch upgrading the systemd-related recipes from 262 to 262.1 to the OE-Core mailing list.

Quoted 1 line

I noticed that your series also modifies systemd_262.bb, so there may be some overlap depending on the order in which the patches merge.

Thanks for the notice! Given that I have to send a v2 out either way I'll just send you a v2 that sets it as prerequisite (if not merged yet).

Thanks!
Tan