diff mbox series

[isar-cip-core] wic: Use INITRD_DEPLOY_FILE instead IMAGE_INITRD

Message ID 20230419102926.1331225-1-Quirin.Gylstorff@siemens.com (mailing list archive)
State Changes Requested
Headers show
Series [isar-cip-core] wic: Use INITRD_DEPLOY_FILE instead IMAGE_INITRD | expand

Commit Message

Gylstorff Quirin April 19, 2023, 10:29 a.m. UTC
From: Quirin Gylstorff <quirin.gylstorff@siemens.com>

With commit https://github.com/ilbers/isar/commit/f0608683fd18f96319332f2ea3827536bd2fd761 the variable
INITRD_DEPLOY_FILE should be used for creating the wic image,  see [1].

[1]: https://github.com/ilbers/isar/blob/master/RECIPE-API-CHANGELOG.md#working-with-a-custom-initramfs

Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
---
 recipes-core/images/efibootguard.inc                | 2 +-
 scripts/lib/wic/plugins/source/efibootguard-boot.py | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

Comments

Jan Kiszka April 19, 2023, 12:20 p.m. UTC | #1
On 19.04.23 12:29, Quirin Gylstorff wrote:
> From: Quirin Gylstorff <quirin.gylstorff@siemens.com>
> 
> With commit https://github.com/ilbers/isar/commit/f0608683fd18f96319332f2ea3827536bd2fd761 the variable
> INITRD_DEPLOY_FILE should be used for creating the wic image,  see [1].
> 
> [1]: https://github.com/ilbers/isar/blob/master/RECIPE-API-CHANGELOG.md#working-with-a-custom-initramfs
> 

What's the impact of not doing this so far?

Ja

> Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
> ---
>  recipes-core/images/efibootguard.inc                | 2 +-
>  scripts/lib/wic/plugins/source/efibootguard-boot.py | 4 ++--
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/recipes-core/images/efibootguard.inc b/recipes-core/images/efibootguard.inc
> index cdf5558..1de452a 100644
> --- a/recipes-core/images/efibootguard.inc
> +++ b/recipes-core/images/efibootguard.inc
> @@ -12,5 +12,5 @@
>  IMAGE_INSTALL:append = " efibootguard"
>  WIC_IMAGER_INSTALL:append = " efibootguard:${DISTRO_ARCH}"
>  WDOG_TIMEOUT ?= "60"
> -WICVARS += "WDOG_TIMEOUT KERNEL_IMAGE INITRD_IMAGE DTB_FILES"
> +WICVARS += "WDOG_TIMEOUT KERNEL_IMAGE INITRD_DEPLOY_FILE DTB_FILES"
>  IMAGE_FSTYPES += "wic"
> diff --git a/scripts/lib/wic/plugins/source/efibootguard-boot.py b/scripts/lib/wic/plugins/source/efibootguard-boot.py
> index 0de28ca..7435b22 100644
> --- a/scripts/lib/wic/plugins/source/efibootguard-boot.py
> +++ b/scripts/lib/wic/plugins/source/efibootguard-boot.py
> @@ -60,9 +60,9 @@ class EfibootguardBootPlugin(SourcePlugin):
>              kernel_image = "vmlinuz"
>          boot_image = kernel_image
>  
> -        initrd_image = get_bitbake_var("INITRD_IMAGE")
> +        initrd_image = get_bitbake_var("INITRD_DEPLOY_FILE")
>          if not initrd_image:
> -            msger.warning("INITRD_IMAGE not set\n")
> +            msger.warning("INITRD_DEPLOY_FILE not set\n")
>              initrd_image = "initrd.img"
>          bootloader = creator.ks.bootloader
>
MOESSBAUER, Felix April 19, 2023, 1:52 p.m. UTC | #2
On Wed, 2023-04-19 at 14:20 +0200, Jan Kiszka wrote:
> On 19.04.23 12:29, Quirin Gylstorff wrote:
> > From: Quirin Gylstorff <quirin.gylstorff@siemens.com>
> > 
> > With commit
> > https://github.com/ilbers/isar/commit/f0608683fd18f96319332f2ea3827536bd2fd761
> >  the variable
> > INITRD_DEPLOY_FILE should be used for creating the wic image,  see
> > [1].
> > 
> > [1]:
> > https://github.com/ilbers/isar/blob/master/RECIPE-API-CHANGELOG.md#working-with-a-custom-initramfs
> > 
> 
> What's the impact of not doing this so far?

It breaks the build (wic) when using ebg in combination with the stock
initrd from the image. In this case, the INITRD_IMAGE variable is
empty, hence wic with ebg plugin cannot find the initrd and fails.

In cip-core, we always use a custom initrd (by that INITRD_IMAGE is
correctly defined), which hides the problem. However, in some
downstream layers we had ebg + stock initrd and there it broke.

IMHO this should be fixed in the 1.x release as well.

Felix

> 
> Ja
> 
> > Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
> > ---
> >  recipes-core/images/efibootguard.inc                | 2 +-
> >  scripts/lib/wic/plugins/source/efibootguard-boot.py | 4 ++--
> >  2 files changed, 3 insertions(+), 3 deletions(-)
> > 
> > diff --git a/recipes-core/images/efibootguard.inc b/recipes-
> > core/images/efibootguard.inc
> > index cdf5558..1de452a 100644
> > --- a/recipes-core/images/efibootguard.inc
> > +++ b/recipes-core/images/efibootguard.inc
> > @@ -12,5 +12,5 @@
> >  IMAGE_INSTALL:append = " efibootguard"
> >  WIC_IMAGER_INSTALL:append = " efibootguard:${DISTRO_ARCH}"
> >  WDOG_TIMEOUT ?= "60"
> > -WICVARS += "WDOG_TIMEOUT KERNEL_IMAGE INITRD_IMAGE DTB_FILES"
> > +WICVARS += "WDOG_TIMEOUT KERNEL_IMAGE INITRD_DEPLOY_FILE
> > DTB_FILES"
> >  IMAGE_FSTYPES += "wic"
> > diff --git a/scripts/lib/wic/plugins/source/efibootguard-boot.py
> > b/scripts/lib/wic/plugins/source/efibootguard-boot.py
> > index 0de28ca..7435b22 100644
> > --- a/scripts/lib/wic/plugins/source/efibootguard-boot.py
> > +++ b/scripts/lib/wic/plugins/source/efibootguard-boot.py
> > @@ -60,9 +60,9 @@ class EfibootguardBootPlugin(SourcePlugin):
> >              kernel_image = "vmlinuz"
> >          boot_image = kernel_image
> >  
> > -        initrd_image = get_bitbake_var("INITRD_IMAGE")
> > +        initrd_image = get_bitbake_var("INITRD_DEPLOY_FILE")
> >          if not initrd_image:
> > -            msger.warning("INITRD_IMAGE not set\n")
> > +            msger.warning("INITRD_DEPLOY_FILE not set\n")
> >              initrd_image = "initrd.img"
> >          bootloader = creator.ks.bootloader
> >  
>
MOESSBAUER, Felix April 19, 2023, 1:56 p.m. UTC | #3
On Wed, 2023-04-19 at 12:29 +0200, Quirin Gylstorff wrote:
> From: Quirin Gylstorff <quirin.gylstorff@siemens.com>
> 
> With commit
> https://github.com/ilbers/isar/commit/f0608683fd18f96319332f2ea3827536bd2fd761
>  the variable
> INITRD_DEPLOY_FILE should be used for creating the wic image,  see
> [1].
> 
> [1]:
> https://github.com/ilbers/isar/blob/master/RECIPE-API-CHANGELOG.md#working-with-a-custom-initramfs
> 
> Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>

I tested this in a downstream layer without a custom initrd and can
confirm that this fixes the issue. Please note, that I'm also the
author of the mentioned commit in ISAR. The ISAR fix was required to
fix a race condition on the deployment of the initrd.

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

> ---
>  recipes-core/images/efibootguard.inc                | 2 +-
>  scripts/lib/wic/plugins/source/efibootguard-boot.py | 4 ++--
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/recipes-core/images/efibootguard.inc b/recipes-
> core/images/efibootguard.inc
> index cdf5558..1de452a 100644
> --- a/recipes-core/images/efibootguard.inc
> +++ b/recipes-core/images/efibootguard.inc
> @@ -12,5 +12,5 @@
>  IMAGE_INSTALL:append = " efibootguard"
>  WIC_IMAGER_INSTALL:append = " efibootguard:${DISTRO_ARCH}"
>  WDOG_TIMEOUT ?= "60"
> -WICVARS += "WDOG_TIMEOUT KERNEL_IMAGE INITRD_IMAGE DTB_FILES"
> +WICVARS += "WDOG_TIMEOUT KERNEL_IMAGE INITRD_DEPLOY_FILE DTB_FILES"
>  IMAGE_FSTYPES += "wic"
> diff --git a/scripts/lib/wic/plugins/source/efibootguard-boot.py
> b/scripts/lib/wic/plugins/source/efibootguard-boot.py
> index 0de28ca..7435b22 100644
> --- a/scripts/lib/wic/plugins/source/efibootguard-boot.py
> +++ b/scripts/lib/wic/plugins/source/efibootguard-boot.py
> @@ -60,9 +60,9 @@ class EfibootguardBootPlugin(SourcePlugin):
>              kernel_image = "vmlinuz"
>          boot_image = kernel_image
>  
> -        initrd_image = get_bitbake_var("INITRD_IMAGE")
> +        initrd_image = get_bitbake_var("INITRD_DEPLOY_FILE")
>          if not initrd_image:
> -            msger.warning("INITRD_IMAGE not set\n")
> +            msger.warning("INITRD_DEPLOY_FILE not set\n")
>              initrd_image = "initrd.img"
>          bootloader = creator.ks.bootloader
>
Jan Kiszka April 19, 2023, 8:04 p.m. UTC | #4
On 19.04.23 15:52, Moessbauer, Felix wrote:
> On Wed, 2023-04-19 at 14:20 +0200, Jan Kiszka wrote:
>> On 19.04.23 12:29, Quirin Gylstorff wrote:
>>> From: Quirin Gylstorff <quirin.gylstorff@siemens.com>
>>>
>>> With commit
>>> https://github.com/ilbers/isar/commit/f0608683fd18f96319332f2ea3827536bd2fd761
>>>  the variable
>>> INITRD_DEPLOY_FILE should be used for creating the wic image,  see
>>> [1].
>>>
>>> [1]:
>>> https://github.com/ilbers/isar/blob/master/RECIPE-API-CHANGELOG.md#working-with-a-custom-initramfs
>>>
>>
>> What's the impact of not doing this so far?
> 
> It breaks the build (wic) when using ebg in combination with the stock
> initrd from the image. In this case, the INITRD_IMAGE variable is
> empty, hence wic with ebg plugin cannot find the initrd and fails.
> 
> In cip-core, we always use a custom initrd (by that INITRD_IMAGE is
> correctly defined), which hides the problem. However, in some
> downstream layers we had ebg + stock initrd and there it broke.
> 
> IMHO this should be fixed in the 1.x release as well.
> 

Thanks, folded that in to the commit message and rebased it. Result in next.

Jan
diff mbox series

Patch

diff --git a/recipes-core/images/efibootguard.inc b/recipes-core/images/efibootguard.inc
index cdf5558..1de452a 100644
--- a/recipes-core/images/efibootguard.inc
+++ b/recipes-core/images/efibootguard.inc
@@ -12,5 +12,5 @@ 
 IMAGE_INSTALL:append = " efibootguard"
 WIC_IMAGER_INSTALL:append = " efibootguard:${DISTRO_ARCH}"
 WDOG_TIMEOUT ?= "60"
-WICVARS += "WDOG_TIMEOUT KERNEL_IMAGE INITRD_IMAGE DTB_FILES"
+WICVARS += "WDOG_TIMEOUT KERNEL_IMAGE INITRD_DEPLOY_FILE DTB_FILES"
 IMAGE_FSTYPES += "wic"
diff --git a/scripts/lib/wic/plugins/source/efibootguard-boot.py b/scripts/lib/wic/plugins/source/efibootguard-boot.py
index 0de28ca..7435b22 100644
--- a/scripts/lib/wic/plugins/source/efibootguard-boot.py
+++ b/scripts/lib/wic/plugins/source/efibootguard-boot.py
@@ -60,9 +60,9 @@  class EfibootguardBootPlugin(SourcePlugin):
             kernel_image = "vmlinuz"
         boot_image = kernel_image
 
-        initrd_image = get_bitbake_var("INITRD_IMAGE")
+        initrd_image = get_bitbake_var("INITRD_DEPLOY_FILE")
         if not initrd_image:
-            msger.warning("INITRD_IMAGE not set\n")
+            msger.warning("INITRD_DEPLOY_FILE not set\n")
             initrd_image = "initrd.img"
         bootloader = creator.ks.bootloader