@@ -1,7 +1,7 @@
#
# CIP Core, generic profile
#
-# Copyright (c) Siemens AG, 2020-2023
+# Copyright (c) Siemens AG, 2020-2024
#
# Authors:
# Christian Storm <christian.storm@siemens.com>
@@ -11,6 +11,7 @@
# SPDX-License-Identifier: MIT
inherit template
+inherit efibootguard
SWU_ROOTFS_TYPE ?= "squashfs"
SWU_ROOTFS_NAME ?= "${IMAGE_FULLNAME}"
@@ -22,6 +23,9 @@ SWU_NAME ?= "cip software update"
# space separated list of supported hw. Leave empty to leave out
SWU_HW_COMPAT ?= ""
+SWU_EBG_UPDATE ?= ""
+SWU_EFI_BOOT_DEVICE ?= "/dev/disk/by-uuid/4321-DCBA"
+
SWU_IMAGE_FILE ?= "${DEPLOY_DIR_IMAGE}/${IMAGE_FULLNAME}.swu"
SWU_DESCRIPTION_FILE ?= "sw-description"
SWU_ADDITIONAL_FILES ?= "linux.efi ${SWU_ROOTFS_PARTITION_NAME}"
@@ -47,7 +51,14 @@ IMAGE_TEMPLATE_VARS:swu = " \
SWU_HW_COMPAT_NODE \
SWU_COMPRESSION_NODE \
SWU_VERSION \
- SWU_NAME"
+ SWU_NAME \
+ SWU_FILE_NODES \
+ "
+
+# Add the bootloader file
+def efi_bootloader_name(d):
+ efi_arch = distro_to_efi_arch(d)
+ return "boot{}.efi".format(efi_arch)
# TARGET_IMAGE_UUID needs to be generated before completing the template
addtask do_transform_template after do_generate_image_uuid
@@ -83,6 +94,25 @@ python add_swu_compression(){
d.setVar('SWU_COMPRESSION_NODE', '')
}
+SWU_EXTEND_SW_DESCRIPTION += "${@ 'add_ebg_update' if d.getVar('SWU_EBG_UPDATE') == '1' else ''}"
+python add_ebg_update(){
+ efi_boot_loader_file = efi_bootloader_name(d)
+ efi_boot_device = d.getVar('SWU_EFI_BOOT_DEVICE')
+ swu_ebg_update_node = f""",
+ {{
+ filename = "{efi_boot_loader_file}";
+ path = "EFI/BOOT/{efi_boot_loader_file}";
+ device = "{efi_boot_device}";
+ filesystem = "vfat";
+ sha256 = "{efi_boot_loader_file}-sha256";
+ properties: {{
+ atomic-install = "true";
+ }};
+ }}
+ """
+ d.appendVar('SWU_FILE_NODES', swu_ebg_update_node)
+ d.appendVar('SWU_ADDITIONAL_FILES', " " + efi_boot_loader_file)
+}
# convert between swupdate compressor name and imagetype extension
def get_swu_compression_type(d):
@@ -34,5 +34,5 @@ software =
subtype = "kernel";
};
sha256 = "linux.efi-sha256";
- });
+ }${SWU_FILE_NODES});
}