diff mbox series

[01/14] qemuboot: make do_write_qemuboot_conf a standalone sstate task

Message ID 20260802195324.64533-2-adrian.freihofer@siemens.com
State New
Headers show
Series devtool ide-sdk: clang and lldb support | expand

Commit Message

AdrianF Aug. 2, 2026, 7:52 p.m. UTC
From: Adrian Freihofer <adrian.freihofer@siemens.com>

There seems to be still some corner cases where the qemuboot.conf file
is not deployed reliably.

Previously do_write_qemuboot_conf wrote its output into IMGDEPLOYDIR,
which is shared with do_image_complete. The conf file only reached
DEPLOY_DIR_IMAGE when do_image_complete ran, so for example running:

  bitbake <image> -c write_qemuboot_conf --force

had no visible effect on the deployed conf.

Introduce a dedicated QEMUBOOTCONFDEPLOYDIR and register
do_write_qemuboot_conf as a proper SSTATE task with its own
sstate-inputdirs/sstate-outputdirs pair pointing at DEPLOY_DIR_IMAGE.
A matching do_write_qemuboot_conf_setscene task handles sstate restores.

Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com>
---
 meta/classes-recipe/qemuboot.bbclass | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

Comments

Richard Purdie Aug. 2, 2026, 9:16 p.m. UTC | #1
On Sun, 2026-08-02 at 21:52 +0200, Adrian Freihofer via lists.openembedded.org wrote:
> From: Adrian Freihofer <adrian.freihofer@siemens.com>
> 
> There seems to be still some corner cases where the qemuboot.conf file
> is not deployed reliably.
> 
> Previously do_write_qemuboot_conf wrote its output into IMGDEPLOYDIR,
> which is shared with do_image_complete. The conf file only reached
> DEPLOY_DIR_IMAGE when do_image_complete ran, so for example running:
> 
>   bitbake <image> -c write_qemuboot_conf --force
> 
> had no visible effect on the deployed conf.
> 
> Introduce a dedicated QEMUBOOTCONFDEPLOYDIR and register
> do_write_qemuboot_conf as a proper SSTATE task with its own
> sstate-inputdirs/sstate-outputdirs pair pointing at DEPLOY_DIR_IMAGE.
> A matching do_write_qemuboot_conf_setscene task handles sstate restores.

Which issue is this fixing?

I think this should be running after do_image, before
do_image_complete, which is when the files in IMGDEPLOYDIR are
captured/handled and that is probably the real bug/slightly easier
fix...

Making that change would make it match the other image artefact
generation pieces.

Cheers,

Richard
diff mbox series

Patch

diff --git a/meta/classes-recipe/qemuboot.bbclass b/meta/classes-recipe/qemuboot.bbclass
index d1794c7899..1ced9b9b73 100644
--- a/meta/classes-recipe/qemuboot.bbclass
+++ b/meta/classes-recipe/qemuboot.bbclass
@@ -126,6 +126,11 @@  QB_DRIVE_TYPE ?= "/dev/sd"
 
 inherit image-artifact-names
 
+# Dedicated deploy directory for the qemuboot config, separate from IMGDEPLOYDIR
+# so that do_write_qemuboot_conf can be its own sstate task and deploy its
+# output to DEPLOY_DIR_IMAGE independently of do_image_complete.
+QEMUBOOTCONFDEPLOYDIR = "${WORKDIR}/deploy-${PN}-qemubootconf"
+
 # Create qemuboot.conf
 addtask do_write_qemuboot_conf after do_rootfs before do_image
 do_write_qemuboot_conf[depends] += "${@ '' if bb.utils.to_boolean(d.getVar('INITRAMFS_IMAGE_BUNDLE')) else (d.getVar('KERNEL_DEPLOY_DEPEND') or '')}"
@@ -140,12 +145,22 @@  def qemuboot_vars(d):
 
 do_write_qemuboot_conf[vardeps] += "${@' '.join(qemuboot_vars(d))}"
 do_write_qemuboot_conf[vardepsexclude] += "TOPDIR"
+do_write_qemuboot_conf[dirs] = "${QEMUBOOTCONFDEPLOYDIR}"
+do_write_qemuboot_conf[cleandirs] = "${QEMUBOOTCONFDEPLOYDIR}"
+do_write_qemuboot_conf[stamp-extra-info] = "${MACHINE_ARCH}"
+SSTATETASKS += "do_write_qemuboot_conf"
+do_write_qemuboot_conf[sstate-inputdirs] = "${QEMUBOOTCONFDEPLOYDIR}"
+do_write_qemuboot_conf[sstate-outputdirs] = "${DEPLOY_DIR_IMAGE}"
+python do_write_qemuboot_conf_setscene () {
+    sstate_setscene(d)
+}
+addtask do_write_qemuboot_conf_setscene
 python do_write_qemuboot_conf() {
     import configparser
 
-    qemuboot = "%s/%s.qemuboot.conf" % (d.getVar('IMGDEPLOYDIR'), d.getVar('IMAGE_NAME'))
+    qemuboot = "%s/%s.qemuboot.conf" % (d.getVar('QEMUBOOTCONFDEPLOYDIR'), d.getVar('IMAGE_NAME'))
     if d.getVar('IMAGE_LINK_NAME'):
-        qemuboot_link = "%s/%s.qemuboot.conf" % (d.getVar('IMGDEPLOYDIR'), d.getVar('IMAGE_LINK_NAME'))
+        qemuboot_link = "%s/%s.qemuboot.conf" % (d.getVar('QEMUBOOTCONFDEPLOYDIR'), d.getVar('IMAGE_LINK_NAME'))
     else:
         qemuboot_link = ""
     finalpath = d.getVar("DEPLOY_DIR_IMAGE")