aboutsummaryrefslogtreecommitdiffhomepage
path: root/cmd/earlyinit/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/earlyinit/main.go')
-rw-r--r--cmd/earlyinit/main.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/cmd/earlyinit/main.go b/cmd/earlyinit/main.go
index 30588067..f0baa265 100644
--- a/cmd/earlyinit/main.go
+++ b/cmd/earlyinit/main.go
@@ -96,6 +96,8 @@ const (
flagNoRecover = "no_recover"
// flagMountTmp arranges for /tmp/ to be made available.
flagMountTmp = "mount_tmp"
+ // flag9P arranges for a host directory to be mounted at /host/.
+ flag9P = "9p"
)
func main() {
@@ -265,6 +267,20 @@ func main() {
mustMountSystem(ctx, s, devpath)
}
+ if slices.Contains(flags, flag9P) {
+ // avoid having to wait for the uevent loop
+ modprobe("-a", "9p", "9pnet_virtio", "virtio_pci")
+
+ must(os.Mkdir("/host/", 0))
+ mustSyscall("mount host directory", Mount(
+ "rosa",
+ "/host/",
+ "9p",
+ MS_NOSUID|MS_NODEV,
+ "trans=virtio",
+ ))
+ }
+
// after top level has been set up
mustSyscall("remount root", Mount(
"",