Message ID | 20240425094444.404036-3-Adithya.Balakumar@toshiba-tsip.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | Integrate Delta Update with rdiff_image and delta handler | expand |
On 25.04.24 11:44, Adithya Balakumar wrote: > This allows the creation of a swu file for delta update when a delta > update is chosen through the DELTA_UPDATE_TYPE variable > > Signed-off-by: Adithya Balakumar <Adithya.Balakumar@toshiba-tsip.com> > --- > classes/swupdate.bbclass | 27 ++++++++++++++++++--- > recipes-core/images/swu/sw-description.tmpl | 5 ++-- > 2 files changed, 27 insertions(+), 5 deletions(-) > > diff --git a/classes/swupdate.bbclass b/classes/swupdate.bbclass > index 1a7cd4d..e320014 100644 > --- a/classes/swupdate.bbclass > +++ b/classes/swupdate.bbclass > @@ -26,17 +26,21 @@ SWU_EBG_UPDATE ?= "" > SWU_EFI_BOOT_DEVICE ?= "/dev/disk/by-uuid/4321-DCBA" > SWU_BOOTLOADER ??= "ebg" > SWU_DESCRIPITION_FILE_BOOTLOADER ??= "${SWU_DESCRIPTION_FILE}-${SWU_BOOTLOADER}" > +SWU_DELTA_UPDATE_ARTIFACT = "${SWU_ROOTFS_NAME}.delta_update${@get_swu_compression_type(d)}" > +SWU_ROOTFS_ARTIFACT_NAME = "${@ '${SWU_DELTA_UPDATE_ARTIFACT}' if d.getVar('DELTA_UPDATE_TYPE') == "rdiff" or d.getVar('DELTA_UPDATE_TYPE') == "zchunk" else '${SWU_ROOTFS_PARTITION_NAME}'}" Please break this line ("\") so stay samewhere around 100 chars max. > > SWU_IMAGE_FILE ?= "${IMAGE_FULLNAME}" > SWU_DESCRIPTION_FILE ?= "sw-description" > -SWU_ADDITIONAL_FILES ?= "linux.efi ${SWU_ROOTFS_PARTITION_NAME}" > +SWU_ADDITIONAL_FILES ?= "linux.efi ${SWU_ROOTFS_ARTIFACT_NAME}" > SWU_SIGNED ??= "" > SWU_SIGNATURE_EXT ?= "sig" > SWU_SIGNATURE_TYPE ?= "cms" > > SWU_BUILDCHROOT_IMAGE_FILE ?= "${@os.path.basename(d.getVar('SWU_IMAGE_FILE'))}" > > -IMAGE_TYPEDEP:swu = "${SWU_ROOTFS_TYPE}${@get_swu_compression_type(d)}" > +SWU_UPDATE_ARTIFACT_TYPE = "${SWU_ROOTFS_TYPE}${@get_swu_compression_type(d)}" > +SWU_DELTA_UPDATE_ARTIFACT_TYPE = "delta_update${@get_swu_compression_type(d)}" > +IMAGE_TYPEDEP:swu = "${@ '${SWU_DELTA_UPDATE_ARTIFACT_TYPE}' if d.getVar('DELTA_UPDATE_TYPE') == "rdiff" or d.getVar('DELTA_UPDATE_TYPE') == "zchunk" else '${SWU_UPDATE_ARTIFACT_TYPE}' }" Also this line would be more readable if split over two. > IMAGER_BUILD_DEPS:swu += "${@'swupdate-certificates-key' if bb.utils.to_boolean(d.getVar('SWU_SIGNED')) else ''}" > IMAGER_INSTALL:swu += "cpio ${@'openssl swupdate-certificates-key' if bb.utils.to_boolean(d.getVar('SWU_SIGNED')) else ''}" > IMAGE_INSTALL += "${@'swupdate-certificates' if bb.utils.to_boolean(d.getVar('SWU_SIGNED')) else ''}" > @@ -47,7 +51,7 @@ IMAGE_SRC_URI:swu += "file://${SWU_DESCRIPITION_FILE_BOOTLOADER}.tmpl" > IMAGE_TEMPLATE_FILES:swu = "${SWU_DESCRIPTION_FILE}.tmpl" > IMAGE_TEMPLATE_FILES:swu += "${SWU_DESCRIPITION_FILE_BOOTLOADER}.tmpl" > IMAGE_TEMPLATE_VARS:swu = " \ > - SWU_ROOTFS_PARTITION_NAME \ > + SWU_ROOTFS_ARTIFACT_NAME \ > TARGET_IMAGE_UUID \ > ABROOTFS_PART_UUID_A \ > ABROOTFS_PART_UUID_B \ > @@ -58,6 +62,7 @@ IMAGE_TEMPLATE_VARS:swu = " \ > SWU_FILE_NODES \ > SWU_BOOTLOADER_FILE_NODE \ > SWU_SCRIPTS_NODE \ > + SWU_DELTA_UPDATE_PROPERTIES \ > " > > # TARGET_IMAGE_UUID needs to be generated before completing the template > @@ -148,6 +153,22 @@ python add_scripts_node() { > d.appendVar('SWU_SCRIPTS_NODE', swu_scripts_node) > } > > +SWU_EXTEND_SW_DESCRIPTION += "add_swu_delta_update_properties" > +python add_swu_delta_update_properties() { > + delta_type = d.getVar('DELTA_UPDATE_TYPE') > + swu_delta_update_properties = "" > + if delta_type == "rdiff": > + swu_delta_update_properties = 'chainhandler = "rdiff_image";' > + elif delta_type == "zchunk": > + zck_url = d.getVar('DELTA_ZCK_URL') > + swu_delta_update_properties = f""" > + chainhandler = "delta"; > + url = "{zck_url}"; > + zckloglevel = "error"; > + """ > + d.setVar('SWU_DELTA_UPDATE_PROPERTIES', swu_delta_update_properties) > +} > + > # convert between swupdate compressor name and imagetype extension > def get_swu_compression_type(d): > swu_ct = d.getVar('SWU_COMPRESSION_TYPE') > diff --git a/recipes-core/images/swu/sw-description.tmpl b/recipes-core/images/swu/sw-description.tmpl > index 88cb475..f438d99 100644 > --- a/recipes-core/images/swu/sw-description.tmpl > +++ b/recipes-core/images/swu/sw-description.tmpl > @@ -14,15 +14,16 @@ software = > name = "${SWU_NAME}"; > ${SWU_HW_COMPAT_NODE} > images: ({ > - filename = "${SWU_ROOTFS_PARTITION_NAME}"; > + filename = "${SWU_ROOTFS_ARTIFACT_NAME}"; > device = "C:BOOT0:linux.efi->${ABROOTFS_PART_UUID_A},C:BOOT1:linux.efi->${ABROOTFS_PART_UUID_B}"; > type = "roundrobin"; > ${SWU_COMPRESSION_NODE} > properties: { > subtype = "image"; > configfilecheck = "/etc/os-release@not_match@IMAGE_UUID=${TARGET_IMAGE_UUID}"; > + ${SWU_DELTA_UPDATE_PROPERTIES} You are using tabs here, please switch to spaces. > }; > - sha256 = "${SWU_ROOTFS_PARTITION_NAME}-sha256"; > + sha256 = "${SWU_ROOTFS_ARTIFACT_NAME}-sha256"; > }); > files: ({ > filename = "linux.efi"; Jan
diff --git a/classes/swupdate.bbclass b/classes/swupdate.bbclass index 1a7cd4d..e320014 100644 --- a/classes/swupdate.bbclass +++ b/classes/swupdate.bbclass @@ -26,17 +26,21 @@ SWU_EBG_UPDATE ?= "" SWU_EFI_BOOT_DEVICE ?= "/dev/disk/by-uuid/4321-DCBA" SWU_BOOTLOADER ??= "ebg" SWU_DESCRIPITION_FILE_BOOTLOADER ??= "${SWU_DESCRIPTION_FILE}-${SWU_BOOTLOADER}" +SWU_DELTA_UPDATE_ARTIFACT = "${SWU_ROOTFS_NAME}.delta_update${@get_swu_compression_type(d)}" +SWU_ROOTFS_ARTIFACT_NAME = "${@ '${SWU_DELTA_UPDATE_ARTIFACT}' if d.getVar('DELTA_UPDATE_TYPE') == "rdiff" or d.getVar('DELTA_UPDATE_TYPE') == "zchunk" else '${SWU_ROOTFS_PARTITION_NAME}'}" SWU_IMAGE_FILE ?= "${IMAGE_FULLNAME}" SWU_DESCRIPTION_FILE ?= "sw-description" -SWU_ADDITIONAL_FILES ?= "linux.efi ${SWU_ROOTFS_PARTITION_NAME}" +SWU_ADDITIONAL_FILES ?= "linux.efi ${SWU_ROOTFS_ARTIFACT_NAME}" SWU_SIGNED ??= "" SWU_SIGNATURE_EXT ?= "sig" SWU_SIGNATURE_TYPE ?= "cms" SWU_BUILDCHROOT_IMAGE_FILE ?= "${@os.path.basename(d.getVar('SWU_IMAGE_FILE'))}" -IMAGE_TYPEDEP:swu = "${SWU_ROOTFS_TYPE}${@get_swu_compression_type(d)}" +SWU_UPDATE_ARTIFACT_TYPE = "${SWU_ROOTFS_TYPE}${@get_swu_compression_type(d)}" +SWU_DELTA_UPDATE_ARTIFACT_TYPE = "delta_update${@get_swu_compression_type(d)}" +IMAGE_TYPEDEP:swu = "${@ '${SWU_DELTA_UPDATE_ARTIFACT_TYPE}' if d.getVar('DELTA_UPDATE_TYPE') == "rdiff" or d.getVar('DELTA_UPDATE_TYPE') == "zchunk" else '${SWU_UPDATE_ARTIFACT_TYPE}' }" IMAGER_BUILD_DEPS:swu += "${@'swupdate-certificates-key' if bb.utils.to_boolean(d.getVar('SWU_SIGNED')) else ''}" IMAGER_INSTALL:swu += "cpio ${@'openssl swupdate-certificates-key' if bb.utils.to_boolean(d.getVar('SWU_SIGNED')) else ''}" IMAGE_INSTALL += "${@'swupdate-certificates' if bb.utils.to_boolean(d.getVar('SWU_SIGNED')) else ''}" @@ -47,7 +51,7 @@ IMAGE_SRC_URI:swu += "file://${SWU_DESCRIPITION_FILE_BOOTLOADER}.tmpl" IMAGE_TEMPLATE_FILES:swu = "${SWU_DESCRIPTION_FILE}.tmpl" IMAGE_TEMPLATE_FILES:swu += "${SWU_DESCRIPITION_FILE_BOOTLOADER}.tmpl" IMAGE_TEMPLATE_VARS:swu = " \ - SWU_ROOTFS_PARTITION_NAME \ + SWU_ROOTFS_ARTIFACT_NAME \ TARGET_IMAGE_UUID \ ABROOTFS_PART_UUID_A \ ABROOTFS_PART_UUID_B \ @@ -58,6 +62,7 @@ IMAGE_TEMPLATE_VARS:swu = " \ SWU_FILE_NODES \ SWU_BOOTLOADER_FILE_NODE \ SWU_SCRIPTS_NODE \ + SWU_DELTA_UPDATE_PROPERTIES \ " # TARGET_IMAGE_UUID needs to be generated before completing the template @@ -148,6 +153,22 @@ python add_scripts_node() { d.appendVar('SWU_SCRIPTS_NODE', swu_scripts_node) } +SWU_EXTEND_SW_DESCRIPTION += "add_swu_delta_update_properties" +python add_swu_delta_update_properties() { + delta_type = d.getVar('DELTA_UPDATE_TYPE') + swu_delta_update_properties = "" + if delta_type == "rdiff": + swu_delta_update_properties = 'chainhandler = "rdiff_image";' + elif delta_type == "zchunk": + zck_url = d.getVar('DELTA_ZCK_URL') + swu_delta_update_properties = f""" + chainhandler = "delta"; + url = "{zck_url}"; + zckloglevel = "error"; + """ + d.setVar('SWU_DELTA_UPDATE_PROPERTIES', swu_delta_update_properties) +} + # convert between swupdate compressor name and imagetype extension def get_swu_compression_type(d): swu_ct = d.getVar('SWU_COMPRESSION_TYPE') diff --git a/recipes-core/images/swu/sw-description.tmpl b/recipes-core/images/swu/sw-description.tmpl index 88cb475..f438d99 100644 --- a/recipes-core/images/swu/sw-description.tmpl +++ b/recipes-core/images/swu/sw-description.tmpl @@ -14,15 +14,16 @@ software = name = "${SWU_NAME}"; ${SWU_HW_COMPAT_NODE} images: ({ - filename = "${SWU_ROOTFS_PARTITION_NAME}"; + filename = "${SWU_ROOTFS_ARTIFACT_NAME}"; device = "C:BOOT0:linux.efi->${ABROOTFS_PART_UUID_A},C:BOOT1:linux.efi->${ABROOTFS_PART_UUID_B}"; type = "roundrobin"; ${SWU_COMPRESSION_NODE} properties: { subtype = "image"; configfilecheck = "/etc/os-release@not_match@IMAGE_UUID=${TARGET_IMAGE_UUID}"; + ${SWU_DELTA_UPDATE_PROPERTIES} }; - sha256 = "${SWU_ROOTFS_PARTITION_NAME}-sha256"; + sha256 = "${SWU_ROOTFS_ARTIFACT_NAME}-sha256"; }); files: ({ filename = "linux.efi";
This allows the creation of a swu file for delta update when a delta update is chosen through the DELTA_UPDATE_TYPE variable Signed-off-by: Adithya Balakumar <Adithya.Balakumar@toshiba-tsip.com> --- classes/swupdate.bbclass | 27 ++++++++++++++++++--- recipes-core/images/swu/sw-description.tmpl | 5 ++-- 2 files changed, 27 insertions(+), 5 deletions(-)