Skip to contentSkip to conversation

ti-kernel-devicetree-prefix: Add search function for DTBMERGE

PATCH New Ryan Eatmon 1 participant 2 messages Jul 27, 2023

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 ti-kernel-devicetree-prefix: Add search function for DTBMERGE

With the change to the vendored arch/arm/boot/dts directory, we need to add support to the KERNEL_DEVICETREE_DTBMERGE to make it a search pattern instead of a fixed list.

---
 .../linux/ti-kernel-devicetree-prefix.inc     | 22 ++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)
meta-ti-bsp/recipes-kernel/linux/ti-kernel-devicetree-prefix.inc +21 -1
index 1496a749..04c91004 100644
@@ -18,5 +18,25 @@ def get_dtbs_from_kernel(dts_dir, dts_prefix):
             matches.append(filename)
     return ' '.join(matches)
 
-KERNEL_DEVICETREE = "${@get_dtbs_from_kernel('${S}/arch/${ARCH}/boot/dts/', '${KERNEL_DEVICETREE_PREFIX}')} ${KERNEL_DEVICETREE_DTBMERGE}"
+def get_merge_dtbs_from_kernel(dts_dir, dts_pattern):
+    import os
+    matches = []
+    if dts_dir == "":
+        return ' '
+    for pattern in dts_pattern.split():
+        pattern_dir = os.path.split(pattern)[0]
+        pattern_target = os.path.split(pattern)[1].replace(".","-") + "s"
+        makefile = dts_dir + "/" + pattern_dir + "/Makefile"
+        if os.path.exists(makefile):
+            with open(makefile) as f:
+                if pattern_target in f.read():
+                    matches.append(pattern)
+    return ' '.join(matches)
+
+KERNEL_DEVICETREE_DTBMERGE ?= ""
+
+KERNEL_DEVICETREE = " \
+    ${@get_dtbs_from_kernel('${S}/arch/${ARCH}/boot/dts/', '${KERNEL_DEVICETREE_PREFIX}')} \
+    ${@get_merge_dtbs_from_kernel('${S}/arch/${ARCH}/boot/dts/', '${KERNEL_DEVICETREE_DTBMERGE}')} \
+"
 
Signature · 1 line
2.17.1
#1 lore raw

PATCH v2 2/2 linux-ti-next,conf/machine: Add support for new vendored dts dir

The latest kernel has made the change to add vendor subdirectories into the arch/arm/boot/dts directory. This effectively breaks the KERNEL_DEVICETREE settings in the machine configs for 32bit platforms, so switch them over to using the PREFIX variable. Also change the linux-ti-next to use the PREFIX setting for KERNEL_DEVICETREE.

---
v2: Added previous KERNEL_DEVICETREE entries back in.

 meta-ti-bsp/conf/machine/am57xx-evm.conf              | 3 +++
 meta-ti-bsp/conf/machine/dra7xx-evm.conf              | 1 +
 meta-ti-bsp/conf/machine/include/ti33x.inc            | 5 ++++-
 meta-ti-bsp/conf/machine/include/ti43x.inc            | 2 ++
 meta-ti-bsp/conf/machine/omapl138-lcdk.conf           | 5 ++++-
 meta-ti-bsp/recipes-kernel/linux/linux-ti-next_git.bb | 1 +
 6 files changed, 15 insertions(+), 2 deletions(-)
meta-ti-bsp/conf/machine/am57xx-evm.conf +3 -0
index 26b7f78c..43a6a833 100644
@@ -13,11 +13,14 @@ KERNEL_DEVICETREE_PREFIX = " \
     ti/am57 \
     ti/lcd \
     ti/ov10635 \
+    ti/omap/am57 \
 "
 
 KERNEL_DEVICETREE_DTBMERGE = " \
     am57xx-evm.dtb \
     am57xx-evm-reva3.dtb \
+    ti/omap/am57xx-evm.dtb \
+    ti/omap/am57xx-evm-reva3.dtb \
 "
 
 KERNEL_DEVICETREE = " \
meta-ti-bsp/conf/machine/dra7xx-evm.conf +1 -0
index c47a1e80..30884ae1 100644
@@ -12,6 +12,7 @@ KERNEL_DEVICETREE_PREFIX = " \
     dra7 \
     ti/dra7 \
     ti/lcd \
+    ti/omap/dra7 \
 "
 
 KERNEL_DEVICETREE = " \
meta-ti-bsp/conf/machine/include/ti33x.inc +4 -1
index f7f126f4..bc61a773 100644
@@ -19,7 +19,10 @@ PVR_DISPLAY_CONTROLLER_ALIAS ?= "tilcdc"
 
 KERNEL_IMAGETYPE = "zImage"
 
-KERNEL_DEVICETREE_PREFIX = "am335x"
+KERNEL_DEVICETREE_PREFIX = " \
+    am335x \
+    ti/omap/am335x \
+"
 
 KERNEL_DEVICETREE = " \
     am335x-evm.dtb \
meta-ti-bsp/conf/machine/include/ti43x.inc +2 -0
index a6af56e3..ea5d1505 100644
@@ -22,6 +22,8 @@ KERNEL_IMAGETYPE = "zImage"
 KERNEL_DEVICETREE_PREFIX = " \
     am437x \
     am43x \
+    ti/omap/am437x \
+    ti/omap/am43x \
 "
 
 KERNEL_DEVICETREE = " \
meta-ti-bsp/conf/machine/omapl138-lcdk.conf +4 -1
index a8b08964..fdbaffae 100644
@@ -15,7 +15,10 @@ IMAGE_FSTYPES += "tar.xz"
 
 SERIAL_CONSOLES = "115200;ttyS2"
 
-KERNEL_DEVICETREE_PREFIX = "da850"
+KERNEL_DEVICETREE_PREFIX = " \
+    da850 \
+    ti/davinci/da850 \
+"
 
 KERNEL_DEVICETREE = " \
     da850-evm.dtb \
meta-ti-bsp/recipes-kernel/linux/linux-ti-next_git.bb +1 -0
index 9138c7c5..8228f4ff 100644
@@ -6,6 +6,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=6bc538ed5bd9a7fc9398086aedcd7e46"
 inherit kernel
 
 require recipes-kernel/linux/ti-kernel.inc
+include ${@ 'recipes-kernel/linux/ti-kernel-devicetree-prefix.inc' if d.getVar('KERNEL_DEVICETREE_PREFIX') else ''}
 
 DEPENDS += "gmp-native libmpc-native"
 
Signature · 1 line
2.17.1