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'))
