aboutsummaryrefslogtreecommitdiffhomepage
path: root/cmd/earlyinit/main.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2026-11-03 16:09:52 +0900
committerOphestra <cat@gensokyo.uk>2026-11-03 16:09:52 +0900
commitd284d0f73f614656879e0c83a7b7f7cd51fed5a3 (patch)
tree2878d66073ec0e19b187499850aa4f534247725a /cmd/earlyinit/main.go
parent9f51fc36a884c96a70f32c453f1cc0291b0c102e (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>
Diffstat (limited to 'cmd/earlyinit/main.go')
-rw-r--r--cmd/earlyinit/main.go13
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