From: Jan Kiszka <jan.kiszka@siemens.com>
To: isar-users <isar-users@googlegroups.com>
Cc: Chao Zeng <chao.zeng@siemens.com>, Le Jin <le.jin@siemens.com>
Subject: [PATCH] image: Add support for deploying multiple DTBs
Date: Fri, 20 Mar 2020 07:03:19 +0100 [thread overview]
Message-ID: <ee5e3964-0cf7-8f98-ddfa-85b116bf5ea3@siemens.com> (raw)
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
reply other threads:[~2020-03-20 6:03 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ee5e3964-0cf7-8f98-ddfa-85b116bf5ea3@siemens.com \
--to=jan.kiszka@siemens.com \
--cc=chao.zeng@siemens.com \
--cc=isar-users@googlegroups.com \
--cc=le.jin@siemens.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox