From mboxrd@z Thu Jan 1 00:00:00 1970 Delivery-date: Mon, 30 Jan 2023 23:03:38 +0100 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by lore.white.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1pMcFY-00856n-CZ for lore@lore.pengutronix.de; Mon, 30 Jan 2023 23:03:38 +0100 Received: from localhost ([127.0.0.1] helo=metis.ext.pengutronix.de) by metis.ext.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1pMcFV-00045Z-Nd; Mon, 30 Jan 2023 23:03:37 +0100 Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pMcFM-00045Q-2D for distrokit@pengutronix.de; Mon, 30 Jan 2023 23:03:28 +0100 Received: from [2a0a:edc0:0:1101:1d::ac] (helo=dude04.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1pMcFM-001YK6-BQ for distrokit@pengutronix.de; Mon, 30 Jan 2023 23:03:27 +0100 Received: from mgr by dude04.red.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1pMcFK-001iOx-Dx for distrokit@pengutronix.de; Mon, 30 Jan 2023 23:03:26 +0100 From: Michael Grzeschik To: distrokit@pengutronix.de Date: Mon, 30 Jan 2023 23:03:23 +0100 Message-Id: <20230130220323.408947-1-m.grzeschik@pengutronix.de> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [DistroKit] [PATCH] x86_64: run: add 9p support X-BeenThere: distrokit@pengutronix.de X-Mailman-Version: 2.1.29 Precedence: list List-Id: DistroKit Mailinglist List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "DistroKit" X-SA-Exim-Connect-IP: 127.0.0.1 X-SA-Exim-Mail-From: distrokit-bounces@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false copy the qemu 9p rule from platform v7a and make 9p the default Signed-off-by: Michael Grzeschik --- configs/platform-x86_64/run | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/configs/platform-x86_64/run b/configs/platform-x86_64/run index c39d5a7b..96322292 100755 --- a/configs/platform-x86_64/run +++ b/configs/platform-x86_64/run @@ -67,6 +67,12 @@ fi BASE_CMDLINE="console=ttyS0,115200 loglevel=5 systemd.log_level=warning systemd.show_status=auto" +if [ -d "${PTXDIST_PLATFORMDIR}/root/.virtfs_metadata" ]; then + security_model="mapped-file" +else + security_model="none" +fi + # Machine to emulate QEMU_ARGS=( -L ${PTXDIST_PLATFORMDIR}/sysroot-host/share/qemu/ -machine pc-q35-2.12 -smp 2 -cpu host -accel kvm -m 1G -s ) # disable graphics output @@ -97,7 +103,22 @@ run_qemu_hda() { -append "root=/dev/vda console=ttyS0,115200 rw ${BASE_CMDLINE}" } -target="${1:-hda}" +# +# This needs: +# CONFIG_NET_9P_VIRTIO=y +# CONFIG_9P_FS=y +# +run_qemu_9p() { + exec ${QEMU_EXEC} \ + "${QEMU_ARGS[@]}" \ + -fsdev local,id=rootfs,path=${PTXDIST_PLATFORMDIR}/root,security_model="${security_model}" \ + -device virtio-9p-pci,fsdev=rootfs,mount_tag=/dev/root \ + "${QEMU_EXTRA_ARGS[@]}" \ + "${QEMU_LINUX_ARGS[@]}" \ + -append "root=/dev/root rw rootfstype=9p rootflags=trans=virtio ${BASE_CMDLINE}" +} + +target="${1:-9p}" #set -x run_qemu_${target} -- 2.30.2