aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2026-03-08 18:28:35 +0900
committerOphestra <cat@gensokyo.uk>2026-03-08 18:29:04 +0900
commit279a9736330e187e7e8a03e9da63449f6613afc9 (patch)
treea63eb0fcaa3896c8f66589748697b67e1f6a7e0c /internal
parent9c1b52268906af92bd97cb2e78f93284801d961d (diff)
internal/rosa: build independent earlyinit
This avoids unnecessarily rebuilding hakurei during development. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal')
-rw-r--r--internal/rosa/all.go2
-rw-r--r--internal/rosa/images.go24
2 files changed, 25 insertions, 1 deletions
diff --git a/internal/rosa/all.go b/internal/rosa/all.go
index 41aacddb..6b9605b9 100644
--- a/internal/rosa/all.go
+++ b/internal/rosa/all.go
@@ -19,6 +19,8 @@ const (
LLVMRuntimes
LLVMClang
+ // EarlyInit is the Rosa OS initramfs init program.
+ EarlyInit
// ImageInitramfs is the Rosa OS initramfs archive.
ImageInitramfs
diff --git a/internal/rosa/images.go b/internal/rosa/images.go
index 52ff8f65..bef35d2a 100644
--- a/internal/rosa/images.go
+++ b/internal/rosa/images.go
@@ -2,10 +2,32 @@ package rosa
import "hakurei.app/internal/pkg"
+func init() {
+ artifactsM[EarlyInit] = Metadata{
+ Name: "earlyinit",
+ Description: "Rosa OS initramfs init program",
+
+ f: func(t Toolchain) (pkg.Artifact, string) {
+ return t.newHakurei("-early-init", `
+mkdir -p /work/system/libexec/hakurei/
+
+echo '# Building earlyinit.'
+go build -trimpath -v -o /work/system/libexec/hakurei -ldflags="-s -w
+ -buildid=
+ -linkmode external
+ -extldflags=-static
+ -X hakurei.app/internal/info.buildVersion=${HAKUREI_VERSION}
+" ./cmd/earlyinit
+echo
+`, false), Unversioned
+ },
+ }
+}
+
func (t Toolchain) newImageInitramfs() (pkg.Artifact, string) {
return t.New("initramfs", TNoToolchain, []pkg.Artifact{
t.Load(Zstd),
- t.Load(Hakurei),
+ t.Load(EarlyInit),
t.Load(GenInitCPIO),
}, nil, nil, `
gen_init_cpio -t 4294967295 -c /usr/src/initramfs | zstd > /work/initramfs.zst