DistroKit Mailinglist
 help / color / mirror / Atom feed
From: Michael Grzeschik <m.grzeschik@pengutronix.de>
To: distrokit@pengutronix.de
Subject: [DistroKit] [RFC] x86_64: run: add 9p tcp based rootfs support
Date: Thu, 22 Jun 2023 00:46:10 +0200	[thread overview]
Message-ID: <20230621224609.932551-1-m.grzeschik@pengutronix.de> (raw)

Since there is no diod server ptxdist host tool available yet, this
script starts the version from debian.

It is also to be found how to best start the server.
For now this simple script works as proof of concept including
ugly hacks to run and stop diod around the qemu exec.

Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
---
 configs/platform-x86_64/run | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/configs/platform-x86_64/run b/configs/platform-x86_64/run
index 96322292..cd726021 100755
--- a/configs/platform-x86_64/run
+++ b/configs/platform-x86_64/run
@@ -118,6 +118,31 @@ run_qemu_9p() {
 		-append "root=/dev/root rw rootfstype=9p rootflags=trans=virtio ${BASE_CMDLINE}"
 }
 
+# 9p net port
+P9_ROOTFS_PORT=99999
+
+run_qemu_9pnet() {
+	ROOTPATH=$(realpath ${PTXDIST_PLATFORMDIR}/root)
+	# the emulator to run
+	DIOD_EXEC="/sbin/diod"
+
+	if [ ! -e "${DIOD_EXEC}" ]; then
+		echo "error: apt-get install 'diod' first"
+		exit 1
+	fi
+
+	${DIOD_EXEC} -f -n -S -l 127.0.0.1:${P9_ROOTFS_PORT} -e ${ROOTPATH} &
+	# this is an ugly workaround so diod will be closed after qemu has stopped
+	DIOD_PID=$(echo $!)
+	(tail --pid $$ -f /dev/null; kill ${DIOD_PID}) &
+
+	exec ${QEMU_EXEC} \
+		"${QEMU_ARGS[@]}" \
+		"${QEMU_EXTRA_ARGS[@]}" \
+		"${QEMU_LINUX_ARGS[@]}" \
+		-append "ip=dhcp root=10.0.2.2 rw rootfstype=9p rootflags=trans=tcp,version=9p2000.L,aname=${ROOTPATH},port=${P9_ROOTFS_PORT} ${BASE_CMDLINE} ${EXTRA_CMDLINE}"
+}
+
 target="${1:-9p}"
 
 #set -x
-- 
2.39.2




             reply	other threads:[~2023-06-21 22:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-21 22:46 Michael Grzeschik [this message]
2023-10-20  8:28 ` Robert Schwebel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230621224609.932551-1-m.grzeschik@pengutronix.de \
    --to=m.grzeschik@pengutronix.de \
    --cc=distrokit@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox