Skip to contentSkip to conversation

package/systemd: add BR2_PACKAGE_SYSTEMD_UKIFY option

PATCH In review Bram Vlerick 2 participants 2 messages Feb 24, 2025 – Feb 4

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/systemd: add BR2_PACKAGE_SYSTEMD_UKIFY option

Add option to enable or disable the build of systemd's ukify tool to create unified kernel images.

---
 package/systemd/Config.in  |  7 +++++++
 package/systemd/systemd.mk | 14 ++++++++++++--
 2 files changed, 19 insertions(+), 2 deletions(-)
package/systemd/Config.in +7 -0
index 851b91aeba70d0726cdc1ea411d7aca017f8fe68..eaeb245bb51f8ae6276273ef546115b1c1ae0f08 100644
@@ -164,6 +164,13 @@ config BR2_PACKAGE_SYSTEMD_BOOT_EFI_ARCH
 config BR2_PACKAGE_SYSTEMD_EFI
 	bool "enable EFI support"
 
+config BR2_PACKAGE_SYSTEMD_UKIFY
+	bool "systemd-ukify"
+	select BR2_PACKAGE_SYSTEMD_EFI
+	select BR2_PACKAGE_SYSTEMD_BOOT
+	help
+	  systemd-ukify is a tool to generate a Unified Kernel Image
+
 config BR2_PACKAGE_SYSTEMD_JOURNAL_REMOTE
 	bool "enable journal remote tools"
 	select BR2_PACKAGE_LIBCURL
package/systemd/systemd.mk +12 -2
index 28091a72a6d1d7d91fa18d4fe16c637c2112571b..50c466a105b808d0cf15207cf53e9fc4c48bde17 100644
@@ -100,7 +100,6 @@ SYSTEMD_CONF_OPTS += \
 	-Dinstall-tests=false \
 	-Dlog-message-verification=disabled \
 	-Dtmpfiles=true \
-	-Dukify=disabled \
 	-Dbpf-framework=disabled \
 	-Dvmlinux-h=disabled \
 	-Dumount-path=/usr/bin/umount \
@@ -664,6 +663,12 @@ else
 SYSTEMD_CONF_OPTS += -Defi=false
 endif
 
+ifeq ($(BR2_PACKAGE_SYSTEMD_UKIFY),y)
+SYSTEMD_CONF_OPTS += -Dukify=true
+else
+SYSTEMD_CONF_OPTS += -Dukify=false
+endif
+
 SYSTEMD_FALLBACK_HOSTNAME = $(call qstrip,$(BR2_TARGET_GENERIC_HOSTNAME))
 ifneq ($(SYSTEMD_FALLBACK_HOSTNAME),)
 SYSTEMD_CONF_OPTS += -Dfallback-hostname=$(SYSTEMD_FALLBACK_HOSTNAME)
@@ -978,7 +983,6 @@ HOST_SYSTEMD_CONF_OPTS = \
 	-Dinitrd=false \
 	-Dxdg-autostart=false \
 	-Dkernel-install=false \
-	-Dukify=disabled \
 	-Danalyze=false \
 	-Dbpf-framework=disabled \
 	-Dvmlinux-h=disabled \
@@ -1012,6 +1016,12 @@ HOST_SYSTEMD_CONF_OPTS = \
 	-Dlibfido2=disabled \
 	-Dpcre2=disabled
 
+ifeq ($(BR2_PACKAGE_SYSTEMD_UKIFY),y)
+HOST_SYSTEMD_CONF_OPTS += -Dukify=true
+else
+HOST_SYSTEMD_CONF_OPTS += -Dukify=false
+endif
+
 HOST_SYSTEMD_DEPENDENCIES = \
 	$(BR2_COREUTILS_HOST_DEPENDENCY) \
 	host-util-linux \

---
base-commit: 544249ff7761db2df61783c8731e834574df957a
change-id: 20250224-systemd-ukify-3bcbb08507e4

Best regards,

Signature · 6 lines
Bram Vlerick <[email protected]>

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

Hi Bram,

Thank you for your contribution!

Quoted 4 lines · Bram Vlerick

Add option to enable or disable the build of systemd's ukify tool to create unified kernel images.

I applied to master, but with so many changes that nothing of your original
patch remains :-)

Quoted 10 lines
---
  package/systemd/Config.in  |  7 +++++++
  package/systemd/systemd.mk | 14 ++++++++++++--
  2 files changed, 19 insertions(+), 2 deletions(-)
package/systemd/Config.in +0 -0
index 851b91aeba70d0726cdc1ea411d7aca017f8fe68..eaeb245bb51f8ae6276273ef546115b1c1ae0f08 100644

package/systemd/Config.in config BR2_PACKAGE_SYSTEMD_BOOT_EFI_ARCH · line 167

