diff mbox series

[v2,1/3] qemu: enable pseudo for nfs rootfs export

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

Commit Message

Andrej Kozemcak Oct. 6, 2026, 9:06 a.m. UTC
Testimage.bbclass can now boot from nfs, but pseudo is globally
disabled by default in the environment. This corrupts file access
rights when qemu boots from nfs, causing failures. Explicitly
enable pseudo in runqemu-export-rootfs since it is required here.
Explicitly enable pseudo during rootfs extraction so an inherited
PSEUDO_DISABLED=1 does not lose archive ownership before NFS export.

Also export OECORE_NATIVE_SYSROOT from qemurunner so
runqemu-export-rootfs can locate pseudo without needing a second
tinfoil connection.

Skip the snapshot tmpfs copy for NFS rootfs directories, which cannot
be copied as disk-image files.

Signed-off-by: Andrej Kozemcak <andrej.kozemcak@siemens.com>
---
 meta/lib/oeqa/utils/qemurunner.py  | 4 ++++
 scripts/lib/pseudo_rootfs_utils.py | 1 +
 scripts/runqemu                    | 2 +-
 scripts/runqemu-export-rootfs      | 2 ++
 4 files changed, 8 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/meta/lib/oeqa/utils/qemurunner.py b/meta/lib/oeqa/utils/qemurunner.py
index 5979b52650..1a83c01ea8 100644
--- a/meta/lib/oeqa/utils/qemurunner.py
+++ b/meta/lib/oeqa/utils/qemurunner.py
@@ -166,6 +166,10 @@  class QemuRunner:
         if self.tmpfsdir:
             env["RUNQEMU_TMPFS_DIR"] = self.tmpfsdir
 
+        if self.native_sysroot:
+            # Needed by runqemu-export-rootfs (avoid a second tinfoil connection)
+            env["OECORE_NATIVE_SYSROOT"] = self.native_sysroot
+
         if not launch_cmd:
             launch_cmd = 'runqemu %s' % ('snapshot' if discard_writes else '')
             if self.use_kvm:
diff --git a/scripts/lib/pseudo_rootfs_utils.py b/scripts/lib/pseudo_rootfs_utils.py
index 12431e2080..e539a69f82 100644
--- a/scripts/lib/pseudo_rootfs_utils.py
+++ b/scripts/lib/pseudo_rootfs_utils.py
@@ -97,6 +97,7 @@  def extract_sdk_rootfs(rootfs_tarball, rootfs_dir, pseudo_cmd, environment):
     environment = dict(environment)
     environment['PSEUDO_LOCALSTATEDIR'] = state_dir
     environment['PSEUDO_INCLUDE_PATHS'] = rootfs_dir
+    environment['PSEUDO_DISABLED'] = '0'
 
     command = list(pseudo_cmd) + ['tar', '-C', rootfs_dir] + tar_options + [rootfs_tarball]
     print('Extracting rootfs tarball using pseudo...')
diff --git a/scripts/runqemu b/scripts/runqemu
index 2c126e7f54..74a00e5481 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -1289,7 +1289,7 @@  to your build configuration.
         rootfs_format = self.fstype if self.fstype in ('vmdk', 'vhd', 'vhdx', 'qcow2', 'vdi') else 'raw'
 
         tmpfsdir = os.environ.get("RUNQEMU_TMPFS_DIR", None)
-        if self.snapshot and tmpfsdir:
+        if self.snapshot and tmpfsdir and self.fstype != 'nfs':
             newrootfs = os.path.join(tmpfsdir, os.path.basename(self.rootfs)) + "." + str(os.getpid())
             logger.info("Copying rootfs to %s" % newrootfs)
             copy_start = time.time()
diff --git a/scripts/runqemu-export-rootfs b/scripts/runqemu-export-rootfs
index 150513bc50..ff19a0ccc9 100755
--- a/scripts/runqemu-export-rootfs
+++ b/scripts/runqemu-export-rootfs
@@ -58,6 +58,8 @@  PSEUDO_LOCALSTATEDIR="$NFS_EXPORT_DIR/../$(basename $NFS_EXPORT_DIR).pseudo_stat
 export PSEUDO_LOCALSTATEDIR
 PSEUDO_INCLUDE_PATHS="$NFS_EXPORT_DIR"
 export PSEUDO_INCLUDE_PATHS
+# Enable pseudo
+export PSEUDO_DISABLED=0
 
 if [ ! -d "$PSEUDO_LOCALSTATEDIR" ]; then
 	echo "Error: $PSEUDO_LOCALSTATEDIR does not exist."