diff mbox series

[meta-swupdate,3/4] swupdate_class: enable building .swu images via swu image fstype

Message ID 20210211103807.9022-4-agust@denx.de
State Changes Requested
Headers show
Series Extend swupdate class to support swu image fstype | expand

Commit Message

Anatolij Gustschin Feb. 11, 2021, 10:38 a.m. UTC
Extend swupdate class to support swu image type. To use this in
an image recipe following changes should be appended in it:

 - inherit swupdate class
 - add SRC_URI with sw-description (and more required files)
 - add IMAGE_FSTYPES, i.e. "ext4.gz swu" or "ext4.gz.enc swu"
 - SWUPDATE_IMAGES_FSTYPES[core-image-full-cmdline] = ".ext4.gz"
 - IMAGE_DEPENDS = "core-image-full-cmdline"
 - SWUPDATE_IMAGES = "core-image-full-cmdline"

Signed-off-by: Anatolij Gustschin <agust@denx.de>
---
 classes/swupdate.bbclass | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
diff mbox series

Patch

diff --git a/classes/swupdate.bbclass b/classes/swupdate.bbclass
index 70b855f..4112970 100644
--- a/classes/swupdate.bbclass
+++ b/classes/swupdate.bbclass
@@ -32,6 +32,8 @@ 
 #   image file with exactly the name as specified in SWUPDATE_IMAGES is searched for.
 
 inherit swupdate-common.bbclass
+inherit swupdate-enc
+inherit image_types
 
 S = "${WORKDIR}/${PN}"
 
@@ -190,3 +192,21 @@  PACKAGE_ARCH = "${MACHINE_ARCH}"
 
 INHIBIT_DEFAULT_DEPS = "1"
 EXCLUDE_FROM_WORLD = "1"
+
+IMAGE_CMD_swu () {
+    # We cannot use existing python swupdate class code here,
+    # so this is a dummy command to make image_types class work.
+    # The .swu image generation is in separate do_swuimage task.
+}
+
+clean_swuimages () {
+    cd ${DEPLOY_DIR_IMAGE}
+    rm -rf ${IMAGE_LINK_NAME}*.swu
+}
+
+do_clean_swuimage[doc] = "Removes .swu output files from image deploy dir"
+do_clean_swuimage[nostamp] = "1"
+python do_clean_swuimage () {
+    bb.build.exec_func('clean_swuimages', d)
+}
+addtask clean_swuimage after do_rootfs before do_image