diff options
| -rw-r--r-- | cmd/earlyinit/main.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/cmd/earlyinit/main.go b/cmd/earlyinit/main.go index cbbd6648..30588067 100644 --- a/cmd/earlyinit/main.go +++ b/cmd/earlyinit/main.go @@ -94,6 +94,8 @@ const ( flagStrict = "strict" // flagNoRecover sets [report.DNoRecover] on r. flagNoRecover = "no_recover" + // flagMountTmp arranges for /tmp/ to be made available. + flagMountTmp = "mount_tmp" ) func main() { @@ -154,6 +156,17 @@ func main() { "", )) + if slices.Contains(flags, flagMountTmp) { + must(os.Mkdir("/tmp/", 0)) + mustSyscall("mount tmpfs", Mount( + "ephemeral", + "/tmp/", + "tmpfs", + MS_NOSUID|MS_NODEV, + "mode=1777", + )) + } + // The kernel might be unable to set up the console. When that happens, // printk is called with "Warning: unable to open an initial console." // and the init runs with no files. The checkfds runtime function |