Quoted 4 lines
package/systemd/Config.in +1 -0
@@ -164,6 +164,13 @@ config BR2_PACKAGE_SYSTEMD_BOOT_EFI_ARCH
  config BR2_PACKAGE_SYSTEMD_EFI
  	bool "enable EFI support"
 
+config BR2_PACKAGE_SYSTEMD_UKIFY

I'm not sure if this is actually useful on the target. You'd normally build
the UKI on some machine and then copy it to the target. You probably shouldn't run ukify on the target itself, it's kind of pointless.

package/systemd/Config.in config BR2_PACKAGE_SYSTEMD_BOOT_EFI_ARCH · line 169

Quoted 2 lines
package/systemd/Config.in +2 -0
+	bool "systemd-ukify"
+	select BR2_PACKAGE_SYSTEMD_EFI

It actually requires python3 and python3-pefile, so you need to select those.
Note that we don't have pefile for the target at the moment. ukify on the target can't have worked for you!

So this confirms my conclusion that ukify on the target is not needed. I
removed the target option entirely.

package/systemd/Config.in config BR2_PACKAGE_SYSTEMD_BOOT_EFI_ARCH · line 170

Quoted 1 line
package/systemd/Config.in +1 -0
+	select BR2_PACKAGE_SYSTEMD_BOOT

Does it actually need systemd-boot? You can load an UKI with grub, uboot, ...
so there's no reason to select systemd-boot, right?

Quoted 19 lines
package/systemd/Config.in +3 -0
+	help
+	  systemd-ukify is a tool to generate a Unified Kernel Image
+
  config BR2_PACKAGE_SYSTEMD_JOURNAL_REMOTE
  	bool "enable journal remote tools"
  	select BR2_PACKAGE_LIBCURL
package/systemd/systemd.mk +0 -1
index 28091a72a6d1d7d91fa18d4fe16c637c2112571b..50c466a105b808d0cf15207cf53e9fc4c48bde17 100644
@@ -100,7 +100,6 @@ SYSTEMD_CONF_OPTS += \
  	-Dinstall-tests=false \
  	-Dlog-message-verification=disabled \
  	-Dtmpfiles=true \
-	-Dukify=disabled \
  	-Dbpf-framework=disabled \
  	-Dvmlinux-h=disabled \
  	-Dumount-path=/usr/bin/umount \

package/systemd/systemd.mk else · line 667

Quoted 5 lines
package/systemd/systemd.mk +2 -0
@@ -664,6 +663,12 @@ else
  SYSTEMD_CONF_OPTS += -Defi=false
  endif
 
+ifeq ($(BR2_PACKAGE_SYSTEMD_UKIFY),y)
+SYSTEMD_CONF_OPTS += -Dukify=true

true/false are deprecated, it's enabled/disabled.

Quoted 16 lines
package/systemd/systemd.mk +4 -1
+else
+SYSTEMD_CONF_OPTS += -Dukify=false
+endif
+
  SYSTEMD_FALLBACK_HOSTNAME = $(call qstrip,$(BR2_TARGET_GENERIC_HOSTNAME))
  ifneq ($(SYSTEMD_FALLBACK_HOSTNAME),)
  SYSTEMD_CONF_OPTS += -Dfallback-hostname=$(SYSTEMD_FALLBACK_HOSTNAME)
@@ -978,7 +983,6 @@ HOST_SYSTEMD_CONF_OPTS = \
  	-Dinitrd=false \
  	-Dxdg-autostart=false \
  	-Dkernel-install=false \
-	-Dukify=disabled \
  	-Danalyze=false \
  	-Dbpf-framework=disabled \
  	-Dvmlinux-h=disabled \

package/systemd/systemd.mk HOST_SYSTEMD_CONF_OPTS = \ · line 1020

Quoted 5 lines
package/systemd/systemd.mk +2 -0
@@ -1012,6 +1016,12 @@ HOST_SYSTEMD_CONF_OPTS = \
  	-Dlibfido2=disabled \
  	-Dpcre2=disabled
 
+ifeq ($(BR2_PACKAGE_SYSTEMD_UKIFY),y)
+HOST_SYSTEMD_CONF_OPTS += -Dukify=true

The host systemd configuration should usually not depend on target options. In
this particular case, there's really no reason to make it conditional. I enabled it unconditionally.

As mentioned earlier, it depends on host-python-pefile, so I added that
dependency. host-systemd already depends on host-python3, so adding host-python-pefile doesn't have much impact.

Can you check if what is on master now satisfies your needs?

Regards,
Arnout

Quoted 12 lines
package/systemd/systemd.mk +4 -1
+else
+HOST_SYSTEMD_CONF_OPTS += -Dukify=false
+endif
+
  HOST_SYSTEMD_DEPENDENCIES = \
  	$(BR2_COREUTILS_HOST_DEPENDENCY) \
  	host-util-linux \
 
---

base-commit: 544249ff7761db2df61783c8731e834574df957a
change-id: 20250224-systemd-ukify-3bcbb08507e4

Quoted 1 line

Best regards,

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot