All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] qemu-helper: depend on unfs3 and pseudo directly
@ 2022-11-25 21:15 Alexander Kanavin
  2022-11-25 21:15 ` [PATCH 2/3] runqemu: do not hardcode the ip address of the nfs server when using tap Alexander Kanavin
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Alexander Kanavin @ 2022-11-25 21:15 UTC (permalink / raw)
  To: openembedded-core; +Cc: Alexander Kanavin

Dependencies of runqemu belong in qemu-helper; in particular
there is no reason to scatter unfs3 all over the place, and then
require separate steps to make it available (e.g. 'meta-ide-support').

With this, startng runqemu with a nfs mount starts to 'just work'
after building an image.

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
---
 meta/recipes-core/meta/meta-extsdk-toolchain.bb           | 2 +-
 meta/recipes-core/meta/meta-ide-support.bb                | 2 +-
 .../packagegroups/nativesdk-packagegroup-sdk-host.bb      | 1 -
 meta/recipes-devtools/qemu/nativesdk-qemu-helper_1.0.bb   | 2 +-
 meta/recipes-devtools/qemu/qemu-helper-native_1.0.bb      | 2 +-
 scripts/runqemu-export-rootfs                             | 8 ++------
 scripts/runqemu-extract-sdk                               | 2 +-
 7 files changed, 7 insertions(+), 12 deletions(-)

diff --git a/meta/recipes-core/meta/meta-extsdk-toolchain.bb b/meta/recipes-core/meta/meta-extsdk-toolchain.bb
index 0df681ac73..618b596e4d 100644
--- a/meta/recipes-core/meta/meta-extsdk-toolchain.bb
+++ b/meta/recipes-core/meta/meta-extsdk-toolchain.bb
@@ -2,7 +2,7 @@ SUMMARY = "Extensible SDK toolchain meta-recipe"
 DESCRIPTION = "Meta-recipe for ensuring the build directory contains all appropriate toolchain packages for using an IDE"
 LICENSE = "MIT"
 
-DEPENDS = "virtual/libc gdb-cross-${TARGET_ARCH} qemu-native qemu-helper-native unfs3-native"
+DEPENDS = "virtual/libc gdb-cross-${TARGET_ARCH} qemu-native qemu-helper-native"
 
 do_populate_sysroot[deptask] = "do_populate_sysroot"
 
diff --git a/meta/recipes-core/meta/meta-ide-support.bb b/meta/recipes-core/meta/meta-ide-support.bb
index 7f349f673d..dd11b5673c 100644
--- a/meta/recipes-core/meta/meta-ide-support.bb
+++ b/meta/recipes-core/meta/meta-ide-support.bb
@@ -2,7 +2,7 @@ SUMMARY = "Integrated Development Environment support"
 DESCRIPTION = "Meta package for ensuring the build directory contains all appropriate toolchain packages for using an IDE"
 LICENSE = "MIT"
 
-DEPENDS = "virtual/libc gdb-cross-${TARGET_ARCH} qemu-native qemu-helper-native unfs3-native cmake-native autoconf-native automake-native meson-native intltool-native pkgconfig-native"
+DEPENDS = "virtual/libc gdb-cross-${TARGET_ARCH} qemu-native qemu-helper-native cmake-native autoconf-native automake-native meson-native intltool-native pkgconfig-native"
 PR = "r3"
 RM_WORK_EXCLUDE += "${PN}"
 
diff --git a/meta/recipes-core/packagegroups/nativesdk-packagegroup-sdk-host.bb b/meta/recipes-core/packagegroups/nativesdk-packagegroup-sdk-host.bb
index 9166a0851f..84ee1e3fa1 100644
--- a/meta/recipes-core/packagegroups/nativesdk-packagegroup-sdk-host.bb
+++ b/meta/recipes-core/packagegroups/nativesdk-packagegroup-sdk-host.bb
@@ -16,7 +16,6 @@ RDEPENDS:${PN} = "\
     nativesdk-qemu \
     nativesdk-qemu-helper \
     nativesdk-pseudo \
-    nativesdk-unfs3 \
     nativesdk-opkg \
     nativesdk-libtool \
     nativesdk-autoconf \
diff --git a/meta/recipes-devtools/qemu/nativesdk-qemu-helper_1.0.bb b/meta/recipes-devtools/qemu/nativesdk-qemu-helper_1.0.bb
index abba7fe159..2a5bcfb909 100644
--- a/meta/recipes-devtools/qemu/nativesdk-qemu-helper_1.0.bb
+++ b/meta/recipes-devtools/qemu/nativesdk-qemu-helper_1.0.bb
@@ -1,6 +1,6 @@
 SUMMARY = "Qemu helper scripts"
 LICENSE = "GPL-2.0-only"
-RDEPENDS:${PN} = "nativesdk-qemu \
+RDEPENDS:${PN} = "nativesdk-qemu nativesdk-unfs3 nativesdk-pseudo \
                   nativesdk-python3-shell nativesdk-python3-fcntl nativesdk-python3-logging \
                 "
 
diff --git a/meta/recipes-devtools/qemu/qemu-helper-native_1.0.bb b/meta/recipes-devtools/qemu/qemu-helper-native_1.0.bb
index e297586bbb..6053b71717 100644
--- a/meta/recipes-devtools/qemu/qemu-helper-native_1.0.bb
+++ b/meta/recipes-devtools/qemu/qemu-helper-native_1.0.bb
@@ -25,5 +25,5 @@ do_install() {
 	install qemu-oe-bridge-helper ${D}${bindir}/
 }
 
-DEPENDS += "qemu-system-native"
+DEPENDS += "qemu-system-native unfs3-native pseudo-native"
 addtask addto_recipe_sysroot after do_populate_sysroot before do_build
diff --git a/scripts/runqemu-export-rootfs b/scripts/runqemu-export-rootfs
index c1fff7fcb3..6a8acd0d5a 100755
--- a/scripts/runqemu-export-rootfs
+++ b/scripts/runqemu-export-rootfs
@@ -34,16 +34,12 @@ if [ -z "$SYSROOT_SETUP_SCRIPT" ]; then
 	echo "Did you forget to source your build environment setup script?"
 	exit 1
 fi
-. $SYSROOT_SETUP_SCRIPT meta-ide-support
+. $SYSROOT_SETUP_SCRIPT qemu-helper-native
 
 if [ ! -e "$OECORE_NATIVE_SYSROOT/usr/bin/unfsd" ]; then
 	echo "Error: Unable to find unfsd binary in $OECORE_NATIVE_SYSROOT/usr/bin/"
 
-	if [ "x$OECORE_DISTRO_VERSION" = "x" ]; then
-		echo "Have you run 'bitbake meta-ide-support'?"
-	else
-		echo "This shouldn't happen - something is missing from your toolchain installation"
-	fi
+	echo "This shouldn't happen - something is missing from your toolchain installation"
 	exit 1
 fi
 
diff --git a/scripts/runqemu-extract-sdk b/scripts/runqemu-extract-sdk
index 9bc0c07fb8..db05da25f2 100755
--- a/scripts/runqemu-extract-sdk
+++ b/scripts/runqemu-extract-sdk
@@ -25,7 +25,7 @@ if [ -z "$SYSROOT_SETUP_SCRIPT" ]; then
 	echo "Did you forget to source your build system environment setup script?"
 	exit 1
 fi
-. $SYSROOT_SETUP_SCRIPT meta-ide-support
+. $SYSROOT_SETUP_SCRIPT qemu-helper-native
 PSEUDO_OPTS="-P $OECORE_NATIVE_SYSROOT/usr"
 
 ROOTFS_TARBALL=$1
-- 
2.30.2



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/3] runqemu: do not hardcode the ip address of the nfs server when using tap
  2022-11-25 21:15 [PATCH 1/3] qemu-helper: depend on unfs3 and pseudo directly Alexander Kanavin
@ 2022-11-25 21:15 ` Alexander Kanavin
  2022-11-25 21:15 ` [PATCH 3/3] selftest/runqemu: reenable the nfs rootfs test Alexander Kanavin
  2022-11-27 23:58 ` [OE-core] [PATCH 1/3] qemu-helper: depend on unfs3 and pseudo directly Richard Purdie
  2 siblings, 0 replies; 6+ messages in thread
From: Alexander Kanavin @ 2022-11-25 21:15 UTC (permalink / raw)
  To: openembedded-core; +Cc: Alexander Kanavin

Rather, set it similarly to the overall network config.

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
---
 scripts/runqemu | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/scripts/runqemu b/scripts/runqemu
index 7bd9465593..04728673de 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -999,7 +999,7 @@ class BaseConfig(object):
             if self.slirp_enabled:
                 self.nfs_server = '10.0.2.2'
             else:
-                self.nfs_server = '192.168.7.1'
+                self.nfs_server = '192.168.7.@GATEWAY@'
 
         # Figure out a new nfs_instance to allow multiple qemus running.
         ps = subprocess.check_output(("ps", "auxww")).decode('utf-8')
@@ -1187,6 +1187,7 @@ class BaseConfig(object):
         netconf = " " + self.cmdline_ip_tap
         netconf = netconf.replace('@CLIENT@', str(client))
         netconf = netconf.replace('@GATEWAY@', str(gateway))
+        self.nfs_server = self.nfs_server.replace('@GATEWAY@', str(gateway))
         logger.info("Network configuration:%s", netconf)
         self.kernel_cmdline_script += netconf
         mac = "%s%02x" % (self.mac_tap, client)
-- 
2.30.2



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/3] selftest/runqemu: reenable the nfs rootfs test
  2022-11-25 21:15 [PATCH 1/3] qemu-helper: depend on unfs3 and pseudo directly Alexander Kanavin
  2022-11-25 21:15 ` [PATCH 2/3] runqemu: do not hardcode the ip address of the nfs server when using tap Alexander Kanavin
@ 2022-11-25 21:15 ` Alexander Kanavin
  2022-11-27 23:58 ` [OE-core] [PATCH 1/3] qemu-helper: depend on unfs3 and pseudo directly Richard Purdie
  2 siblings, 0 replies; 6+ messages in thread
From: Alexander Kanavin @ 2022-11-25 21:15 UTC (permalink / raw)
  To: openembedded-core; +Cc: Alexander Kanavin

With the previous fixes the test can be run again,
and it doesn't need all those extra steps. Runqemu
takes care of everything automatically now.

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
---
 meta/lib/oeqa/selftest/cases/runqemu.py | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/meta/lib/oeqa/selftest/cases/runqemu.py b/meta/lib/oeqa/selftest/cases/runqemu.py
index 58a4526df6..c2c3fbc924 100644
--- a/meta/lib/oeqa/selftest/cases/runqemu.py
+++ b/meta/lib/oeqa/selftest/cases/runqemu.py
@@ -199,22 +199,12 @@ class QemuTest(OESelftestTestCase):
             qemu_shutdown_succeeded = self._start_qemu_shutdown_check_if_shutdown_succeeded(qemu, shutdown_timeout)
             self.assertTrue(qemu_shutdown_succeeded, 'Failed: %s does not shutdown within timeout(%s)' % (self.machine, shutdown_timeout))
 
-    # Need to have portmap/rpcbind running to allow this test to work and
-    # current autobuilder setup does not have this.
-    def disabled_test_qemu_can_boot_nfs_and_shutdown(self):
-        self.assertExists(self.qemuboot_conf)
-        bitbake('meta-ide-support')
+    def test_qemu_can_boot_nfs_and_shutdown(self):
         rootfs_tar = "%s-%s.tar.bz2" % (self.recipe, self.machine)
         rootfs_tar = os.path.join(self.deploy_dir_image, rootfs_tar)
         self.assertExists(rootfs_tar)
-        tmpdir = tempfile.mkdtemp(prefix='qemu_nfs')
-        tmpdir_nfs = os.path.join(tmpdir, 'nfs')
-        cmd_extract_nfs = 'runqemu-extract-sdk %s %s' % (rootfs_tar, tmpdir_nfs)
-        result = runCmd(cmd_extract_nfs)
-        self.assertEqual(0, result.status, "runqemu-extract-sdk didn't run as expected. %s" % result.output)
-        cmd = "%s nfs %s %s" % (self.cmd_common, self.qemuboot_conf, tmpdir_nfs)
+        cmd = "%s %s" % (self.cmd_common, rootfs_tar)
         shutdown_timeout = 120
         with runqemu(self.recipe, ssh=False, launch_cmd=cmd) as qemu:
             qemu_shutdown_succeeded = self._start_qemu_shutdown_check_if_shutdown_succeeded(qemu, shutdown_timeout)
             self.assertTrue(qemu_shutdown_succeeded, 'Failed: %s does not shutdown within timeout(%s)' % (self.machine, shutdown_timeout))
-        runCmd('rm -rf %s' % tmpdir)
-- 
2.30.2



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [OE-core] [PATCH 1/3] qemu-helper: depend on unfs3 and pseudo directly
  2022-11-25 21:15 [PATCH 1/3] qemu-helper: depend on unfs3 and pseudo directly Alexander Kanavin
  2022-11-25 21:15 ` [PATCH 2/3] runqemu: do not hardcode the ip address of the nfs server when using tap Alexander Kanavin
  2022-11-25 21:15 ` [PATCH 3/3] selftest/runqemu: reenable the nfs rootfs test Alexander Kanavin
@ 2022-11-27 23:58 ` Richard Purdie
  2022-11-28  9:54   ` Alexander Kanavin
  2 siblings, 1 reply; 6+ messages in thread
From: Richard Purdie @ 2022-11-27 23:58 UTC (permalink / raw)
  To: Alexander Kanavin, openembedded-core; +Cc: Alexander Kanavin

On Fri, 2022-11-25 at 22:15 +0100, Alexander Kanavin wrote:
> Dependencies of runqemu belong in qemu-helper; in particular
> there is no reason to scatter unfs3 all over the place, and then
> require separate steps to make it available (e.g. 'meta-ide-support').

NFS isn't really a dependency of qemu though. The thinking here was
that you could boot a real board onto an NFS mount from your local
system for development purposes. That is why it was being included as
an SDK tool.

Perhaps we should just add it to qemu helper as well to simplify the
runqemu case?

Cheers,

Richard


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [OE-core] [PATCH 1/3] qemu-helper: depend on unfs3 and pseudo directly
  2022-11-27 23:58 ` [OE-core] [PATCH 1/3] qemu-helper: depend on unfs3 and pseudo directly Richard Purdie
@ 2022-11-28  9:54   ` Alexander Kanavin
  2022-11-28 10:15     ` Richard Purdie
  0 siblings, 1 reply; 6+ messages in thread
From: Alexander Kanavin @ 2022-11-28  9:54 UTC (permalink / raw)
  To: Richard Purdie; +Cc: openembedded-core, Alexander Kanavin

On Mon, 28 Nov 2022 at 00:58, Richard Purdie
<richard.purdie@linuxfoundation.org> wrote:
> NFS isn't really a dependency of qemu though. The thinking here was
> that you could boot a real board onto an NFS mount from your local
> system for development purposes. That is why it was being included as
> an SDK tool.
>
> Perhaps we should just add it to qemu helper as well to simplify the
> runqemu case?

I'm fine with that, just want to point out that commit history does
not have this justification - meta-* additions of nfs server
dependency specifically talk about qemu only, and sdk packagegroup
commit [1] does not describe the use case. I don't think there's a BSP
where this way of booting is officially supported and documented.

[1] https://git.yoctoproject.org/poky/commit/?h=master-next&id=b5b3825ce6df45b16e1f3e15001da213bc8b0a55

Alex


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [OE-core] [PATCH 1/3] qemu-helper: depend on unfs3 and pseudo directly
  2022-11-28  9:54   ` Alexander Kanavin
@ 2022-11-28 10:15     ` Richard Purdie
  0 siblings, 0 replies; 6+ messages in thread
From: Richard Purdie @ 2022-11-28 10:15 UTC (permalink / raw)
  To: Alexander Kanavin; +Cc: openembedded-core, Alexander Kanavin

On Mon, 2022-11-28 at 10:54 +0100, Alexander Kanavin wrote:
> On Mon, 28 Nov 2022 at 00:58, Richard Purdie
> <richard.purdie@linuxfoundation.org> wrote:
> > NFS isn't really a dependency of qemu though. The thinking here was
> > that you could boot a real board onto an NFS mount from your local
> > system for development purposes. That is why it was being included as
> > an SDK tool.
> > 
> > Perhaps we should just add it to qemu helper as well to simplify the
> > runqemu case?
> 
> I'm fine with that, just want to point out that commit history does
> not have this justification - meta-* additions of nfs server
> dependency specifically talk about qemu only, and sdk packagegroup
> commit [1] does not describe the use case.

Some of our older commits don't have the right information in sadly, it
is something we've had to work on and still don't always get right. I
did think I was likely going to be at fault until I looked! :) That is
partly why I'm adding some context around it.

>  I don't think there's a BSP
> where this way of booting is officially supported and documented.

Maybe not but I have done it myself before, admittedly a long time ago.
The key question is whether it is a useful capability and worth
maintaining. I'd say that yes, in this case it is, particularly if we
can raise the profile of the feature and make sure it continues to work
(which the tests you're enabling help massively with).

Cheers,

Richard




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-11-28 10:15 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-25 21:15 [PATCH 1/3] qemu-helper: depend on unfs3 and pseudo directly Alexander Kanavin
2022-11-25 21:15 ` [PATCH 2/3] runqemu: do not hardcode the ip address of the nfs server when using tap Alexander Kanavin
2022-11-25 21:15 ` [PATCH 3/3] selftest/runqemu: reenable the nfs rootfs test Alexander Kanavin
2022-11-27 23:58 ` [OE-core] [PATCH 1/3] qemu-helper: depend on unfs3 and pseudo directly Richard Purdie
2022-11-28  9:54   ` Alexander Kanavin
2022-11-28 10:15     ` Richard Purdie

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.