Skip to contentSkip to conversation

device-tree.bbclass: Add support to compile overlays separately

PATCH Superseded Jaewon Lee 2 participants 2 messages Dec 14, 2018

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Jaewon Lee

author
#0 lore raw

PATCH 1/1 device-tree.bbclass: Add support to compile overlays separately

Currently only dts files are considered when looping through files to compile. Modifying the loop to compile other files that are overlays. Also surrounding this check with a try block as the function to find overlays parses the file for a '/plugin/' tag, and there may be files in the DT_FILES_PATH directory that are not parseable.

---
 meta/classes/devicetree.bbclass | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
meta/classes/devicetree.bbclass +5 -2
index 8fe5a5e..db10b86 100644
@@ -120,9 +120,12 @@ python devicetree_do_compile() {
     includes = expand_includes("DT_INCLUDE", d)
     listpath = d.getVar("DT_FILES_PATH")
     for dts in os.listdir(listpath):
-        if not dts.endswith(".dts"):
-            continue # skip non-.dts files
         dtspath = os.path.join(listpath, dts)
+        try:
+            if not(os.path.isfile(dtspath)) or not(dts.endswith(".dts") or devicetree_source_is_overlay(dtspath)
+                continue # skip non-.dts files and non-overlay files
+        except:
+            continue # skip if can't determine if overlay
         devicetree_compile(dtspath, includes, d)
 }
 
Signature · 1 line
2.7.5
#1 lore raw
Quoted 19 lines · Jaewon Lee

Currently only dts files are considered when looping through files to compile. Modifying the loop to compile other files that are overlays. Also surrounding this check with a try block as the function to find overlays parses the file for a '/plugin/' tag, and there may be files in the DT_FILES_PATH directory that are not parseable.

---
 meta/classes/devicetree.bbclass | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
meta/classes/devicetree.bbclass +0 -0
index 8fe5a5e..db10b86 100644

meta/classes/devicetree.bbclass python devicetree_do_compile() { · line 125

Quoted 8 lines
meta/classes/devicetree.bbclass +2 -2
@@ -120,9 +120,12 @@ python devicetree_do_compile() {
     includes = expand_includes("DT_INCLUDE", d)
     listpath = d.getVar("DT_FILES_PATH")
     for dts in os.listdir(listpath):
-        if not dts.endswith(".dts"):
-            continue # skip non-.dts files
         dtspath = os.path.join(listpath, dts)
+        try:
+            if not(os.path.isfile(dtspath)) or not(dts.endswith(".dts") or devicetree_source_is_overlay(dtspath)

This is missing the trailing "):". Otherwise looks good.

Regards,
Nathan

Quoted 9 lines
meta/classes/devicetree.bbclass +3 -1
+                continue # skip non-.dts files and non-overlay files
+        except:
+            continue # skip if can't determine if overlay
         devicetree_compile(dtspath, includes, d)
 }
 
--

2.7.5