[meta-xilinx] [PATCH 7/9] machine-xilinx-qemu.inc: Don't use MACHINE_DEVICETREE for dtb detection

Nathan Rossi nathan at nathanrossi.com
Thu Apr 20 03:35:17 PDT 2017


Avoid using the MACHINE_DEVICETREE variable for detection of the device
tree that needs to be loaded. Instead only rely on IMAGE_BOOT_FILES or
KERNEL_DEVICETREE.

Signed-off-by: Nathan Rossi <nathan at nathanrossi.com>
---
 conf/machine/include/machine-xilinx-qemu.inc | 15 ++++++++-------
 conf/machine/qemu-zynq7.conf                 |  1 +
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/conf/machine/include/machine-xilinx-qemu.inc b/conf/machine/include/machine-xilinx-qemu.inc
index 79cbd7a4be..3c6972fa58 100644
--- a/conf/machine/include/machine-xilinx-qemu.inc
+++ b/conf/machine/include/machine-xilinx-qemu.inc
@@ -1,15 +1,16 @@
 EXTRA_IMAGEDEPENDS += "qemu-native qemu-helper-native"
 
 def qemu_default_dtb(d):
-    if d.getVar("MACHINE_DEVICETREE", True):
-        dtbs = d.getVar("MACHINE_DEVICETREE", True).split(" ")
-        dtbs = [os.path.splitext(os.path.basename(d)) for d in dtbs]
-        dtbs = ["%s.dtb" % name for name, ext in dtbs if ext == ".dts" or ext == ".dtb"]
-        return dtbs[0] if dtbs else ""
-    elif d.getVar("KERNEL_DEVICETREE", True):
+    if d.getVar("IMAGE_BOOT_FILES", True):
+        dtbs = d.getVar("IMAGE_BOOT_FILES", True).split(" ")
+        dtbs = [f for f in dtbs if os.path.basename(f).endswith(".dtb")]
+        if len(dtbs) != 0:
+            return dtbs[0]
+    if d.getVar("KERNEL_DEVICETREE", True):
         dtbs = d.getVar("KERNEL_DEVICETREE", True).split(" ")
         dtbs = [os.path.basename(d) for d in dtbs]
-        return d.getVar("KERNEL_IMAGETYPE", True) + "-" + (dtbs[0] if dtbs else "")
+        if len(dtbs) != 0:
+            return d.getVar("KERNEL_IMAGETYPE", True) + "-" + dtbs[0]
     return ""
 
 def qemu_default_serial(d):
diff --git a/conf/machine/qemu-zynq7.conf b/conf/machine/qemu-zynq7.conf
index 6d55f09d6a..6073211cb6 100644
--- a/conf/machine/qemu-zynq7.conf
+++ b/conf/machine/qemu-zynq7.conf
@@ -11,6 +11,7 @@ MACHINE_FEATURES = "ext2 vfat"
 SERIAL_CONSOLE = "115200 ttyPS0"
 
 MACHINE_ESSENTIAL_EXTRA_RDEPENDS += "device-tree"
+IMAGE_BOOT_FILES += "${MACHINE}.dtb"
 
 # Use the networking setup from qemuarm
 FILESOVERRIDES_append_pn-init-ifupdown = ":qemuarm"
-- 
2.11.0




More information about the meta-xilinx mailing list