summaryrefslogtreecommitdiffstats
path: root/meta/classes-recipe/devicetree.bbclass
diff options
context:
space:
mode:
authorPetr Kubizňák <kubiznak@2n.com>2023-04-21 17:23:25 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-05-04 12:37:00 +0100
commit0f0bd5e2317beb0ee10dfb39e49f0833e3309d23 (patch)
tree9471fff84a4cbf9f3fc624861b10c126889251f6 /meta/classes-recipe/devicetree.bbclass
parentb7574378e8d310413805f87d7dccc9063f433b5a (diff)
downloadpoky-0f0bd5e2317beb0ee10dfb39e49f0833e3309d23.tar.gz
devicetree.bbclass: Allow selection of dts files to build
Add DT_FILES variable to allow the user of the class to select specific dts files to build. This is useful for packages featuring dts files for multiple machines. Since many machine configs contain a list of dtb files (e.g. KERNEL_DEVICETREE), DT_FILES works with both dts and dtb files. (From OE-Core rev: a6164c384a5bf3980a7a6c7f23927af9aca93b85) Signed-off-by: Petr Kubizňák <kubiznak@2n.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes-recipe/devicetree.bbclass')
-rw-r--r--meta/classes-recipe/devicetree.bbclass9
1 files changed, 7 insertions, 2 deletions
diff --git a/meta/classes-recipe/devicetree.bbclass b/meta/classes-recipe/devicetree.bbclass
index ed2a92e447..bd50d7fa1d 100644
--- a/meta/classes-recipe/devicetree.bbclass
+++ b/meta/classes-recipe/devicetree.bbclass
@@ -53,8 +53,10 @@ KERNEL_INCLUDE ??= " \
53 53
54DT_INCLUDE[doc] = "Search paths to be made available to both the device tree compiler and preprocessor for inclusion." 54DT_INCLUDE[doc] = "Search paths to be made available to both the device tree compiler and preprocessor for inclusion."
55DT_INCLUDE ?= "${DT_FILES_PATH} ${KERNEL_INCLUDE}" 55DT_INCLUDE ?= "${DT_FILES_PATH} ${KERNEL_INCLUDE}"
56DT_FILES_PATH[doc] = "Defaults to source directory, can be used to select dts files that are not in source (e.g. generated)." 56DT_FILES_PATH[doc] = "Path to the directory containing dts files to build. Defaults to source directory."
57DT_FILES_PATH ?= "${S}" 57DT_FILES_PATH ?= "${S}"
58DT_FILES[doc] = "Space-separated list of dts or dtb files (relative to DT_FILES_PATH) to build. If empty, all dts files are built."
59DT_FILES ?= ""
58 60
59DT_PADDING_SIZE[doc] = "Size of padding on the device tree blob, used as extra space typically for additional properties during boot." 61DT_PADDING_SIZE[doc] = "Size of padding on the device tree blob, used as extra space typically for additional properties during boot."
60DT_PADDING_SIZE ??= "0x3000" 62DT_PADDING_SIZE ??= "0x3000"
@@ -125,9 +127,12 @@ def devicetree_compile(dtspath, includes, d):
125 subprocess.run(dtcargs, check = True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) 127 subprocess.run(dtcargs, check = True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
126 128
127python devicetree_do_compile() { 129python devicetree_do_compile() {
130 import re
128 includes = expand_includes("DT_INCLUDE", d) 131 includes = expand_includes("DT_INCLUDE", d)
132 dtfiles = d.getVar("DT_FILES").split()
133 dtfiles = [ re.sub(r"\.dtbo?$", ".dts", dtfile) for dtfile in dtfiles ]
129 listpath = d.getVar("DT_FILES_PATH") 134 listpath = d.getVar("DT_FILES_PATH")
130 for dts in os.listdir(listpath): 135 for dts in dtfiles or os.listdir(listpath):
131 dtspath = os.path.join(listpath, dts) 136 dtspath = os.path.join(listpath, dts)
132 try: 137 try:
133 if not(os.path.isfile(dtspath)) or not(dts.endswith(".dts") or devicetree_source_is_overlay(dtspath)): 138 if not(os.path.isfile(dtspath)) or not(dts.endswith(".dts") or devicetree_source_is_overlay(dtspath)):