diff mbox series

[2/3] runqemu: support rootfs-dbg flag in QB_FSINFO

Message ID 20261002114848.1126256-2-andrej.kozemcak@siemens.com
State New
Headers show
Series [1/3] qemu: enable pseudo for nfs rootfs export | expand

Commit Message

Andrej Kozemcak Oct. 2, 2026, 11:48 a.m. UTC
Add parsing for a new 'rootfs-dbg' flag on tar-based filesystem
types in QB_FSINFO. When set, runqemu appends '-dbg' to the
IMAGE_LINK_NAME used to locate the rootfs tarball for NFS
extraction, allowing use of the debug rootfs variant.

QB_FSINFO: additional filesystem metadata, as a space-separated list of
"fstype:flag" entries, e.g., "wic:no-kernel-in-fs tar:rootfs-dbg"
Supported flags include "wic:no-kernel-in-fs" or "wic:kernel-in-fs"
to select whether a WIC image contains the kernel in the filesystem,
and "tar:rootfs-dbg" to tell runqemu to use the debug rootfs image.

Signed-off-by: Andrej Kozemcak <andrej.kozemcak@siemens.com>
---
 scripts/runqemu | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/scripts/runqemu b/scripts/runqemu
index 2c126e7f54..ad6e03feb6 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -197,6 +197,7 @@  class BaseConfig(object):
         self.portlocks = {}
         self.bitbake_e = ''
         self.snapshot = False
+        self.rootfs_dbg = False
         self.wictypes = ('wic.zst', 'wic', 'wic.vmdk', 'wic.qcow2', 'wic.vdi', "wic.vhd", "wic.vhdx")
         self.tartypes = ('tar.zst', 'tar.bz2', 'tar.gz', 'tar.xz', 'tar')
         self.fstypes = ('ext2', 'ext3', 'ext4', 'ext2.zst', 'ext3.zst', 'ext4.zst',
@@ -686,7 +687,7 @@  to your build configuration.
             else:
                 raise RunQemuError("FSTYPE is NULL!")
 
-        # parse QB_FSINFO into dict, e.g. { 'wic': ['no-kernel-in-fs', 'a-flag'], 'ext4': ['another-flag']}
+        # parse QB_FSINFO into dict, e.g. { 'wic': ['no-kernel-in-fs', 'a-flag'], 'tar': ['rootfs-dbg']}
         wic_fs = False
         qb_fsinfo = self.get('QB_FSINFO')
         if qb_fsinfo:
@@ -703,6 +704,12 @@  to your build configuration.
                         else:
                             logger.warning('Unknown flag "%s:%s" in QB_FSINFO', fstype, fsflag)
                             continue
+                    elif fstype in ('tar',) + self.tartypes:
+                        if fsflag == 'rootfs-dbg':
+                            self.rootfs_dbg = True
+                        else:
+                            logger.warning('Unknown flag "%s:%s" in QB_FSINFO', fstype, fsflag)
+                            continue
                     else:
                         logger.warning('QB_FSINFO is not supported for image type "%s"', fstype)
                         continue
@@ -1079,7 +1086,10 @@  to your build configuration.
 
         # Extract .tar* if no nfs dir
         if not (self.rootfs and os.path.isdir(self.rootfs)):
-            src_prefix = '%s/%s' % (self.get('DEPLOY_DIR_IMAGE'), self.get('IMAGE_LINK_NAME'))
+            image_link_name = self.get('IMAGE_LINK_NAME')
+            if self.rootfs_dbg:
+                image_link_name += '-dbg'
+            src_prefix = '%s/%s' % (self.get('DEPLOY_DIR_IMAGE'), image_link_name)
             dest = "%s-nfsroot" % src_prefix
             if os.path.exists('%s.pseudo_state' % dest):
                 logger.info('Use %s as NFS_DIR' % dest)