diff options
| author | Ophestra <cat@gensokyo.uk> | 2026-11-03 16:09:52 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2026-11-03 16:09:52 +0900 |
| commit | d284d0f73f614656879e0c83a7b7f7cd51fed5a3 (patch) | |
| tree | 2878d66073ec0e19b187499850aa4f534247725a | |
| parent | 9f51fc36a884c96a70f32c453f1cc0291b0c102e (diff) | |
cmd/earlyinit: optionally mount /tmp
This directory is not used by Rosa OS, but may be useful during testing.
Signed-off-by: Ophestra <cat@gensokyo.uk>
| -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 |
