diff mbox series

[3/3] uki.bbclass: do not take hwids from the build host

Message ID 20261129223704.2168814-3-ricardo.salveti@oss.qualcomm.com
State New
Headers show
Series [1/3] uki.bbclass: skip overlays and select between several devicetrees | expand

Commit Message

Ricardo Salveti Nov. 29, 2026, 10:37 p.m. UTC
Since systemd 260, ukify adds a .hwids section from the build host's
/usr/lib/systemd/boot/hwids/<efi-arch> when --hwids is not given, so
the UKI depends on what the host has installed. Always pass --hwids,
from the new UKI_HWIDS, empty by default for no .hwids section.
systemd-stub reads that section for .efifw sections, and for .dtbauto
ones when the firmware provides no devicetree; the tables from systemd,
only for aa64 for now, are in the native sysroot for UKI_HWIDS to point
at. HWIDs= in UKI_CONFIG_FILE and a --hwids in UKIFY_CMD no longer
apply.

AI-Generated: Uses Claude Code (Claude Opus 5.5)
Signed-off-by: Ricardo Salveti <ricardo.salveti@oss.qualcomm.com>
---
 meta/classes-recipe/uki.bbclass | 10 ++++++++++
 1 file changed, 10 insertions(+)
diff mbox series

Patch

diff --git a/meta/classes-recipe/uki.bbclass b/meta/classes-recipe/uki.bbclass
index ea8aaa5e6b..c666444021 100644
--- a/meta/classes-recipe/uki.bbclass
+++ b/meta/classes-recipe/uki.bbclass
@@ -82,6 +82,9 @@  UKI_KERNEL_FILENAME ?= "${KERNEL_IMAGETYPE}"
 UKI_CMDLINE ?= "rootwait root=LABEL=root"
 KERNEL_DEVICETREE ??= ""
 UKI_DEVICETREE ?= "${KERNEL_DEVICETREE}"
+# .hwids directory, empty for none. systemd's tables (only aa64 for now):
+# ${STAGING_LIBDIR_NATIVE}/systemd/boot/hwids/${EFI_ARCH}
+UKI_HWIDS ?= ""
 # secure boot keys and cert, needs sbsign-tools-native (meta-secure-core)
 #UKI_SB_KEY ?= ""
 #UKI_SB_CERT ?= ""
@@ -164,6 +167,13 @@  python do_uki() {
             bb.fatal(f"ERROR: cannot find {dtb_path}.")
         ukify_cmd += " %s %s" % (dtb_option, dtb_path)
 
+    # hwids, always set as ukify otherwise takes the build host's. This
+    # overrides HWIDs= in UKI_CONFIG_FILE and --hwids in UKIFY_CMD.
+    hwids = (d.getVar('UKI_HWIDS') or "").strip()
+    if hwids and not os.path.isdir(hwids):
+        bb.fatal(f"ERROR: cannot find UKI_HWIDS directory {hwids}.")
+    ukify_cmd += " --hwids='%s'" % (hwids)
+
     # custom config for ukify
     if os.path.exists(d.getVar('UKI_CONFIG_FILE')):
         ukify_cmd += " --config=%s" % (d.getVar('UKI_CONFIG_FILE'))