* [PATCH] image: Add support for deploying multiple DTBs
@ 2020-03-20 6:03 Jan Kiszka
0 siblings, 0 replies; only message in thread
From: Jan Kiszka @ 2020-03-20 6:03 UTC (permalink / raw)
To: isar-users; +Cc: Chao Zeng, Le Jin
From: Jan Kiszka <jan.kiszka@siemens.com>
This allows to support non-distro-boot images which select from multiple
DTBs during boot.
The isar-image-ubi recipe still only supports one DTB file, but that is
an exemplary recipe anyway.
Based on original patch by Chao Zeng.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
RECIPE-API-CHANGELOG.md | 5 +++++
meta-isar/conf/machine/nand-ubi-demo.conf | 2 +-
meta-isar/recipes-core/images/isar-image-ubi.bb | 3 ++-
meta/classes/image.bbclass | 14 ++++++++------
4 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/RECIPE-API-CHANGELOG.md b/RECIPE-API-CHANGELOG.md
index fb04af99..ae3a159c 100644
--- a/RECIPE-API-CHANGELOG.md
+++ b/RECIPE-API-CHANGELOG.md
@@ -224,3 +224,8 @@ In order to get a LOCALVERSION appendix into both the kernel config and the
version information of the self-built packages, the LINUX_VERSION_EXTENSION is
now available. It remains empty by default unless a recipe sets it. The
appended version usually starts with a "-".
+
+### Renamed DTB_FILE to DTB_FILES, adding support for multiple entries
+
+DTB_FILES now allows to specify multiple DTBs that should be deployed for
+consumption by imaging classes.
diff --git a/meta-isar/conf/machine/nand-ubi-demo.conf b/meta-isar/conf/machine/nand-ubi-demo.conf
index e207d402..25ec72f3 100644
--- a/meta-isar/conf/machine/nand-ubi-demo.conf
+++ b/meta-isar/conf/machine/nand-ubi-demo.conf
@@ -10,4 +10,4 @@ MKUBIFS_ARGS := "-m 0x1000 -e 0x3e000 -c 1500"
UBINIZE_ARGS = "-vv -m 0x1000 -p 0x40000"
IMAGE_TYPE ?= "ubi-ubifs-img"
-DTB_FILE = "imx6q-sabrelite.dtb"
+DTB_FILES = "imx6q-sabrelite.dtb"
diff --git a/meta-isar/recipes-core/images/isar-image-ubi.bb b/meta-isar/recipes-core/images/isar-image-ubi.bb
index 3b41f236..04482a2b 100644
--- a/meta-isar/recipes-core/images/isar-image-ubi.bb
+++ b/meta-isar/recipes-core/images/isar-image-ubi.bb
@@ -20,7 +20,8 @@ TEMPLATE_FILES = "ubinize.cfg.tmpl fitimage.its.tmpl"
KERNEL_IMG = "${PP_DEPLOY}/${KERNEL_IMAGE}"
INITRD_IMG = "${PP_DEPLOY}/${INITRD_IMAGE}"
-DTB_IMG = "${PP_DEPLOY}/${DTB_FILE}"
+# only one dtb file supported, pick the first
+DTB_IMG = "${PP_DEPLOY}/${@d.getVar('DTB_FILES').split()[0]}"
UBIFS_IMG = "${PP_DEPLOY}/${UBIFS_IMAGE_FILE}"
FIT_IMG = "${PP_DEPLOY}/${FIT_IMAGE_FILE}"
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index 6bcc6cd2..703ff078 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -19,6 +19,9 @@ IMAGE_FULLNAME = "${PN}-${DISTRO}-${MACHINE}"
KERNEL_IMAGE ?= "${IMAGE_FULLNAME}-${KERNEL_FILE}"
INITRD_IMAGE ?= "${IMAGE_FULLNAME}-initrd.img"
+# This defines the deployed dtbs for reuse by imagers
+DTB_FILES ?= ""
+
# Useful variables for imager implementations:
PP = "/home/builder/${PN}"
PP_DEPLOY = "${PP}/deploy"
@@ -140,17 +143,16 @@ do_copy_boot_files() {
cp -f "$initrd" '${DEPLOY_DIR_IMAGE}/${INITRD_IMAGE}'
fi
- # Check DTB_FILE via inline python to handle unset case:
- if [ -n "${@d.getVar('DTB_FILE', True) or ""}" ]; then
+ for file in ${DTB_FILES}; do
dtb="$(find '${IMAGE_ROOTFS}/usr/lib' -type f \
- -iwholename '*linux-image-*/${DTB_FILE}' | head -1)"
+ -iwholename '*linux-image-*/'${file} | head -1)"
if [ -z "$dtb" -o ! -e "$dtb" ]; then
- die "${DTB_FILE} not found"
+ die "${file} not found"
fi
- cp -f "$dtb" "${DEPLOY_DIR_IMAGE}/${DTB_FILE}"
- fi
+ cp -f "$dtb" "${DEPLOY_DIR_IMAGE}/"
+ done
}
addtask copy_boot_files before do_rootfs_postprocess after do_rootfs_install
--
2.16.4
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-03-20 6:03 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-20 6:03 [PATCH] image: Add support for deploying multiple DTBs Jan Kiszka
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox