diff mbox series

kernel-fitimage: reduce dependency to the cpio

Message ID 20221212221808.753268-1-patrick@stwcx.xyz
State Accepted, archived
Commit ef0d0734866505c1c6e0528a0423e7248afb3ff8
Headers show
Series kernel-fitimage: reduce dependency to the cpio | expand

Commit Message

Patrick Williams Dec. 12, 2022, 10:18 p.m. UTC
In order to build a fitimage, we don't need the image to be "complete"
but we need the cpio portion of it built since the cpio is what ends
up inside the FIT.  By reducing the dependency to `do_image_cpio` we
are able to include an image's rootfs as the ramdisk for a FIT and
then bundle that FIT into a larger SPI flash layout.

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
---
 meta/classes-recipe/kernel-fitimage.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Richard Purdie Dec. 13, 2022, 11:52 p.m. UTC | #1
On Mon, 2022-12-12 at 16:18 -0600, Patrick Williams wrote:
> In order to build a fitimage, we don't need the image to be "complete"
> but we need the cpio portion of it built since the cpio is what ends
> up inside the FIT.  By reducing the dependency to `do_image_cpio` we
> are able to include an image's rootfs as the ramdisk for a FIT and
> then bundle that FIT into a larger SPI flash layout.
> 
> Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
> ---
>  meta/classes-recipe/kernel-fitimage.bbclass | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/meta/classes-recipe/kernel-fitimage.bbclass b/meta/classes-recipe/kernel-fitimage.bbclass
> index 7980910aa8..ccc132482e 100644
> --- a/meta/classes-recipe/kernel-fitimage.bbclass
> +++ b/meta/classes-recipe/kernel-fitimage.bbclass
> @@ -38,7 +38,7 @@ python __anonymous () {
>  
>          image = d.getVar('INITRAMFS_IMAGE')
>          if image:
> -            d.appendVarFlag('do_assemble_fitimage_initramfs', 'depends', ' ${INITRAMFS_IMAGE}:do_image_complete')
> +            d.appendVarFlag('do_assemble_fitimage_initramfs', 'depends', ' ${INITRAMFS_IMAGE}:do_image_cpio')
>  
>          ubootenv = d.getVar('UBOOT_ENV')
>          if ubootenv:

I merged this but then realised you can't do this. The copy to
DEPLOY_DIR_IMAGE happens during do_image_complete so you can't rely on
this to be present until that task. We need the copy and sstate code so
we have a manifest of what is "installed" so we can clean up the task
and replace it with code re-running.

As such I reverted it.

Cheers,

Richard
Patrick Williams Dec. 14, 2022, 3:19 a.m. UTC | #2
Hello Richard,

On Tue, Dec 13, 2022 at 11:52:08PM +0000, Richard Purdie wrote:
> On Mon, 2022-12-12 at 16:18 -0600, Patrick Williams wrote:
> > In order to build a fitimage, we don't need the image to be "complete"
> > but we need the cpio portion of it built since the cpio is what ends
> > up inside the FIT.  By reducing the dependency to `do_image_cpio` we
> > are able to include an image's rootfs as the ramdisk for a FIT and
> > then bundle that FIT into a larger SPI flash layout.
> > 
> > Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
> > ---

> > -            d.appendVarFlag('do_assemble_fitimage_initramfs', 'depends', ' ${INITRAMFS_IMAGE}:do_image_complete')
> > +            d.appendVarFlag('do_assemble_fitimage_initramfs', 'depends', ' ${INITRAMFS_IMAGE}:do_image_cpio')
> 
> I merged this but then realised you can't do this. 
...
> As such I reverted it.

Apologies for that.  It seemed to be working on my end but I was not
going to be surprised if someone told me I had very bad ideas as was
completely overlooking something.

> The copy to
> DEPLOY_DIR_IMAGE happens during do_image_complete so you can't rely on
> this to be present until that task. 

I didn't notice this issue, but I very well could have had stale data in
my DEPLOY_DIR_IMAGE.  I'll investigate further.  Is there any reason
this couldn't be moved?

> We need the copy and sstate code so
> we have a manifest of what is "installed" so we can clean up the task
> and replace it with code re-running.

I'll look into this as well.  Is it fine to make do_image_cpio sstated?
diff mbox series

Patch

diff --git a/meta/classes-recipe/kernel-fitimage.bbclass b/meta/classes-recipe/kernel-fitimage.bbclass
index 7980910aa8..ccc132482e 100644
--- a/meta/classes-recipe/kernel-fitimage.bbclass
+++ b/meta/classes-recipe/kernel-fitimage.bbclass
@@ -38,7 +38,7 @@  python __anonymous () {
 
         image = d.getVar('INITRAMFS_IMAGE')
         if image:
-            d.appendVarFlag('do_assemble_fitimage_initramfs', 'depends', ' ${INITRAMFS_IMAGE}:do_image_complete')
+            d.appendVarFlag('do_assemble_fitimage_initramfs', 'depends', ' ${INITRAMFS_IMAGE}:do_image_cpio')
 
         ubootenv = d.getVar('UBOOT_ENV')
         if ubootenv: