Skip to contentSkip to conversation

Fix: allow specification of dtb directory

PATCH New [email protected] 1 participant 4 messages May 22, 2023

lore
Share & tools
lore
#0 lore raw

v3 cover Fix: allow specification of dtb directory

From: Randolph Sapp <[email protected]>

Fix a few of the oddities introduced by the previous patch that allowed specification of the DTB install directory and specification of vendor directories in that directory.

Add a recursive search for dtb and dtbo files to make sure upstream dtb directory standards don't break our packages. This is done by enabling the recursive flag for all file globs. This shouldn't have any performance issues for recipes that don't explicitly use '**' in their globs.

Makes the kernel-devicetree class posix compliant again by using BB variables more efficiently.

Martin Jansa (1):
kernel-devicetree: make shell scripts posix compliant

Randolph Sapp (2):
package: enable recursion on file globs
kernel-devicetree: recursively search for dtbs

 meta/classes-recipe/kernel-devicetree.bbclass | 12 ++++++------
 meta/classes-recipe/kernel.bbclass            |  2 +-
 meta/lib/oe/package.py                        |  2 +-
 3 files changed, 8 insertions(+), 8 deletions(-)
Signature · 1 line
2.40.1
#1 lore raw

PATCH v3 1/3 kernel-devicetree: make shell scripts posix compliant

From: Martin Jansa <[email protected]>

Use the notation suggested by Martin Jansa to avoid a bashism. Also switch KERNEL_DTBVENDORED to the more common 0/1 notation instead of true/false.

Fixes 04ab57d200 (kernel-devicetree: allow specification of dtb

directory, 2023-05-02)

---
 meta/classes-recipe/kernel-devicetree.bbclass | 4 ++--
 meta/classes-recipe/kernel.bbclass            | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
meta/classes-recipe/kernel-devicetree.bbclass +2 -2
index a6c6c5f227..831fdd1527 100644
@@ -82,7 +82,7 @@ do_install:append() {
 	for dtbf in ${KERNEL_DEVICETREE}; do
 		dtb=`normalize_dtb "$dtbf"`
 		dtb_path=`get_real_dtb_path_in_kernel "$dtb"`
-		if [ ${KERNEL_DTBVENDORED} == "false" ]; then
+		if "${@'false' if oe.types.boolean(d.getVar('KERNEL_DTBVENDORED')) else 'true'}"; then
 			dtb_ext=${dtb##*.}
 			dtb_base_name=`basename $dtb .$dtb_ext`
 			dtb=$dtb_base_name.$dtb_ext
@@ -97,7 +97,7 @@ do_deploy:append() {
 		dtb_ext=${dtb##*.}
 		dtb_base_name=`basename $dtb .$dtb_ext`
 		install -d $deployDir
-		if [ ${KERNEL_DTBVENDORED} == "false" ]; then
+		if "${@'false' if oe.types.boolean(d.getVar('KERNEL_DTBVENDORED')) else 'true'}"; then
 			dtb=$dtb_base_name.$dtb_ext
 		fi
 		install -m 0644 ${D}/${KERNEL_DTBDEST}/$dtb $deployDir/$dtb_base_name-${KERNEL_DTB_NAME}.$dtb_ext
meta/classes-recipe/kernel.bbclass +1 -1
index 8f022b234d..4bce64cf6a 100644
@@ -216,7 +216,7 @@ KERNEL_RELEASE ?= "${KERNEL_VERSION}"
 KERNEL_OUTPUT_DIR ?= "arch/${ARCH}/boot"
 KERNEL_IMAGEDEST ?= "boot"
 KERNEL_DTBDEST ?= "${KERNEL_IMAGEDEST}"
-KERNEL_DTBVENDORED ?= "false"
+KERNEL_DTBVENDORED ?= "0"
 
 #
 # configuration
Signature · 1 line
2.40.1
#2 lore raw

PATCH v3 2/3 package: enable recursion on file globs

In reply to [email protected]

From: Randolph Sapp <[email protected]>

Enable recursion of file globs. This just allows the use of '**' in file globs to match 0 or more subdirectories, it should not make all current globs recursive [1].

[1] https://docs.python.org/3.6/library/glob.html#glob.glob

---
 meta/lib/oe/package.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/lib/oe/package.py +1 -1
index edb70daaf1..70040f09e7 100644
@@ -550,7 +550,7 @@ def files_from_filevars(filevars):
             f = '.' + f
         if not f.startswith("./"):
             f = './' + f
-        globbed = glob.glob(f)
+        globbed = glob.glob(f, recursive=True)
         if globbed:
             if [ f ] != globbed:
                 files += globbed
Signature · 1 line
2.40.1
#3 lore raw

PATCH v3 3/3 kernel-devicetree: recursively search for dtbs

In reply to [email protected]

From: Randolph Sapp <[email protected]>

Upstream's dtb directory structure has no real standard. They just tend to idle around the 2/3 directory depth. Recursively search for the dtb/dtbo files instead of assuming anything.

Fixes 04ab57d200 (kernel-devicetree: allow specification of dtb

directory, 2023-05-02)

---
 meta/classes-recipe/kernel-devicetree.bbclass | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
meta/classes-recipe/kernel-devicetree.bbclass +4 -4
index 831fdd1527..b3bae32f9e 100644
@@ -12,12 +12,12 @@ python () {
             d.appendVar("PACKAGES", " ${KERNEL_PACKAGE_NAME}-image-zimage-bundle")
 }
 
+# recursivly search for devicetree files
 FILES:${KERNEL_PACKAGE_NAME}-devicetree = " \
-    /${KERNEL_DTBDEST}/*.dtb \
-    /${KERNEL_DTBDEST}/*.dtbo \
-    /${KERNEL_DTBDEST}/*/*.dtb \
-    /${KERNEL_DTBDEST}/*/*.dtbo \
+    /${KERNEL_DTBDEST}/**/*.dtb \
+    /${KERNEL_DTBDEST}/**/*.dtbo \
 "
+
 FILES:${KERNEL_PACKAGE_NAME}-image-zimage-bundle = "/${KERNEL_IMAGEDEST}/zImage-*.dtb.bin"
 
 # Generate kernel+devicetree bundle
Signature · 1 line
2.40.1