internal/rosa/images: initramfs via gen_init_cpio
All checks were successful
Test / Create distribution (push) Successful in 58s
Test / Sandbox (push) Successful in 2m33s
Test / Hakurei (push) Successful in 3m45s
Test / ShareFS (push) Successful in 3m53s
Test / Hpkg (push) Successful in 4m20s
Test / Sandbox (race detector) (push) Successful in 4m54s
Test / Hakurei (race detector) (push) Successful in 6m2s
Test / Flake checks (push) Successful in 1m49s

This is much cleaner than hacking around the cpio tool.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2026-02-28 23:04:58 +09:00
parent d041fee791
commit b4e82e68a7

View File

@@ -6,11 +6,14 @@ func (t Toolchain) newImageInitramfs() pkg.Artifact {
return t.New("initramfs", TNoToolchain, []pkg.Artifact{ return t.New("initramfs", TNoToolchain, []pkg.Artifact{
t.Load(Zstd), t.Load(Zstd),
t.Load(Hakurei), t.Load(Hakurei),
t.Load(GenInitCPIO),
}, nil, nil, ` }, nil, nil, `
cd "$(mktemp -d)" gen_init_cpio -t 4294967295 -c /usr/src/initramfs | zstd > /work/initramfs.zst
cp /system/libexec/hakurei/earlyinit init `, pkg.Path(AbsUsrSrc.Append("initramfs"), false, pkg.NewFile("initramfs", []byte(`
((find . | cpio -R 0:0 -o) && (cd / && echo dev/null | cpio -R 0:0 -o)) | \ dir /dev 0755 0 0
zstd -19 > /work/initramfs.zst nod /dev/null 0666 0 0 c 1 3
`) nod /dev/console 0600 0 0 c 5 1
file /init /system/libexec/hakurei/earlyinit 0555 0 0
`))))
} }
func init() { artifactsF[ImageInitramfs] = Toolchain.newImageInitramfs } func init() { artifactsF[ImageInitramfs] = Toolchain.newImageInitramfs }