From d284d0f73f614656879e0c83a7b7f7cd51fed5a3 Mon Sep 17 00:00:00 2001 From: Ophestra Date: Tue, 3 Nov 2026 16:09:52 +0900 Subject: cmd/earlyinit: optionally mount /tmp This directory is not used by Rosa OS, but may be useful during testing. Signed-off-by: Ophestra --- cmd/earlyinit/main.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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 -- cgit v1.3.1