DistroKit Mailinglist
 help / color / mirror / Atom feed
* [DistroKit] [RFC] x86_64: run: add 9p tcp based rootfs support
@ 2023-06-21 22:46 Michael Grzeschik
  2023-10-20  8:28 ` Robert Schwebel
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Grzeschik @ 2023-06-21 22:46 UTC (permalink / raw)
  To: distrokit

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




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

* Re: [DistroKit] [RFC] x86_64: run: add 9p tcp based rootfs support
  2023-06-21 22:46 [DistroKit] [RFC] x86_64: run: add 9p tcp based rootfs support Michael Grzeschik
@ 2023-10-20  8:28 ` Robert Schwebel
  0 siblings, 0 replies; 2+ messages in thread
From: Robert Schwebel @ 2023-10-20  8:28 UTC (permalink / raw)
  To: Michael Grzeschik; +Cc: distrokit

Applied to next

On Thu, Jun 22, 2023 at 12:46:10AM +0200, Michael Grzeschik wrote:
> 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
> 
> 
> 

-- 
Pengutronix e.K.                           | Dipl.-Ing. Robert Schwebel  |
Steuerwalder Str. 21                       | https://www.pengutronix.de/ |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-9    |



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

end of thread, other threads:[~2023-10-20  8:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-21 22:46 [DistroKit] [RFC] x86_64: run: add 9p tcp based rootfs support Michael Grzeschik
2023-10-20  8:28 ` Robert Schwebel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox