internal/rosa/images: initramfs via gen_init_cpio

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{
t.Load(Zstd),
t.Load(Hakurei),
t.Load(GenInitCPIO),
}, nil, nil, `
cd "$(mktemp -d)"
cp /system/libexec/hakurei/earlyinit init
((find . | cpio -R 0:0 -o) && (cd / && echo dev/null | cpio -R 0:0 -o)) | \
zstd -19 > /work/initramfs.zst
`)
gen_init_cpio -t 4294967295 -c /usr/src/initramfs | zstd > /work/initramfs.zst
`, pkg.Path(AbsUsrSrc.Append("initramfs"), false, pkg.NewFile("initramfs", []byte(`
dir /dev 0755 0 0
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 }