aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--cmd/earlyinit/main.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/cmd/earlyinit/main.go b/cmd/earlyinit/main.go
index 2f1eebef..42a8a9ca 100644
--- a/cmd/earlyinit/main.go
+++ b/cmd/earlyinit/main.go
@@ -153,6 +153,24 @@ func main() {
msg := message.New(log.Default())
msg.SwapVerbose(slices.Contains(flags, flagVerbose))
+ mustSyscall("bind root", Mount(
+ "/",
+ "/dev",
+ "",
+ MS_BIND|MS_REC,
+ "",
+ ))
+ must(os.Chdir("/dev"))
+ mustSyscall("move root", Mount(
+ "/dev",
+ "/",
+ "",
+ MS_MOVE,
+ "",
+ ))
+ mustSyscall("change root", Chroot("."))
+ must(os.Chdir("/"))
+
mustSyscall("mount devtmpfs", Mount(
"devtmpfs",
"/dev/",