aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/rosa/stage0.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2026-02-10 21:24:25 +0900
committerOphestra <cat@gensokyo.uk>2026-02-10 22:31:08 +0900
commit0061d11f939157e181a908f50b0ffb4c991e0375 (patch)
treefc611a4624f1a13951a17e38aead148214a7a62b /internal/rosa/stage0.go
parentfb101a02f21d048515561659b06bfc2a35568c56 (diff)
internal/rosa: use self-hosted stage0
This removes the bootstrap dependency on Gentoo stage3 tarball. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/rosa/stage0.go')
-rw-r--r--internal/rosa/stage0.go36
1 files changed, 35 insertions, 1 deletions
diff --git a/internal/rosa/stage0.go b/internal/rosa/stage0.go
index 7b347255..faa25e37 100644
--- a/internal/rosa/stage0.go
+++ b/internal/rosa/stage0.go
@@ -1,6 +1,11 @@
package rosa
-import "hakurei.app/internal/pkg"
+import (
+ "runtime"
+ "sync"
+
+ "hakurei.app/internal/pkg"
+)
func (t Toolchain) newStage0() pkg.Artifact {
musl, compilerRT, runtimes, clang := t.NewLLVM()
@@ -37,3 +42,32 @@ tar \
`)
}
func init() { artifactsF[Stage0] = Toolchain.newStage0 }
+
+var (
+ // stage0 stores the tarball unpack artifact.
+ stage0 pkg.Artifact
+ // stage0Once is for lazy initialisation of stage0.
+ stage0Once sync.Once
+)
+
+// NewStage0 returns a stage0 distribution created from curing [Stage0].
+func NewStage0() pkg.Artifact {
+ stage0Once.Do(func() {
+ var seed string
+ switch runtime.GOARCH {
+ case "amd64":
+ seed = "tqM1Li15BJ-uFG8zU-XjgFxoN_kuzh1VxrSDVUVa0vGmo-NeWapSftH739sY8EAg"
+
+ default:
+ panic("unsupported target " + runtime.GOARCH)
+ }
+
+ stage0 = pkg.NewHTTPGetTar(
+ nil, "https://hakurei.app/seed/20260210/"+
+ "stage0-"+triplet()+".tar.bz2",
+ mustDecode(seed),
+ pkg.TarBzip2,
+ )
+ })
+ return stage0
+}