From: Adriaan Schmidt <adriaan.schmidt@siemens.com>
To: <isar-users@googlegroups.com>
Cc: Adriaan Schmidt <adriaan.schmidt@siemens.com>
Subject: [PATCH v3 3/3] image: include all types and add tasks on demand
Date: Fri, 17 Dec 2021 10:10:30 +0100 [thread overview]
Message-ID: <20211217091030.474380-4-adriaan.schmidt@siemens.com> (raw)
In-Reply-To: <20211217091030.474380-1-adriaan.schmidt@siemens.com>
To make the new SDK generation scheme work, we need to change the way
image tasks are added. Because IMAGE_FSTYPES can change during recipe
parsing when building the -sdk variant, image type classes must not
automatically add their do_*_image tasks.
Instead, we now always include all image types, and only enable
the tasks dynamically.
NOTE: This should NOT be merged. It is just to demo the new
SDK extension.
Signed-off-by: Adriaan Schmidt <adriaan.schmidt@siemens.com>
---
meta/classes/container-img.bbclass | 2 --
meta/classes/cpiogz-img.bbclass | 1 -
meta/classes/ext4-img.bbclass | 1 -
meta/classes/fit-img.bbclass | 2 +-
meta/classes/image.bbclass | 22 +++++++++++++++++++++-
meta/classes/targz-img.bbclass | 1 -
meta/classes/ubi-img.bbclass | 4 ++--
meta/classes/ubifs-img.bbclass | 3 +--
meta/classes/wic-img.bbclass | 1 -
9 files changed, 25 insertions(+), 12 deletions(-)
diff --git a/meta/classes/container-img.bbclass b/meta/classes/container-img.bbclass
index 8fef52a..70cecf4 100644
--- a/meta/classes/container-img.bbclass
+++ b/meta/classes/container-img.bbclass
@@ -15,5 +15,3 @@ do_container_image(){
bbdebug 1 "Generate container image in these formats: ${CONTAINER_FORMATS}"
containerize_rootfs "${IMAGE_ROOTFS}" "${rootfs_id}" "${CONTAINER_FORMATS}"
}
-
-addtask container_image before do_image after do_image_tools
diff --git a/meta/classes/cpiogz-img.bbclass b/meta/classes/cpiogz-img.bbclass
index 2a49456..cacde0a 100644
--- a/meta/classes/cpiogz-img.bbclass
+++ b/meta/classes/cpiogz-img.bbclass
@@ -18,5 +18,4 @@ do_cpiogz_image() {
sudo chown $(id -u):$(id -g) ${CPIOGZ_IMAGE_FILE}
}
-addtask cpiogz_image before do_image after do_image_tools
do_cpiogz_image[dirs] = "${DEPLOY_DIR_IMAGE}"
diff --git a/meta/classes/ext4-img.bbclass b/meta/classes/ext4-img.bbclass
index 5085afc..4b4f26e 100644
--- a/meta/classes/ext4-img.bbclass
+++ b/meta/classes/ext4-img.bbclass
@@ -19,6 +19,5 @@ do_ext4_image() {
-F -d '${PP_ROOTFS}' '${PP_DEPLOY}/${EXT4_IMAGE_FILE}'
}
-addtask ext4_image before do_image after do_image_tools
do_ext4_image[prefuncs] = 'set_image_size'
do_ext4_image[dirs] = "${DEPLOY_DIR_IMAGE}"
diff --git a/meta/classes/fit-img.bbclass b/meta/classes/fit-img.bbclass
index 1ad0c5b..2c91153 100644
--- a/meta/classes/fit-img.bbclass
+++ b/meta/classes/fit-img.bbclass
@@ -25,5 +25,5 @@ do_fit_image() {
-f '${PP_WORK}/${FIT_IMAGE_SOURCE}' '${PP_DEPLOY}/${FIT_IMAGE_FILE}'
sudo chown $(id -u):$(id -g) '${DEPLOY_DIR_IMAGE}/${FIT_IMAGE_FILE}'
}
-addtask fit_image before do_image after do_image_tools do_transform_template
+addtask fit_image after do_transform_template
do_fit_image[dirs] = "${DEPLOY_DIR_IMAGE}"
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index d2512d3..c21de30 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -225,4 +225,24 @@ EOSUDO
addtask rootfs_finalize before do_rootfs after do_rootfs_postprocess
# Last so that the image type can overwrite tasks if needed
-inherit ${IMAGE_FSTYPES}
+inherit container-img cpiogz-img ext4-img fit-img targz-img ubi-img ubifs-img wic-img
+
+python() {
+ fstypes = d.getVar('IMAGE_FSTYPES').split()
+ if 'container-img' in fstypes:
+ bb.build.addtask('container_image', 'do_image', 'do_image_tools', d)
+ if 'cpiogz-img' in fstypes:
+ bb.build.addtask('cpiogz_image', 'do_image', 'do_image_tools', d)
+ if 'ext4-img' in fstypes:
+ bb.build.addtask('ext4_image', 'do_image', 'do_image_tools', d)
+ if 'fit-img' in fstypes:
+ bb.build.addtask('fit_image', 'do_image', 'do_image_tools', d)
+ if 'targz-img' in fstypes:
+ bb.build.addtask('targz_image', 'do_image', 'do_image_tools', d)
+ if 'ubi-img' in fstypes:
+ bb.build.addtask('ubi_image', 'do_image', 'do_image_tools', d)
+ if 'unifs-img' in fstypes:
+ bb.build.addtask('ubifs_image', 'do_image', 'do_image_tools', d)
+ if 'wic-img' in fstypes:
+ bb.build.addtask('wic_image', 'do_image', 'do_image_tools', d)
+}
diff --git a/meta/classes/targz-img.bbclass b/meta/classes/targz-img.bbclass
index bf94af0..d96304f 100644
--- a/meta/classes/targz-img.bbclass
+++ b/meta/classes/targz-img.bbclass
@@ -11,5 +11,4 @@ do_targz_image() {
sudo chown $(id -u):$(id -g) ${TARGZ_IMAGE_FILE}
}
-addtask targz_image before do_image after do_image_tools
do_targz_image[dirs] = "${DEPLOY_DIR_IMAGE}"
diff --git a/meta/classes/ubi-img.bbclass b/meta/classes/ubi-img.bbclass
index efaf058..db2bf18 100644
--- a/meta/classes/ubi-img.bbclass
+++ b/meta/classes/ubi-img.bbclass
@@ -4,7 +4,7 @@
# SPDX-License-Identifier: MIT
python() {
- if not d.getVar("UBINIZE_ARGS"):
+ if "ubi-img" in d.getVar("IMAGE_FSTYPES").split() and not d.getVar("UBINIZE_ARGS"):
raise bb.parse.SkipRecipe("UBINIZE_ARGS must be set")
}
@@ -28,5 +28,5 @@ do_ubi_image() {
-o '${PP_DEPLOY}/${UBI_IMAGE_FILE}' '${PP_WORK}/${UBINIZE_CFG}'
sudo chown $(id -u):$(id -g) '${DEPLOY_DIR_IMAGE}/${UBI_IMAGE_FILE}'
}
-addtask ubi_image before do_image after do_image_tools do_transform_template
+addtask ubi_image after do_transform_template
do_ubi_image[dirs] = "${DEPLOY_DIR_IMAGE}"
diff --git a/meta/classes/ubifs-img.bbclass b/meta/classes/ubifs-img.bbclass
index 229eb3e..8488e7c 100644
--- a/meta/classes/ubifs-img.bbclass
+++ b/meta/classes/ubifs-img.bbclass
@@ -4,7 +4,7 @@
# SPDX-License-Identifier: MIT
python() {
- if not d.getVar("MKUBIFS_ARGS"):
+ if "ubifs-img" in d.getVar("IMAGE_FSTYPES").split() and not d.getVar("MKUBIFS_ARGS"):
raise bb.parse.SkipRecipe("mkubifs_args must be set")
}
@@ -28,5 +28,4 @@ do_ubifs_image() {
sudo chown $(id -u):$(id -g) '${DEPLOY_DIR_IMAGE}/${UBIFS_IMAGE_FILE}'
}
-addtask ubifs_image before do_image after do_image_tools
do_ubifs_image[dirs] = "${DEPLOY_DIR_IMAGE}"
diff --git a/meta/classes/wic-img.bbclass b/meta/classes/wic-img.bbclass
index 80ca5f7..c12d880 100644
--- a/meta/classes/wic-img.bbclass
+++ b/meta/classes/wic-img.bbclass
@@ -150,7 +150,6 @@ python do_wic_image() {
bb.build.exec_func(cmd, d)
progress_reporter.finish()
}
-addtask wic_image before do_image after do_image_tools
wic_do_mounts() {
buildchroot_do_mounts
--
2.30.2
prev parent reply other threads:[~2021-12-17 9:10 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-17 9:10 [PATCH v3 0/3] sdk: make SDK an image Adriaan Schmidt
2021-12-17 9:10 ` [PATCH v3 1/3] image: remove IMAGE_SUFFIX Adriaan Schmidt
2021-12-17 10:22 ` Jan Kiszka
2021-12-17 9:10 ` [PATCH v3 2/3] image: refactor SDK Adriaan Schmidt
2021-12-17 9:10 ` Adriaan Schmidt [this message]
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=20211217091030.474380-4-adriaan.schmidt@siemens.com \
--to=adriaan.schmidt@siemens.com \
--cc=isar-users@googlegroups.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