diff options
| author | Ophestra <cat@gensokyo.uk> | 2026-05-06 00:55:45 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2026-05-06 00:55:45 +0900 |
| commit | 617ee21647ef86be67e37a3df2413d08c6658799 (patch) | |
| tree | cbfae639d523d5ec68af5ec4a0eb7864049abcab /container/init.go | |
| parent | 15cdb37ec29056890a44f5a5b22f4917b81c5781 (diff) | |
container/init: mount intermediate before early
This is usable as scratch space during early.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'container/init.go')
| -rw-r--r-- | container/init.go | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/container/init.go b/container/init.go index f4796f1d..76a77828 100644 --- a/container/init.go +++ b/container/init.go @@ -223,6 +223,13 @@ func initEntrypoint(k syscallDispatcher, msg message.Msg) { state := &setupState{process: make(map[int]WaitStatus), Params: ¶m.Params, Msg: msg, Context: ctx} defer cancel() + if err := k.mount(SourceTmpfsRootfs, intermediateHostPath, FstypeTmpfs, MS_NODEV|MS_NOSUID, zeroString); err != nil { + k.fatalf(msg, "cannot mount intermediate root: %v", optionalErrorUnwrap(err)) + } + if err := k.chdir(intermediateHostPath); err != nil { + k.fatalf(msg, "cannot enter intermediate host path: %v", err) + } + /* early is called right before pivot_root into intermediate root; this step is mostly for gathering information that would otherwise be difficult to obtain via library functions after pivot_root, and @@ -242,13 +249,6 @@ func initEntrypoint(k syscallDispatcher, msg message.Msg) { } } - if err := k.mount(SourceTmpfsRootfs, intermediateHostPath, FstypeTmpfs, MS_NODEV|MS_NOSUID, zeroString); err != nil { - k.fatalf(msg, "cannot mount intermediate root: %v", optionalErrorUnwrap(err)) - } - if err := k.chdir(intermediateHostPath); err != nil { - k.fatalf(msg, "cannot enter intermediate host path: %v", err) - } - if err := k.mkdir(sysrootDir, 0755); err != nil { k.fatalf(msg, "%v", err) } |
