forked from rosa/hakurei
internal/rosa: configurable architecture
This enables curing via binfmt. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user