From: Adrian Freihofer <[email protected]>

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 <[email protected]>
---
 meta/classes-recipe/qemuboot.bbclass | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

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")
-- 
2.55.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#242576): 
https://lists.openembedded.org/g/openembedded-core/message/242576
Mute This Topic: https://lists.openembedded.org/mt/120567641/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to