[OE-core] [PATCH] kernel-fitimage.bbclass: introduce OVERLAY_FDT_DEFAULT_BOOT

liu.ming50 at gmail.com liu.ming50 at gmail.com
Mon Jan 28 09:23:50 UTC 2019


From: Ming Liu <liu.ming50 at gmail.com>

The FDT overlays can be applied to a base DT configuration by setting
this variable.

The FDT overlays set in this variable must be available in
KERNEL_DEVICETREE.

Signed-off-by: Ming Liu <liu.ming50 at gmail.com>
---
 meta/classes/kernel-fitimage.bbclass | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/meta/classes/kernel-fitimage.bbclass b/meta/classes/kernel-fitimage.bbclass
index 718162a..71771dc 100644
--- a/meta/classes/kernel-fitimage.bbclass
+++ b/meta/classes/kernel-fitimage.bbclass
@@ -36,11 +36,23 @@ python __anonymous () {
         if d.getVar('UBOOT_SIGN_ENABLE') == "1":
             uboot_pn = d.getVar('PREFERRED_PROVIDER_u-boot') or 'u-boot'
             d.appendVarFlag('do_assemble_fitimage', 'depends', ' %s:do_populate_sysroot' % uboot_pn)
+
+        # Verified any FDT listed in OVERLAY_FDT_DEFAULT_BOOT must be availabe
+        # in KERNEL_DEVICETREE.
+        kernel_devicetree = set((d.getVar('KERNEL_DEVICETREE') or '').split())
+        fdt_default_boot = set((d.getVar('OVERLAY_FDT_DEFAULT_BOOT') or '').split())
+        if fdt_default_boot:
+            missing = set.difference(fdt_default_boot, kernel_devicetree)
+            if missing:
+                bb.fatal("Any FDT set in OVERLAY_FDT_DEFAULT_BOOT must be available in KERNEL_DEVICETREE.")
 }
 
 # Options for the device tree compiler passed to mkimage '-D' feature:
 UBOOT_MKIMAGE_DTCOPTS ??= ""
 
+# FDT Overlay to be set in the default boot configuration
+OVERLAY_FDT_DEFAULT_BOOT ??= ""
+
 #
 # Emit the fitImage ITS header
 #
@@ -291,6 +303,12 @@ fitimage_emit_section_config() {
 
 	if [ "${6}" = "1" ]; then
 		default_line="default = \"conf@${3}\";"
+
+		for dtbo in ${OVERLAY_FDT_DEFAULT_BOOT}; do
+			dbto=$(echo "${dtbo}" | tr '/' '_')
+			dtbos="$dtbos, \"fdt@$dbto\""
+		done
+		fdt_line=$(echo $fdt_line | sed "s/;/$dtbos;/")
 	fi
 
 	cat << EOF >> ${1}
-- 
2.7.4



More information about the Openembedded-core mailing list