diff mbox series

[meta-zephyr,master] zephyr-qemuboot: use stable ELF symlink to avoid broken runqemu rootfs

Message ID 20260208164458.101865-1-charles.embedded@gmail.com
State New
Headers show
Series [meta-zephyr,master] zephyr-qemuboot: use stable ELF symlink to avoid broken runqemu rootfs | expand

Commit Message

Charles Dias Feb. 8, 2026, 4:44 p.m. UTC
From: Charles Dias <charlesdias.cd@outlook.com>

do_bootconf_write() may update qemuboot.conf and the QEMU ELF symlink to a
new timestamped name while the ELF itself is reused from sstate and not
deployed, leaving a broken symlink and causing runqemu to fail with
"Can't find rootfs: ... .elf".

Fix by making zephyr-qemuboot use the stable link name
(${ZEPHYR_IMAGE_LINK_NAME}.elf / ${PN}-${MACHINE}.elf), which is
guaranteed to exist as a symlink created by zephyr-image.inc and always
points at the most recently deployed ELF.

Signed-off-by: Charles Dias <charlesdias.cd@outlook.com>
---
 meta-zephyr-core/classes-recipe/zephyr-qemuboot.bbclass | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/meta-zephyr-core/classes-recipe/zephyr-qemuboot.bbclass b/meta-zephyr-core/classes-recipe/zephyr-qemuboot.bbclass
index ab0a281..4d8920f 100644
--- a/meta-zephyr-core/classes-recipe/zephyr-qemuboot.bbclass
+++ b/meta-zephyr-core/classes-recipe/zephyr-qemuboot.bbclass
@@ -1,8 +1,8 @@ 
 inherit qemuboot
 
-ZEPHYR_IMAGE_BASE_NAME ?= "${PN}-${MACHINE}${IMAGE_VERSION_SUFFIX}"
+ZEPHYR_IMAGE_LINK_NAME ?= "${PN}-${MACHINE}"
 
-KERNEL_IMAGETYPE = "${ZEPHYR_IMAGE_BASE_NAME}.elf"
+KERNEL_IMAGETYPE = "${ZEPHYR_IMAGE_LINK_NAME}.elf"
 QB_DEFAULT_FSTYPE = "elf"
 QB_NETWORK_DEVICE = "none"
 QB_NET = "none"
@@ -29,7 +29,7 @@  python bootconf_clean() {
 python do_bootconf_write() {
     bb.build.exec_func("do_write_qemuboot_conf", d)
 
-    qemuimage = "%s/%s.elf" % (d.getVar('DEPLOY_DIR_IMAGE', True), d.getVar('ZEPHYR_IMAGE_BASE_NAME', True))
+    qemuimage = "%s/%s.elf" % (d.getVar('DEPLOY_DIR_IMAGE', True), d.getVar('ZEPHYR_IMAGE_LINK_NAME', True))
     qemuimage_link = d.getVar('QEMU_IMAGE_LINK', True)
     if os.path.lexists(qemuimage_link):
         os.remove(qemuimage_link)