diff mbox series

[isar-cip-core,v2] classes/squashfs.bbclass: exclude boot dir for efibootguard bootloader

Message ID 20240723100631.75683-1-srinuvasan.a@siemens.com (mailing list archive)
State Rejected
Headers show
Series [isar-cip-core,v2] classes/squashfs.bbclass: exclude boot dir for efibootguard bootloader | expand

Commit Message

Arjunan, Srinu July 23, 2024, 10:06 a.m. UTC
From: srinuvasan <srinuvasan.a@siemens.com>

efibootguard based bootloader boot the system using linux.efi (UKI) and it has
the necessary boot files to boot the system, hence we added boot dir as the exclude dir
in squashfs root file system to remove the contents from the boot dir.

Signed-off-by: srinuvasan <srinuvasan.a@siemens.com>
---
 classes/squashfs.bbclass | 3 +++
 1 file changed, 3 insertions(+)

Comments

Jan Kiszka July 31, 2024, 5:01 p.m. UTC | #1
On 23.07.24 12:06, srinuvasan.a@siemens.com wrote:
> From: srinuvasan <srinuvasan.a@siemens.com>
>
> efibootguard based bootloader boot the system using linux.efi (UKI) and it has
> the necessary boot files to boot the system, hence we added boot dir as the exclude dir
> in squashfs root file system to remove the contents from the boot dir.
>
> Signed-off-by: srinuvasan <srinuvasan.a@siemens.com>
> ---
>  classes/squashfs.bbclass | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/classes/squashfs.bbclass b/classes/squashfs.bbclass
> index b39be0c..2582ce2 100644
> --- a/classes/squashfs.bbclass
> +++ b/classes/squashfs.bbclass
> @@ -23,6 +23,7 @@ def get_free_mem():
>  IMAGER_INSTALL:squashfs += "squashfs-tools"
>
>  SQUASHFS_EXCLUDE_DIRS ?= ""
> +SQUASHFS_EXCLUDE_DIRS_EFI ?= "boot"
>  SQUASHFS_CONTENT ?= "${PP_ROOTFS}"
>  SQUASHFS_CREATION_ARGS ?= ""
>
> @@ -31,6 +32,8 @@ SQUASHFS_MEMLIMIT ?= "${@int(get_free_mem() * 3/4)}"
>  SQUASHFS_CREATION_LIMITS = "-mem ${SQUASHFS_MEMLIMIT} -processors ${SQUASHFS_THREADS}"
>
>  python __anonymous() {
> +    if (d.getVar('SWUPDATE_BOOTLOADER') == 'efibootguard'):
> +        d.setVar('SQUASHFS_EXCLUDE_DIRS', '${SQUASHFS_EXCLUDE_DIRS_EFI}')

I still don't get why we should carry this knowledge here. It is also
mixing up "EFI" with "efibootguard" - there is no efibootguard without
EFI, but the other way around is possible.

And then it is the image recipe or - even closer - the wks file that
brings it all together, the fact that squashfs is used for rootfs (and
only for that?!?), that there is some boot folder that is not needed twice.

Jan

>      exclude_directories = d.getVar('SQUASHFS_EXCLUDE_DIRS').split()
>      if len(exclude_directories) == 0:
>          return
Felix Moessbauer Aug. 1, 2024, 6:33 a.m. UTC | #2
On Wed, 2024-07-31 at 19:01 +0200, Jan Kiszka wrote:
> On 23.07.24 12:06, srinuvasan.a@siemens.com wrote:
> > From: srinuvasan <srinuvasan.a@siemens.com>
> > 
> > efibootguard based bootloader boot the system using linux.efi (UKI)
> > and it has
> > the necessary boot files to boot the system, hence we added boot
> > dir as the exclude dir
> > in squashfs root file system to remove the contents from the boot
> > dir.
> > 
> > Signed-off-by: srinuvasan <srinuvasan.a@siemens.com>
> > ---
> >  classes/squashfs.bbclass | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/classes/squashfs.bbclass b/classes/squashfs.bbclass
> > index b39be0c..2582ce2 100644
> > --- a/classes/squashfs.bbclass
> > +++ b/classes/squashfs.bbclass
> > @@ -23,6 +23,7 @@ def get_free_mem():
> >  IMAGER_INSTALL:squashfs += "squashfs-tools"
> > 
> >  SQUASHFS_EXCLUDE_DIRS ?= ""
> > +SQUASHFS_EXCLUDE_DIRS_EFI ?= "boot"
> >  SQUASHFS_CONTENT ?= "${PP_ROOTFS}"
> >  SQUASHFS_CREATION_ARGS ?= ""
> > 
> > @@ -31,6 +32,8 @@ SQUASHFS_MEMLIMIT ?= "${@int(get_free_mem() *
> > 3/4)}"
> >  SQUASHFS_CREATION_LIMITS = "-mem ${SQUASHFS_MEMLIMIT} -processors
> > ${SQUASHFS_THREADS}"
> > 
> >  python __anonymous() {
> > +    if (d.getVar('SWUPDATE_BOOTLOADER') == 'efibootguard'):
> > +        d.setVar('SQUASHFS_EXCLUDE_DIRS',
> > '${SQUASHFS_EXCLUDE_DIRS_EFI}')
> 
> I still don't get why we should carry this knowledge here. It is also
> mixing up "EFI" with "efibootguard" - there is no efibootguard
> without
> EFI, but the other way around is possible.

I would rather just add the /boot dir to the generic
SQUASHFS_EXCLUDE_DIRS variable. There is no need to dispatch based on
the bootloader (as we can exclude dirs which are not present as well).

> 
> And then it is the image recipe or - even closer - the wks file that
> brings it all together, the fact that squashfs is used for rootfs
> (and
> only for that?!?), that there is some boot folder that is not needed
> twice.

I don't know why the squashfs rootfs was modeled as bbclass and not as
part of the wic imaging. This already created problems in the past, as
the fstab in the squashfs is the one from the rootfs and not the
patched one from wic.

Changing this might be a some effort, due to its integration in the
swupdate class, though.

Felix

> 
> Jan
> 
> >      exclude_directories =
> > d.getVar('SQUASHFS_EXCLUDE_DIRS').split()
> >      if len(exclude_directories) == 0:
> >          return
>
diff mbox series

Patch

diff --git a/classes/squashfs.bbclass b/classes/squashfs.bbclass
index b39be0c..2582ce2 100644
--- a/classes/squashfs.bbclass
+++ b/classes/squashfs.bbclass
@@ -23,6 +23,7 @@  def get_free_mem():
 IMAGER_INSTALL:squashfs += "squashfs-tools"
 
 SQUASHFS_EXCLUDE_DIRS ?= ""
+SQUASHFS_EXCLUDE_DIRS_EFI ?= "boot"
 SQUASHFS_CONTENT ?= "${PP_ROOTFS}"
 SQUASHFS_CREATION_ARGS ?= ""
 
@@ -31,6 +32,8 @@  SQUASHFS_MEMLIMIT ?= "${@int(get_free_mem() * 3/4)}"
 SQUASHFS_CREATION_LIMITS = "-mem ${SQUASHFS_MEMLIMIT} -processors ${SQUASHFS_THREADS}"
 
 python __anonymous() {
+    if (d.getVar('SWUPDATE_BOOTLOADER') == 'efibootguard'):
+        d.setVar('SQUASHFS_EXCLUDE_DIRS', '${SQUASHFS_EXCLUDE_DIRS_EFI}')
     exclude_directories = d.getVar('SQUASHFS_EXCLUDE_DIRS').split()
     if len(exclude_directories) == 0:
         return