diff mbox series

[isar-cip-core] swupdate.bbclass: Remove

Message ID 20240126090719.634980-1-Quirin.Gylstorff@siemens.com (mailing list archive)
State Superseded
Headers show
Series [isar-cip-core] swupdate.bbclass: Remove | expand

Commit Message

Gylstorff Quirin Jan. 26, 2024, 9:06 a.m. UTC
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.

Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
---
 classes/efibootguard.bbclass | 29 +++++++++++++++++++++++++++++
 classes/swupdate.bbclass     | 30 ------------------------------
 2 files changed, 29 insertions(+), 30 deletions(-)

Comments

Felix Moessbauer Jan. 26, 2024, 9:58 a.m. UTC | #1
On Fri, 2024-01-26 at 10:06 +0100, 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.

Hi Quirin,

I tested this in a non-cip layer (without ebg) and can confirm that EBG
is no longer erroneously included into the image.

Reported-by: Felix Moessbauer <felix.moessbauer@siemens.com>
Tested-by: Felix Moessbauer <felix.moessbauer@siemens.com>

Felix

> 
> Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
> ---
>  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')
diff mbox series

Patch

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')