Message ID | 20240126172011.1590119-1-Quirin.Gylstorff@siemens.com (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
Series | [isar-cip-core,v2] swupdate.bbclass: Move ebg_update to efibootguard.bbclass | expand |
On 26.01.24 18:19, Quirin Gylstorff wrote: > From: Quirin Gylstorff <quirin.gylstorff@siemens.com> > > This avoids a transient inclusion of efibootguard to all images due > to `swupdate` added as a FSTYPE in the layer.conf. > > Reported-by: Felix Moessbauer <felix.moessbauer@siemens.com> > Tested-by: Felix Moessbauer <felix.moessbauer@siemens.com> > Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com> > --- > Changes v2: > - Fix subject > - add Reported and Tested-by > > classes/efibootguard.bbclass | 29 +++++++++++++++++++++++++++++ > classes/swupdate.bbclass | 30 ------------------------------ > 2 files changed, 29 insertions(+), 30 deletions(-) > > diff --git a/classes/efibootguard.bbclass b/classes/efibootguard.bbclass > index 26291b7..31fcdcc 100644 > --- a/classes/efibootguard.bbclass > +++ b/classes/efibootguard.bbclass > @@ -40,3 +40,32 @@ def distro_to_lib_arch(d): > return DISTRO_TO_LIB_ARCH[distro_arch] > > EFI_LIB_ARCH := "${@distro_to_lib_arch(d)}" > + > +# Add the bootloader file > +def efi_bootloader_name(d): > + efi_arch = distro_to_efi_arch(d) > + return "boot{}.efi".format(efi_arch) > + > +SWU_EXTEND_SW_DESCRIPTION += "add_ebg_update" > +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.setVar('SWU_BOOTLOADER_FILE_NODE', swu_ebg_update_node) > + ebg_update = d.getVar('SWU_EBG_UPDATE') or "" > + if ebg_update: > + d.appendVar('SWU_FILE_NODES', "," + swu_ebg_update_node) > + d.appendVar('SWU_ADDITIONAL_FILES', " " + efi_boot_loader_file) > +} > diff --git a/classes/swupdate.bbclass b/classes/swupdate.bbclass > index 8f1215d..403bdef 100644 > --- a/classes/swupdate.bbclass > +++ b/classes/swupdate.bbclass > @@ -11,7 +11,6 @@ > # SPDX-License-Identifier: MIT > > inherit template > -inherit efibootguard > > SWU_ROOTFS_TYPE ?= "squashfs" > SWU_ROOTFS_NAME ?= "${IMAGE_FULLNAME}" > @@ -60,11 +59,6 @@ IMAGE_TEMPLATE_VARS:swu = " \ > SWU_BOOTLOADER_FILE_NODE \ > " > > -# 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 > > @@ -99,30 +93,6 @@ python add_swu_compression(){ > d.setVar('SWU_COMPRESSION_NODE', '') > } > > -SWU_EXTEND_SW_DESCRIPTION += "add_ebg_update" > -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.setVar('SWU_BOOTLOADER_FILE_NODE', swu_ebg_update_node) > - ebg_update = d.getVar('SWU_EBG_UPDATE') or "" > - if ebg_update: > - 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): > swu_ct = d.getVar('SWU_COMPRESSION_TYPE') Thanks, applied. Jan
diff --git a/classes/efibootguard.bbclass b/classes/efibootguard.bbclass index 26291b7..31fcdcc 100644 --- a/classes/efibootguard.bbclass +++ b/classes/efibootguard.bbclass @@ -40,3 +40,32 @@ def distro_to_lib_arch(d): return DISTRO_TO_LIB_ARCH[distro_arch] EFI_LIB_ARCH := "${@distro_to_lib_arch(d)}" + +# Add the bootloader file +def efi_bootloader_name(d): + efi_arch = distro_to_efi_arch(d) + return "boot{}.efi".format(efi_arch) + +SWU_EXTEND_SW_DESCRIPTION += "add_ebg_update" +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.setVar('SWU_BOOTLOADER_FILE_NODE', swu_ebg_update_node) + ebg_update = d.getVar('SWU_EBG_UPDATE') or "" + if ebg_update: + d.appendVar('SWU_FILE_NODES', "," + swu_ebg_update_node) + d.appendVar('SWU_ADDITIONAL_FILES', " " + efi_boot_loader_file) +} diff --git a/classes/swupdate.bbclass b/classes/swupdate.bbclass index 8f1215d..403bdef 100644 --- a/classes/swupdate.bbclass +++ b/classes/swupdate.bbclass @@ -11,7 +11,6 @@ # SPDX-License-Identifier: MIT inherit template -inherit efibootguard SWU_ROOTFS_TYPE ?= "squashfs" SWU_ROOTFS_NAME ?= "${IMAGE_FULLNAME}" @@ -60,11 +59,6 @@ IMAGE_TEMPLATE_VARS:swu = " \ SWU_BOOTLOADER_FILE_NODE \ " -# 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 @@ -99,30 +93,6 @@ python add_swu_compression(){ d.setVar('SWU_COMPRESSION_NODE', '') } -SWU_EXTEND_SW_DESCRIPTION += "add_ebg_update" -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.setVar('SWU_BOOTLOADER_FILE_NODE', swu_ebg_update_node) - ebg_update = d.getVar('SWU_EBG_UPDATE') or "" - if ebg_update: - 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): swu_ct = d.getVar('SWU_COMPRESSION_TYPE')