diff mbox series

qemuboot.bbclass: regenerate .qemuboot.conf after do_image

Message ID 20260601112329.142238-1-sivakumar.bs@gmail.com
State Changes Requested
Headers show
Series qemuboot.bbclass: regenerate .qemuboot.conf after do_image | expand

Commit Message

Siva Kumar Balasubramanian June 1, 2026, 11:23 a.m. UTC
do_write_qemuboot_conf was chained after do_rootfs, so it only ran
when the rootfs was rebuilt. If only the kernel was rebuilt (or any
change that regenerates the image without invalidating the rootfs
sstate), the .qemuboot.conf was left stale while new image artifacts
were deployed with a new timestamp suffix. This caused runqemu to
reference mismatched or missing artifacts.

Move the task to run after do_image instead, so the conf file is
always consistent with whatever was last deployed.

Fixes: https://bugzilla.yoctoproject.org/show_bug.cgi?id=14520
Signed-off-by: Siva Balasubramanian <sivakumar.bs@gmail.com>
---
 meta/classes-recipe/qemuboot.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Richard Purdie June 1, 2026, 12:58 p.m. UTC | #1
On Mon, 2026-06-01 at 16:53 +0530, Siva Balasubramanian via lists.openembedded.org wrote:
> do_write_qemuboot_conf was chained after do_rootfs, so it only ran
> when the rootfs was rebuilt. If only the kernel was rebuilt (or any
> change that regenerates the image without invalidating the rootfs
> sstate), the .qemuboot.conf was left stale while new image artifacts
> were deployed with a new timestamp suffix. This caused runqemu to
> reference mismatched or missing artifacts.
> 
> Move the task to run after do_image instead, so the conf file is
> always consistent with whatever was last deployed.
> 
> Fixes: https://bugzilla.yoctoproject.org/show_bug.cgi?id=14520
> Signed-off-by: Siva Balasubramanian <sivakumar.bs@gmail.com>
> ---
>  meta/classes-recipe/qemuboot.bbclass | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/meta/classes-recipe/qemuboot.bbclass b/meta/classes-recipe/qemuboot.bbclass
> index 56106b1958..47ce16935f 100644
> --- a/meta/classes-recipe/qemuboot.bbclass
> +++ b/meta/classes-recipe/qemuboot.bbclass
> @@ -127,7 +127,7 @@ QB_DRIVE_TYPE ?= "/dev/sd"
>  inherit image-artifact-names
>  
>  # Create qemuboot.conf
> -addtask do_write_qemuboot_conf after do_rootfs before do_image
> +addtask do_write_qemuboot_conf after do_image before do_build
>  
>  def qemuboot_vars(d):
>      build_vars = ['MACHINE', 'TUNE_ARCH', 'DEPLOY_DIR_IMAGE',

Shouldn't we be fixing the task's dependencies so that it runs at the
right time anything it references changes? 

I'm not really seeing how this will improve things if to use your
example, the kernel is rebuilt since you haven't added a dependency on
that...

Cheers,

Richard
Siva Kumar Balasubramanian June 1, 2026, 1:57 p.m. UTC | #2
Thank you for the review.

You are right, the fix needs proper [depends] declarations rather than
just reordering. I will look at what the conf file actually references
and add the appropriate task dependencies so do_write_qemuboot_conf is
correctly invalidated whenever those artifacts change.

Will send a v2 shortly.

On Mon, Jun 1, 2026 at 6:28 PM Richard Purdie <
richard.purdie@linuxfoundation.org> wrote:

> On Mon, 2026-06-01 at 16:53 +0530, Siva Balasubramanian via
> lists.openembedded.org wrote:
> > do_write_qemuboot_conf was chained after do_rootfs, so it only ran
> > when the rootfs was rebuilt. If only the kernel was rebuilt (or any
> > change that regenerates the image without invalidating the rootfs
> > sstate), the .qemuboot.conf was left stale while new image artifacts
> > were deployed with a new timestamp suffix. This caused runqemu to
> > reference mismatched or missing artifacts.
> >
> > Move the task to run after do_image instead, so the conf file is
> > always consistent with whatever was last deployed.
> >
> > Fixes: https://bugzilla.yoctoproject.org/show_bug.cgi?id=14520
> > Signed-off-by: Siva Balasubramanian <sivakumar.bs@gmail.com>
> > ---
> >  meta/classes-recipe/qemuboot.bbclass | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/meta/classes-recipe/qemuboot.bbclass
> b/meta/classes-recipe/qemuboot.bbclass
> > index 56106b1958..47ce16935f 100644
> > --- a/meta/classes-recipe/qemuboot.bbclass
> > +++ b/meta/classes-recipe/qemuboot.bbclass
> > @@ -127,7 +127,7 @@ QB_DRIVE_TYPE ?= "/dev/sd"
> >  inherit image-artifact-names
> >
> >  # Create qemuboot.conf
> > -addtask do_write_qemuboot_conf after do_rootfs before do_image
> > +addtask do_write_qemuboot_conf after do_image before do_build
> >
> >  def qemuboot_vars(d):
> >      build_vars = ['MACHINE', 'TUNE_ARCH', 'DEPLOY_DIR_IMAGE',
>
> Shouldn't we be fixing the task's dependencies so that it runs at the
> right time anything it references changes?
>
> I'm not really seeing how this will improve things if to use your
> example, the kernel is rebuilt since you haven't added a dependency on
> that...
>
> Cheers,
>
> Richard
>
Mark Hatle June 1, 2026, 2:29 p.m. UTC | #3
On 6/1/26 8:57 AM, Siva Balasubramanian via lists.openembedded.org wrote:
> Thank you for the review.
> 
> You are right, the fix needs proper [depends] declarations rather than
> just reordering. I will look at what the conf file actually references
> and add the appropriate task dependencies so do_write_qemuboot_conf is
> correctly invalidated whenever those artifacts change.
> 
> Will send a v2 shortly.

Just adding a dependency on virtual/kernel or linux-yocto or... it's right 
either.  We have firmware and baremetal components that use QEMU that we depend 
on as well.

So this dependency mechanism is needed, but it's not as simple as just hard 
coding Linux.

--Mark

> On Mon, Jun 1, 2026 at 6:28 PM Richard Purdie 
> <richard.purdie@linuxfoundation.org <mailto:richard.purdie@linuxfoundation.org>> 
> wrote:
> 
>     On Mon, 2026-06-01 at 16:53 +0530, Siva Balasubramanian via
>     lists.openembedded.org <http://lists.openembedded.org> wrote:
>      > do_write_qemuboot_conf was chained after do_rootfs, so it only ran
>      > when the rootfs was rebuilt. If only the kernel was rebuilt (or any
>      > change that regenerates the image without invalidating the rootfs
>      > sstate), the .qemuboot.conf was left stale while new image artifacts
>      > were deployed with a new timestamp suffix. This caused runqemu to
>      > reference mismatched or missing artifacts.
>      >
>      > Move the task to run after do_image instead, so the conf file is
>      > always consistent with whatever was last deployed.
>      >
>      > Fixes: https://bugzilla.yoctoproject.org/show_bug.cgi?id=14520
>     <https://bugzilla.yoctoproject.org/show_bug.cgi?id=14520>
>      > Signed-off-by: Siva Balasubramanian <sivakumar.bs@gmail.com
>     <mailto:sivakumar.bs@gmail.com>>
>      > ---
>      >  meta/classes-recipe/qemuboot.bbclass | 2 +-
>      >  1 file changed, 1 insertion(+), 1 deletion(-)
>      >
>      > diff --git a/meta/classes-recipe/qemuboot.bbclass
>     b/meta/classes-recipe/qemuboot.bbclass
>      > index 56106b1958..47ce16935f 100644
>      > --- a/meta/classes-recipe/qemuboot.bbclass
>      > +++ b/meta/classes-recipe/qemuboot.bbclass
>      > @@ -127,7 +127,7 @@ QB_DRIVE_TYPE ?= "/dev/sd"
>      >  inherit image-artifact-names
>      >
>      >  # Create qemuboot.conf
>      > -addtask do_write_qemuboot_conf after do_rootfs before do_image
>      > +addtask do_write_qemuboot_conf after do_image before do_build
>      >
>      >  def qemuboot_vars(d):
>      >      build_vars = ['MACHINE', 'TUNE_ARCH', 'DEPLOY_DIR_IMAGE',
> 
>     Shouldn't we be fixing the task's dependencies so that it runs at the
>     right time anything it references changes?
> 
>     I'm not really seeing how this will improve things if to use your
>     example, the kernel is rebuilt since you haven't added a dependency on
>     that...
> 
>     Cheers,
> 
>     Richard
> 
> 
> 
> -- 
> 
> Sivakumar B
> 
> 
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#237834): https://lists.openembedded.org/g/openembedded-core/message/237834
> Mute This Topic: https://lists.openembedded.org/mt/119588648/3616948
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [mark.hatle@kernel.crashing.org]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Siva Kumar Balasubramanian June 1, 2026, 5:03 p.m. UTC | #4
v2 sent. Used KERNEL_DEPLOY_DEPEND which is already used by
do_build[depends] in image.bbclass for the same reason.

Tested on qemux86-64, linux-yocto 6.18.33 do_write_qemuboot_conf
reruns correctly after kernel rebuild.

https://lists.openembedded.org/g/openembedded-core/topic/patch_v2_qemuboot_bbclass/119596210

On Mon, Jun 1, 2026 at 7:27 PM Siva Kumar Balasubramanian <
sivakumar.bs@gmail.com> wrote:

> Thank you for the review.
>
> You are right, the fix needs proper [depends] declarations rather than
> just reordering. I will look at what the conf file actually references
> and add the appropriate task dependencies so do_write_qemuboot_conf is
> correctly invalidated whenever those artifacts change.
>
> Will send a v2 shortly.
>
> On Mon, Jun 1, 2026 at 6:28 PM Richard Purdie <
> richard.purdie@linuxfoundation.org> wrote:
>
>> On Mon, 2026-06-01 at 16:53 +0530, Siva Balasubramanian via
>> lists.openembedded.org wrote:
>> > do_write_qemuboot_conf was chained after do_rootfs, so it only ran
>> > when the rootfs was rebuilt. If only the kernel was rebuilt (or any
>> > change that regenerates the image without invalidating the rootfs
>> > sstate), the .qemuboot.conf was left stale while new image artifacts
>> > were deployed with a new timestamp suffix. This caused runqemu to
>> > reference mismatched or missing artifacts.
>> >
>> > Move the task to run after do_image instead, so the conf file is
>> > always consistent with whatever was last deployed.
>> >
>> > Fixes: https://bugzilla.yoctoproject.org/show_bug.cgi?id=14520
>> > Signed-off-by: Siva Balasubramanian <sivakumar.bs@gmail.com>
>> > ---
>> >  meta/classes-recipe/qemuboot.bbclass | 2 +-
>> >  1 file changed, 1 insertion(+), 1 deletion(-)
>> >
>> > diff --git a/meta/classes-recipe/qemuboot.bbclass
>> b/meta/classes-recipe/qemuboot.bbclass
>> > index 56106b1958..47ce16935f 100644
>> > --- a/meta/classes-recipe/qemuboot.bbclass
>> > +++ b/meta/classes-recipe/qemuboot.bbclass
>> > @@ -127,7 +127,7 @@ QB_DRIVE_TYPE ?= "/dev/sd"
>> >  inherit image-artifact-names
>> >
>> >  # Create qemuboot.conf
>> > -addtask do_write_qemuboot_conf after do_rootfs before do_image
>> > +addtask do_write_qemuboot_conf after do_image before do_build
>> >
>> >  def qemuboot_vars(d):
>> >      build_vars = ['MACHINE', 'TUNE_ARCH', 'DEPLOY_DIR_IMAGE',
>>
>> Shouldn't we be fixing the task's dependencies so that it runs at the
>> right time anything it references changes?
>>
>> I'm not really seeing how this will improve things if to use your
>> example, the kernel is rebuilt since you haven't added a dependency on
>> that...
>>
>> Cheers,
>>
>> Richard
>>
>
>
> --
>
> Sivakumar B
>
diff mbox series

Patch

diff --git a/meta/classes-recipe/qemuboot.bbclass b/meta/classes-recipe/qemuboot.bbclass
index 56106b1958..47ce16935f 100644
--- a/meta/classes-recipe/qemuboot.bbclass
+++ b/meta/classes-recipe/qemuboot.bbclass
@@ -127,7 +127,7 @@  QB_DRIVE_TYPE ?= "/dev/sd"
 inherit image-artifact-names
 
 # Create qemuboot.conf
-addtask do_write_qemuboot_conf after do_rootfs before do_image
+addtask do_write_qemuboot_conf after do_image before do_build
 
 def qemuboot_vars(d):
     build_vars = ['MACHINE', 'TUNE_ARCH', 'DEPLOY_DIR_IMAGE',