cmd/earlyinit: mount pseudo-filesystems
All checks were successful
Test / Create distribution (push) Successful in 1m2s
Test / Sandbox (push) Successful in 2m42s
Test / ShareFS (push) Successful in 3m40s
Test / Hakurei (push) Successful in 3m45s
Test / Sandbox (race detector) (push) Successful in 5m2s
Test / Hakurei (race detector) (push) Successful in 6m5s
Test / Flake checks (push) Successful in 1m30s
All checks were successful
Test / Create distribution (push) Successful in 1m2s
Test / Sandbox (push) Successful in 2m42s
Test / ShareFS (push) Successful in 3m40s
Test / Hakurei (push) Successful in 3m45s
Test / Sandbox (race detector) (push) Successful in 5m2s
Test / Hakurei (race detector) (push) Successful in 6m5s
Test / Flake checks (push) Successful in 1m30s
The proposal for merging both init programs was unanimously accepted, so this is set up here alongside devtmpfs. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
@@ -72,4 +72,40 @@ func main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// staying in rootfs, these are no longer used
|
||||||
|
must(os.Remove("/root"))
|
||||||
|
must(os.Remove("/init"))
|
||||||
|
|
||||||
|
must(os.Mkdir("/proc", 0))
|
||||||
|
mustSyscall("mount proc", Mount(
|
||||||
|
"proc",
|
||||||
|
"/proc",
|
||||||
|
"proc",
|
||||||
|
MS_NOSUID|MS_NOEXEC|MS_NODEV,
|
||||||
|
"hidepid=1",
|
||||||
|
))
|
||||||
|
|
||||||
|
must(os.Mkdir("/sys", 0))
|
||||||
|
mustSyscall("mount sysfs", Mount(
|
||||||
|
"sysfs",
|
||||||
|
"/sys",
|
||||||
|
"sysfs",
|
||||||
|
0,
|
||||||
|
"",
|
||||||
|
))
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// mustSyscall calls [log.Fatalln] if err is non-nil.
|
||||||
|
func mustSyscall(action string, err error) {
|
||||||
|
if err != nil {
|
||||||
|
log.Fatalln("cannot "+action+":", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// must calls [log.Fatal] with err if it is non-nil.
|
||||||
|
func must(err error) {
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ const (
|
|||||||
LLVMRuntimes
|
LLVMRuntimes
|
||||||
LLVMClang
|
LLVMClang
|
||||||
|
|
||||||
// EarlyInit is the Rosa OS initramfs init program.
|
// EarlyInit is the Rosa OS init program.
|
||||||
EarlyInit
|
EarlyInit
|
||||||
// ImageSystem is the Rosa OS /system image.
|
// ImageSystem is the Rosa OS /system image.
|
||||||
ImageSystem
|
ImageSystem
|
||||||
|
|||||||
Reference in New Issue
Block a user