diff options
author | Petr Kubizňák <kubiznak@2n.com> | 2023-04-21 17:23:25 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-05-04 12:37:00 +0100 |
commit | 0f0bd5e2317beb0ee10dfb39e49f0833e3309d23 (patch) | |
tree | 9471fff84a4cbf9f3fc624861b10c126889251f6 /meta/classes-recipe/devicetree.bbclass | |
parent | b7574378e8d310413805f87d7dccc9063f433b5a (diff) | |
download | poky-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.bbclass | 9 |
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 | ||
54 | DT_INCLUDE[doc] = "Search paths to be made available to both the device tree compiler and preprocessor for inclusion." | 54 | DT_INCLUDE[doc] = "Search paths to be made available to both the device tree compiler and preprocessor for inclusion." |
55 | DT_INCLUDE ?= "${DT_FILES_PATH} ${KERNEL_INCLUDE}" | 55 | DT_INCLUDE ?= "${DT_FILES_PATH} ${KERNEL_INCLUDE}" |
56 | DT_FILES_PATH[doc] = "Defaults to source directory, can be used to select dts files that are not in source (e.g. generated)." | 56 | DT_FILES_PATH[doc] = "Path to the directory containing dts files to build. Defaults to source directory." |
57 | DT_FILES_PATH ?= "${S}" | 57 | DT_FILES_PATH ?= "${S}" |
58 | DT_FILES[doc] = "Space-separated list of dts or dtb files (relative to DT_FILES_PATH) to build. If empty, all dts files are built." | ||
59 | DT_FILES ?= "" | ||
58 | 60 | ||
59 | DT_PADDING_SIZE[doc] = "Size of padding on the device tree blob, used as extra space typically for additional properties during boot." | 61 | DT_PADDING_SIZE[doc] = "Size of padding on the device tree blob, used as extra space typically for additional properties during boot." |
60 | DT_PADDING_SIZE ??= "0x3000" | 62 | DT_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 | ||
127 | python devicetree_do_compile() { | 129 | python 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)): |