diff options
| author | Ophestra <cat@gensokyo.uk> | 2026-05-07 19:45:36 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2026-05-07 20:01:44 +0900 |
| commit | 65b7dd8b37e3a4eac6a4081f147f98b9a251da91 (patch) | |
| tree | 77d4235210ec5d0155c9bd0969027b68f396dfcc /internal/rosa/rosa.go | |
| parent | 8d72b9e5bd8d99cbd32ce0ebe2f5da8e9b1d88ce (diff) | |
internal/rosa: configurable architecture
This enables curing via binfmt.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/rosa/rosa.go')
| -rw-r--r-- | internal/rosa/rosa.go | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/internal/rosa/rosa.go b/internal/rosa/rosa.go index fb4e8a4b..6bf51fcb 100644 --- a/internal/rosa/rosa.go +++ b/internal/rosa/rosa.go @@ -4,7 +4,6 @@ package rosa import ( "errors" "path" - "runtime" "slices" "strconv" "strings" @@ -54,10 +53,9 @@ var ( AbsSystem = fhs.AbsRoot.Append("system") ) -// linuxArch returns the architecture name used by linux corresponding to -// [runtime.GOARCH]. +// linuxArch returns the architecture name used by linux corresponding to arch. func linuxArch() string { - switch runtime.GOARCH { + switch arch { case "amd64": return "x86_64" case "arm64": @@ -66,11 +64,11 @@ func linuxArch() string { return "riscv64" default: - panic("unsupported target " + runtime.GOARCH) + panic("unsupported target " + arch) } } -// triplet returns the Rosa OS host triple corresponding to [runtime.GOARCH]. +// triplet returns the Rosa OS host triple corresponding to arch. func triplet() string { return linuxArch() + "-rosa-linux-musl" } @@ -80,9 +78,9 @@ type perArch[T any] map[string]T // unwrap returns the value for the current architecture. func (p perArch[T]) unwrap() T { - v, ok := p[runtime.GOARCH] + v, ok := p[arch] if !ok { - panic("unsupported target " + runtime.GOARCH) + panic("unsupported target " + arch) } return v } @@ -268,7 +266,7 @@ func (t Toolchain) New( support = append(support, extra...) support = append(support, cureEtc{}) if t == toolchainStage0 { - support = append(support, NewStage0()) + support = append(support, t.Load(stage0Dist)) } else { support = append(support, _toolchainBusybox.New("gentoo", 0, nil, nil, nil, ` tar -C /work -xf /usr/src/stage3.tar.xz |
