diff --git a/internal/rosa/all.go b/internal/rosa/all.go index 6ffbad4..0c80c70 100644 --- a/internal/rosa/all.go +++ b/internal/rosa/all.go @@ -10,7 +10,17 @@ import ( type PArtifact int const ( - ACL PArtifact = iota + // ImageInitramfs is the Rosa OS initramfs archive. + ImageInitramfs PArtifact = iota + + // Kernel is the generic Rosa OS Linux kernel. + Kernel + // KernelHeaders is an installation of kernel headers for [Kernel]. + KernelHeaders + // KernelSource is a writable kernel source tree installed to [AbsUsrSrc]. + KernelSource + + ACL ArgpStandalone Attr Autoconf @@ -42,9 +52,6 @@ const ( Hakurei HakureiDist IniConfig - Kernel - KernelHeaders - KernelSource Kmod LibXau Libcap @@ -148,6 +155,12 @@ func (t Toolchain) Load(p PArtifact) pkg.Artifact { // ResolveName returns a [PArtifact] by name. func ResolveName(name string) (p PArtifact, ok bool) { p, ok = map[string]PArtifact{ + "initramfs-image": ImageInitramfs, + + "kernel": Kernel, + "kernel-headers": KernelHeaders, + "kernel-source": KernelSource, + "acl": ACL, "argp-standalone": ArgpStandalone, "attr": Attr, @@ -180,9 +193,6 @@ func ResolveName(name string) (p PArtifact, ok bool) { "hakurei": Hakurei, "hakurei-dist": HakureiDist, "iniconfig": IniConfig, - "kernel": Kernel, - "kernel-headers": KernelHeaders, - "kernel-source": KernelSource, "kmod": Kmod, "libXau": LibXau, "libcap": Libcap, diff --git a/internal/rosa/images.go b/internal/rosa/images.go new file mode 100644 index 0000000..40398df --- /dev/null +++ b/internal/rosa/images.go @@ -0,0 +1,16 @@ +package rosa + +import "hakurei.app/internal/pkg" + +func (t Toolchain) newImageInitramfs() pkg.Artifact { + return t.New("initramfs", TNoToolchain, []pkg.Artifact{ + t.Load(Zstd), + t.Load(Hakurei), + }, 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 +`) +} +func init() { artifactsF[ImageInitramfs] = Toolchain.newImageInitramfs }