similarity index 87%
rename from meta-ti-bsp/recipes-kernel/linux/ti-kernel-devicetree-prefix.inc
rename to meta-ti-bsp/classes/ti-devicetree-prefix.bbclass
@@ -1,3 +1,4 @@
+# Generate list of DTBs from the kernel source
def get_dtbs_from_kernel(dts_dir, dts_prefix):
import os
import glob
@@ -17,6 +18,8 @@ def get_dtbs_from_kernel(dts_dir, dts_prefix):
matches.append(filename)
return ' '.join(matches)
+# Generate list of "merged" DTBs from the kernel source
+# It is TI custom feature to merge DTB overlays into a single DTB
def get_merge_dtbs_from_kernel(dts_dir, dts_pattern):
import os
matches = []
@@ -32,9 +35,9 @@ def get_merge_dtbs_from_kernel(dts_dir, dts_pattern):
matches.append(pattern)
return ' '.join(matches)
-KERNEL_DEVICETREE_DTBMERGE ?= ""
-
KERNEL_DEVICETREE = " \
${@get_dtbs_from_kernel('${STAGING_KERNEL_DIR}/arch/${ARCH}/boot/dts/', '${KERNEL_DEVICETREE_PREFIX}')} \
${@get_merge_dtbs_from_kernel('${STAGING_KERNEL_DIR}/arch/${ARCH}/boot/dts/', '${KERNEL_DEVICETREE_DTBMERGE}')} \
"
+
+do_image_wic[depends] += "virtual/kernel:do_shared_workdir"
@@ -22,3 +22,11 @@ KERNEL_DTBVENDORED = "1"
# Also build a non-vendored list w/o dir structure
DEVICETREE_FILES = "${@' '.join([os.path.basename(f) for f in d.getVar("KERNEL_DEVICETREE").split()])}"
+
+KERNEL_DEVICETREE_DTBMERGE ?= ""
+
+# Dynamically build DTBs list based on prefix matching
+CLASS_DEVICETREE_PREFIX = "${@ 'ti-devicetree-prefix' if d.getVar('KERNEL_DEVICETREE_PREFIX') else ''}"
+
+KERNEL_CLASSES += "${CLASS_DEVICETREE_PREFIX}"
+IMAGE_CLASSES += "${CLASS_DEVICETREE_PREFIX}"
@@ -2,8 +2,6 @@ require linux-ti-mainline_git.bb
SUMMARY = "Linux-next kernel for TI devices"
-include ${@ 'recipes-kernel/linux/ti-kernel-devicetree-prefix.inc' if d.getVar('KERNEL_DEVICETREE_PREFIX') else ''}
-
# 6.6.0-rc3+ version
SRCREV = "6465e260f48790807eef06b583b38ca9789b6072"
PV = "6.6.0-rc3+git"
@@ -7,7 +7,6 @@ inherit ${KERNEL_BASE_CLASS}
require recipes-kernel/linux/setup-defconfig.inc
require recipes-kernel/linux/ti-kernel.inc
-include ${@ 'recipes-kernel/linux/ti-kernel-devicetree-prefix.inc' if d.getVar('KERNEL_DEVICETREE_PREFIX') else ''}
include ${@ 'recipes-kernel/linux/ti-extras.inc' if d.getVar('TI_EXTRAS') else ''}
DEPENDS += "gmp-native libmpc-native"
@@ -7,7 +7,6 @@ inherit ${KERNEL_BASE_CLASS}
require recipes-kernel/linux/setup-defconfig.inc
require recipes-kernel/linux/ti-kernel.inc
-include ${@ 'recipes-kernel/linux/ti-kernel-devicetree-prefix.inc' if d.getVar('KERNEL_DEVICETREE_PREFIX') else ''}
include ${@ 'recipes-kernel/linux/ti-extras.inc' if d.getVar('TI_EXTRAS') else ''}
DEPENDS += "gmp-native libmpc-native"
@@ -7,6 +7,6 @@ require recipes-kernel/linux/linux-yocto-fitimage.bb
inherit ti-secdev
-include ${@ 'recipes-kernel/linux/ti-kernel-devicetree-prefix.inc' if d.getVar('KERNEL_DEVICETREE_PREFIX') else ''}
+inherit ${@ 'ti-devicetree-prefix' if d.getVar('KERNEL_DEVICETREE_PREFIX') else ''}
do_compile[depends] += "virtual/kernel:do_shared_workdir"