Skip to contentSkip to conversation

Fix: allow specification of dtb directory

PATCH Superseded [email protected] 2 participants 5 messages May 11, 2023 – May 12, 2023

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

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.

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 (1):
kernel-devicetree: recursively search for dtbs

 meta/classes-recipe/kernel-devicetree.bbclass | 26 +++++++++++++------
 meta/classes-recipe/kernel.bbclass            |  2 +-
 2 files changed, 19 insertions(+), 9 deletions(-)
Signature · 1 line
2.40.1
#1 lore raw

PATCH 1/2 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 2/2 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 | 22 ++++++++++++++-----
 1 file changed, 16 insertions(+), 6 deletions(-)
meta/classes-recipe/kernel-devicetree.bbclass +16 -6
index 831fdd1527..1beaedfb44 100644
@@ -12,12 +12,22 @@ python () {
             d.appendVar("PACKAGES", " ${KERNEL_PACKAGE_NAME}-image-zimage-bundle")
 }
 
-FILES:${KERNEL_PACKAGE_NAME}-devicetree = " \
-    /${KERNEL_DTBDEST}/*.dtb \
-    /${KERNEL_DTBDEST}/*.dtbo \
-    /${KERNEL_DTBDEST}/*/*.dtb \
-    /${KERNEL_DTBDEST}/*/*.dtbo \
-"
+# recursivly search for devicetree files
+python () {
+    import glob
+    import os
+
+    file_paths = []
+    dest_dir = d.getVar('D')
+    full_dtb_dir = dest_dir + '/' + d.getVar('KERNEL_DTBDEST')
+
+    for file in glob.glob(full_dtb_dir + '/**/*.dtb*', recursive=True):
+        file_paths.append('/' + os.path.relpath(file, dest_dir))
+
+    d.appendVar("FILES:" + d.getVar("KERNEL_PACKAGE_NAME") + '-devicetree',
+                ' '+' '.join(file_paths))
+}
+
 FILES:${KERNEL_PACKAGE_NAME}-image-zimage-bundle = "/${KERNEL_IMAGEDEST}/zImage-*.dtb.bin"
 
 # Generate kernel+devicetree bundle
Signature · 1 line
2.40.1
#3 lore raw
In reply to [email protected]

Hello,

This caused the following failures on the AB:

https://autobuilder.yoctoproject.org/typhoon/#/builders/113/builds/3986/steps/13/logs/stdio
https://autobuilder.yoctoproject.org/typhoon/#/builders/79/builds/5176/steps/15/logs/stdio
https://autobuilder.yoctoproject.org/typhoon/#/builders/86/builds/5167/steps/14/logs/stdio
https://autobuilder.yoctoproject.org/typhoon/#/builders/65/builds/7160/steps/11/logs/stdio
https://autobuilder.yoctoproject.org/typhoon/#/builders/106/builds/6067/steps/12/logs/stdio
https://autobuilder.yoctoproject.org/typhoon/#/builders/127/builds/1406/steps/14/logs/stdio
https://autobuilder.yoctoproject.org/typhoon/#/builders/80/builds/5126/steps/14/logs/stdio
https://autobuilder.yoctoproject.org/typhoon/#/builders/87/builds/5205/steps/14/logs/stdio

2023-05-12 09:01:46,475 - oe-selftest - INFO - fitimage.FitImageTests.test_initramfs_bundle (subunit.RemotedTestCase)
2023-05-12 09:01:46,476 - oe-selftest - INFO -  ... FAIL

and

ERROR: When reparsing /home/pokybuild/yocto-worker/oe-selftest-centos/build/meta/recipes-kernel/linux/linux-yocto_6.1.bb:do_package, the basehash value changed from 856d8373327180fa74e88cff2bbc28b82eb24fb635dc7d3ac16d7a2b7d89ff2e to d2b77c38850e4954edc1422022fb0dbd307742cf2eafac6d8ae699d03d2ce13b. The metadata is not deterministic and this needs to be fixed.
ERROR: The following commands may help:
ERROR: $ bitbake linux-yocto -cdo_package -Snone
ERROR: Then:
ERROR: $ bitbake linux-yocto -cdo_package -Sprintdiff

Quoted 35 lines · Randolph Sapp via lists.openembedded.org

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.

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 (1):
kernel-devicetree: recursively search for dtbs

 meta/classes-recipe/kernel-devicetree.bbclass | 26 +++++++++++++------
 meta/classes-recipe/kernel.bbclass            |  2 +-
 2 files changed, 19 insertions(+), 9 deletions(-)
Signature · 11 lines
2.40.1



-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#181157): https://lists.openembedded.org/g/openembedded-core/message/181157
Mute This Topic: https://lists.openembedded.org/mt/98837534/3617179
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#4 lore raw
Quoted 17 lines · Alexandre Belloni

Hello,

This caused the following failures on the AB:

https://autobuilder.yoctoproject.org/typhoon/#/builders/113/builds/3986/steps/13/logs/stdio
https://autobuilder.yoctoproject.org/typhoon/#/builders/79/builds/5176/steps/15/logs/stdio
https://autobuilder.yoctoproject.org/typhoon/#/builders/86/builds/5167/steps/14/logs/stdio
https://autobuilder.yoctoproject.org/typhoon/#/builders/65/builds/7160/steps/11/logs/stdio
https://autobuilder.yoctoproject.org/typhoon/#/builders/106/builds/6067/steps/12/logs/stdio
https://autobuilder.yoctoproject.org/typhoon/#/builders/127/builds/1406/steps/14/logs/stdio
https://autobuilder.yoctoproject.org/typhoon/#/builders/80/builds/5126/steps/14/logs/stdio
https://autobuilder.yoctoproject.org/typhoon/#/builders/87/builds/5205/steps/14/logs/stdio

2023-05-12 09:01:46,475 - oe-selftest - INFO - fitimage.FitImageTests.test_initramfs_bundle (subunit.RemotedTestCase)
2023-05-12 09:01:46,476 - oe-selftest - INFO -  ... FAIL
Quoted 8 lines

and

ERROR: When reparsing /home/pokybuild/yocto-worker/oe-selftest-centos/build/meta/recipes-kernel/linux/linux-yocto_6.1.bb:do_package, the basehash value changed from 856d8373327180fa74e88cff2bbc28b82eb24fb635dc7d3ac16d7a2b7d89ff2e to d2b77c38850e4954edc1422022fb0dbd307742cf2eafac6d8ae699d03d2ce13b. The metadata is not deterministic and this needs to be fixed.
ERROR: The following commands may help:
ERROR: $ bitbake linux-yocto -cdo_package -Snone
ERROR: Then:
ERROR: $ bitbake linux-yocto -cdo_package -Sprintdiff

Right you are. Expect a v2 using a specialized function to avoid the metadata change in a minute.

Quoted 38 lines · Randolph Sapp via lists.openembedded.org
Quoted 35 lines

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.

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 (1):
kernel-devicetree: recursively search for dtbs

  meta/classes-recipe/kernel-devicetree.bbclass | 26 +++++++++++++------
  meta/classes-recipe/kernel.bbclass            |  2 +-
  2 files changed, 19 insertions(+), 9 deletions(-)
Signature · 11 lines
2.40.1



-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#181157): https://lists.openembedded.org/g/openembedded-core/message/181157
Mute This Topic: https://lists.openembedded.org/mt/98837534/3617179
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-