diff --git a/meta/classes-recipe/uki.bbclass b/meta/classes-recipe/uki.bbclass
index bcccf824c7..ea8aaa5e6b 100644
--- a/meta/classes-recipe/uki.bbclass
+++ b/meta/classes-recipe/uki.bbclass
@@ -151,16 +151,18 @@ python do_uki() {
     if cmdline:
         ukify_cmd += " --cmdline='%s'" % (cmdline)
 
-    # dtb
-    uki_devicetree = d.getVar('UKI_DEVICETREE')
-    if uki_devicetree:
-        for dtb in uki_devicetree.split():
-            # DTBs are without sub-directories in deploy_dir
-            dtb_name = os.path.basename(dtb)
-            dtb_path = "%s/%s" % (deploy_dir_image, dtb_name)
-            if not os.path.exists(dtb_path):
-                bb.fatal(f"ERROR: cannot find {dtb_path}.")
-            ukify_cmd += " --devicetree %s" % (dtb_path)
+    # dtb, overlays cannot be used as the base devicetree. With several dtbs,
+    # systemd-stub picks the first one matching the firmware's "compatible".
+    uki_devicetree = [dtb for dtb in (d.getVar('UKI_DEVICETREE') or "").split()
+                      if not dtb.endswith('.dtbo')]
+    dtb_option = "--devicetree" if len(uki_devicetree) == 1 else "--devicetree-auto"
+    for dtb in uki_devicetree:
+        # DTBs are without sub-directories in deploy_dir
+        dtb_name = os.path.basename(dtb)
+        dtb_path = "%s/%s" % (deploy_dir_image, dtb_name)
+        if not os.path.exists(dtb_path):
+            bb.fatal(f"ERROR: cannot find {dtb_path}.")
+        ukify_cmd += " %s %s" % (dtb_option, dtb_path)
 
     # custom config for ukify
     if os.path.exists(d.getVar('UKI_CONFIG_FILE')):
