[RFC PATCH 0/3] Deploy DTBs with kernel recipe

18 views
Skip to first unread message

Uladzimir Bely

unread,
Jun 13, 2024, 12:36:45 AMJun 13
to isar-...@googlegroups.com
Image task "do_copy_boot_files" is used to deploy kernel, initrd and
devicetree binaries to deploy directory.

When different images for the same target are built (e.g., "-base" and
"-debug") in parallel, this causes issues with DTB deployment since
they have no any image name specific stuff in the path, unlike kernel
and initrd.

Here we make kernel recipes (that are original source of these files)
responcible for DTB deployment.

Related topics on maillist:

https://groups.google.com/g/isar-users/c/4BRDM02xC40
https://groups.google.com/g/isar-users/c/qAnjahjjfsw
https://groups.google.com/g/isar-users/c/ZMD4XY4dKWQ
https://groups.google.com/g/isar-users/c/PSGU_AcdPZ8
https://groups.google.com/g/isar-users/c/Va0Ue-ISYeA

To fix the case when different distro use same namings for DTB, this
patchset should be merged with "[PATCH] Fix do_copy_boot_files error":

https://groups.google.com/g/isar-users/c/Va0Ue-ISYeA

Uladzimir Bely (3):
Don't deploy devicetree files with image
linux-distro: Deploy devicetree files
linux-custom: Deploy devicetree files

meta/classes/image.bbclass | 11 --------
meta/recipes-kernel/linux/linux-custom.inc | 13 +++++++++
meta/recipes-kernel/linux/linux-distro.bb | 31 ++++++++++++++++++++++
3 files changed, 44 insertions(+), 11 deletions(-)

--
2.44.2

Uladzimir Bely

unread,
Jun 13, 2024, 12:36:45 AMJun 13
to isar-...@googlegroups.com
Task do_copy_boot_files deploy device tree files to the same location
for different images (e.g. -base or -debug). This causes build issue.

Stop deploying devicetree files here and let kernel recipe care about
deployment.

Signed-off-by: Uladzimir Bely <ub...@ilbers.de>
---
meta/classes/image.bbclass | 11 -----------
1 file changed, 11 deletions(-)

diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index ff039438..bf669953 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -351,17 +351,6 @@ do_copy_boot_files() {
cp -f "$initrd" '${DEPLOYDIR}/${INITRD_DEPLOY_FILE}'
fi
fi
-
- for file in ${DTB_FILES}; do
- dtb="$(find '${IMAGE_ROOTFS}/usr/lib' -type f \
- -iwholename '*linux-image-*/'${file} | head -1)"
-
- if [ -z "$dtb" -o ! -e "$dtb" ]; then
- die "${file} not found"
- fi
-
- cp -f "$dtb" "${DEPLOYDIR}/"
- done
}
addtask copy_boot_files before do_rootfs_postprocess after do_rootfs_install

--
2.44.2

Uladzimir Bely

unread,
Jun 13, 2024, 12:36:46 AMJun 13
to isar-...@googlegroups.com
Deploy devicetree files with the custom kernel package instead of
using image recipe.

Signed-off-by: Uladzimir Bely <ub...@ilbers.de>
---
meta/recipes-kernel/linux/linux-custom.inc | 13 +++++++++++++
1 file changed, 13 insertions(+)

diff --git a/meta/recipes-kernel/linux/linux-custom.inc b/meta/recipes-kernel/linux/linux-custom.inc
index 647f09dd..c45dad4b 100644
--- a/meta/recipes-kernel/linux/linux-custom.inc
+++ b/meta/recipes-kernel/linux/linux-custom.inc
@@ -278,3 +278,16 @@ EOF
do_dpkg_source:prepend() {
dpkg_configure_kernel
}
+
+do_deploy[dirs] = "${DEPLOY_DIR_IMAGE}"
+do_deploy[cleandirs] = "${WORKDIR}/deploy"
+do_deploy() {
+ dpkg --fsys-tarfile ${WORKDIR}/linux-image-${KERNEL_NAME}_${CHANGELOG_V}_${PACKAGE_ARCH}.deb | \
+ tar --wildcards --extract --directory ${WORKDIR}/deploy ./usr/lib/linux-image-*
+ for dtb in ${DTB_FILES}; do
+ mkdir -p ${DEPLOY_DIR_IMAGE}/$(dirname ${dtb})
+ find ${WORKDIR}/deploy/usr/lib/linux-image* -path "*${dtb}" -print \
+ -exec cp {} ${DEPLOY_DIR_IMAGE}/${dtb} \;
+ done
+}
+addtask deploy before do_deploy_deb after do_dpkg_build
--
2.44.2

Uladzimir Bely

unread,
Jun 13, 2024, 12:36:46 AMJun 13
to isar-...@googlegroups.com
For targets using distro kernel create .deb that includes devicetree
binaries taken from correspoinding "linux-image-*" distro package.

This .deb is then used to deploy devicetree files outside of image
recipe.

Signed-off-by: Uladzimir Bely <ub...@ilbers.de>
---
meta/recipes-kernel/linux/linux-distro.bb | 31 +++++++++++++++++++++++
1 file changed, 31 insertions(+)

diff --git a/meta/recipes-kernel/linux/linux-distro.bb b/meta/recipes-kernel/linux/linux-distro.bb
index d4f6026d..df858a8a 100644
--- a/meta/recipes-kernel/linux/linux-distro.bb
+++ b/meta/recipes-kernel/linux/linux-distro.bb
@@ -21,3 +21,34 @@ python() {
}

inherit multiarch
+
+inherit dpkg-raw
+DEBIAN_BUILD_DEPENDS = "linux-image-${KERNEL_NAME}"
+
+do_prepare_build:prepend() {
+ mkdir -p ${D}/usr/lib/${PN}
+}
+
+do_prepare_build:append() {
+ cat <<EOF >> ${S}/debian/rules
+
+override_dh_auto_build:
+EOF
+ for dtb in ${DTB_FILES}; do
+ mkdir -p ${D}/usr/lib/${PN}/$(dirname ${dtb})
+ ppdir=${PP}/image/usr/lib/${PN}/$(dirname ${dtb})
+ cat <<EOF >> ${S}/debian/rules
+ find /usr/lib/linux-image* -path "*${dtb}" -print -exec cp {} ${ppdir} \;
+EOF
+ done
+}
+
+do_deploy[dirs] = "${DEPLOY_DIR_IMAGE}"
+do_deploy() {
+ for dtb in ${DTB_FILES}; do
+ dpkg --fsys-tarfile ${WORKDIR}/${PN}_${CHANGELOG_V}_${PACKAGE_ARCH}.deb | \
+ tar xOf - ./usr/lib/${PN}/${dtb} \
+ > ${DEPLOY_DIR_IMAGE}/${dtb}

Liu, Yi

unread,
Jun 20, 2024, 11:20:24 PMJun 20
to isar-...@googlegroups.com
This patch works well for my isar image installer case. Thanks!

Best Regards,
Liu Yi
--
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/isar-users/20240613043635.21239-1-ubely%40ilbers.de.
Reply all
Reply to author
Forward
0 new messages