internal/rosa: configurable architecture
All checks were successful
Test / Create distribution (push) Successful in 1m6s
Test / Sandbox (push) Successful in 2m48s
Test / ShareFS (push) Successful in 3m40s
Test / Hakurei (push) Successful in 3m57s
Test / Sandbox (race detector) (push) Successful in 5m22s
Test / Hakurei (race detector) (push) Successful in 6m33s
Test / Flake checks (push) Successful in 1m29s
All checks were successful
Test / Create distribution (push) Successful in 1m6s
Test / Sandbox (push) Successful in 2m48s
Test / ShareFS (push) Successful in 3m40s
Test / Hakurei (push) Successful in 3m57s
Test / Sandbox (race detector) (push) Successful in 5m22s
Test / Hakurei (race detector) (push) Successful in 6m33s
Test / Flake checks (push) Successful in 1m29s
This enables curing via binfmt. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
@@ -183,7 +183,8 @@ const (
|
|||||||
// PresetUnexportedStart is the first unexported preset.
|
// PresetUnexportedStart is the first unexported preset.
|
||||||
PresetUnexportedStart
|
PresetUnexportedStart
|
||||||
|
|
||||||
llvmSource = iota - 1
|
stage0Dist = iota - 1
|
||||||
|
llvmSource
|
||||||
// earlyCompilerRT is an early, standalone compiler-rt installation for the
|
// earlyCompilerRT is an early, standalone compiler-rt installation for the
|
||||||
// standalone runtimes build.
|
// standalone runtimes build.
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"runtime"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"hakurei.app/fhs"
|
"hakurei.app/fhs"
|
||||||
@@ -88,7 +87,7 @@ func (a busyboxBin) Cure(t *pkg.TContext) (err error) {
|
|||||||
// the https://busybox.net/downloads/binaries/ binary release.
|
// the https://busybox.net/downloads/binaries/ binary release.
|
||||||
func newBusyboxBin() pkg.Artifact {
|
func newBusyboxBin() pkg.Artifact {
|
||||||
var version, url, checksum string
|
var version, url, checksum string
|
||||||
switch runtime.GOARCH {
|
switch arch {
|
||||||
case "amd64":
|
case "amd64":
|
||||||
version = "1.35.0"
|
version = "1.35.0"
|
||||||
url = "https://busybox.net/downloads/binaries/" +
|
url = "https://busybox.net/downloads/binaries/" +
|
||||||
@@ -101,7 +100,7 @@ func newBusyboxBin() pkg.Artifact {
|
|||||||
checksum = "npJjBO7iwhjW6Kx2aXeSxf8kXhVgTCDChOZTTsI8ZfFfa3tbsklxRiidZQdrVERg"
|
checksum = "npJjBO7iwhjW6Kx2aXeSxf8kXhVgTCDChOZTTsI8ZfFfa3tbsklxRiidZQdrVERg"
|
||||||
|
|
||||||
default:
|
default:
|
||||||
panic("unsupported target " + runtime.GOARCH)
|
panic("unsupported target " + arch)
|
||||||
}
|
}
|
||||||
|
|
||||||
return pkg.NewExec(
|
return pkg.NewExec(
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package rosa
|
package rosa
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"runtime"
|
|
||||||
"slices"
|
"slices"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
@@ -843,7 +842,7 @@ func (t Toolchain) newGnuTLS() (pkg.Artifact, string) {
|
|||||||
)
|
)
|
||||||
|
|
||||||
var configureExtra []KV
|
var configureExtra []KV
|
||||||
switch runtime.GOARCH {
|
switch arch {
|
||||||
case "arm64":
|
case "arm64":
|
||||||
configureExtra = []KV{
|
configureExtra = []KV{
|
||||||
{"disable-hardware-acceleration"},
|
{"disable-hardware-acceleration"},
|
||||||
@@ -1148,7 +1147,7 @@ func (t Toolchain) newGCC() (pkg.Artifact, string) {
|
|||||||
)
|
)
|
||||||
|
|
||||||
var configureExtra []KV
|
var configureExtra []KV
|
||||||
switch runtime.GOARCH {
|
switch arch {
|
||||||
case "amd64", "arm64":
|
case "amd64", "arm64":
|
||||||
configureExtra = append(configureExtra, KV{"with-multilib-list", "''"})
|
configureExtra = append(configureExtra, KV{"with-multilib-list", "''"})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package rosa
|
package rosa
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"runtime"
|
|
||||||
"slices"
|
"slices"
|
||||||
|
|
||||||
"hakurei.app/internal/pkg"
|
"hakurei.app/internal/pkg"
|
||||||
@@ -69,7 +68,7 @@ func (t Toolchain) newGoLatest() (pkg.Artifact, string) {
|
|||||||
|
|
||||||
finalEnv []string
|
finalEnv []string
|
||||||
)
|
)
|
||||||
switch runtime.GOARCH {
|
switch arch {
|
||||||
case "amd64":
|
case "amd64":
|
||||||
bootstrapExtra = append(bootstrapExtra, t.newGoBootstrap())
|
bootstrapExtra = append(bootstrapExtra, t.newGoBootstrap())
|
||||||
|
|
||||||
@@ -79,7 +78,7 @@ func (t Toolchain) newGoLatest() (pkg.Artifact, string) {
|
|||||||
finalEnv = append(finalEnv, "CGO_ENABLED=0")
|
finalEnv = append(finalEnv, "CGO_ENABLED=0")
|
||||||
|
|
||||||
default:
|
default:
|
||||||
panic("unsupported target " + runtime.GOARCH)
|
panic("unsupported target " + arch)
|
||||||
}
|
}
|
||||||
|
|
||||||
go119 := t.newGo(
|
go119 := t.newGo(
|
||||||
@@ -104,7 +103,7 @@ echo \
|
|||||||
[]string{"CGO_ENABLED=0"}, `
|
[]string{"CGO_ENABLED=0"}, `
|
||||||
sed -i \
|
sed -i \
|
||||||
's,/lib/ld-musl-`+linuxArch()+`.so.1,/system/bin/linker,' \
|
's,/lib/ld-musl-`+linuxArch()+`.so.1,/system/bin/linker,' \
|
||||||
cmd/link/internal/`+runtime.GOARCH+`/obj.go
|
cmd/link/internal/`+arch+`/obj.go
|
||||||
|
|
||||||
rm \
|
rm \
|
||||||
crypto/tls/handshake_client_test.go \
|
crypto/tls/handshake_client_test.go \
|
||||||
@@ -122,7 +121,7 @@ echo \
|
|||||||
[]string{"CGO_ENABLED=0"}, `
|
[]string{"CGO_ENABLED=0"}, `
|
||||||
sed -i \
|
sed -i \
|
||||||
's,/lib/ld-musl-`+linuxArch()+`.so.1,/system/bin/linker,' \
|
's,/lib/ld-musl-`+linuxArch()+`.so.1,/system/bin/linker,' \
|
||||||
cmd/link/internal/`+runtime.GOARCH+`/obj.go
|
cmd/link/internal/`+arch+`/obj.go
|
||||||
`, go121,
|
`, go121,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -132,7 +131,7 @@ sed -i \
|
|||||||
[]string{"CGO_ENABLED=0"}, `
|
[]string{"CGO_ENABLED=0"}, `
|
||||||
sed -i \
|
sed -i \
|
||||||
's,/lib/ld-musl-`+linuxArch()+`.so.1,/system/bin/linker,' \
|
's,/lib/ld-musl-`+linuxArch()+`.so.1,/system/bin/linker,' \
|
||||||
cmd/link/internal/`+runtime.GOARCH+`/obj.go
|
cmd/link/internal/`+arch+`/obj.go
|
||||||
|
|
||||||
rm \
|
rm \
|
||||||
os/root_unix_test.go \
|
os/root_unix_test.go \
|
||||||
@@ -150,7 +149,7 @@ rm \
|
|||||||
finalEnv, `
|
finalEnv, `
|
||||||
sed -i \
|
sed -i \
|
||||||
's,/lib/ld-musl-`+linuxArch()+`.so.1,/system/bin/linker,' \
|
's,/lib/ld-musl-`+linuxArch()+`.so.1,/system/bin/linker,' \
|
||||||
cmd/link/internal/`+runtime.GOARCH+`/obj.go
|
cmd/link/internal/`+arch+`/obj.go
|
||||||
sed -i \
|
sed -i \
|
||||||
's/cpu.X86.HasAVX512VBMI/& \&\& cpu.X86.HasPOPCNT/' \
|
's/cpu.X86.HasAVX512VBMI/& \&\& cpu.X86.HasPOPCNT/' \
|
||||||
internal/runtime/gc/scan/scan_amd64.go
|
internal/runtime/gc/scan/scan_amd64.go
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package rosa
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"regexp"
|
"regexp"
|
||||||
"runtime"
|
|
||||||
"slices"
|
"slices"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
@@ -248,7 +247,7 @@ func (t Toolchain) newLLVM() (pkg.Artifact, string) {
|
|||||||
// unwind: fails on musl
|
// unwind: fails on musl
|
||||||
"eh_frame_fde_pc_range",
|
"eh_frame_fde_pc_range",
|
||||||
}
|
}
|
||||||
switch runtime.GOARCH {
|
switch arch {
|
||||||
case "arm64":
|
case "arm64":
|
||||||
skipChecks = append(skipChecks,
|
skipChecks = append(skipChecks,
|
||||||
// LLVM: intermittently crashes
|
// LLVM: intermittently crashes
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ package rosa
|
|||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"path"
|
"path"
|
||||||
"runtime"
|
|
||||||
"slices"
|
"slices"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
@@ -54,10 +53,9 @@ var (
|
|||||||
AbsSystem = fhs.AbsRoot.Append("system")
|
AbsSystem = fhs.AbsRoot.Append("system")
|
||||||
)
|
)
|
||||||
|
|
||||||
// linuxArch returns the architecture name used by linux corresponding to
|
// linuxArch returns the architecture name used by linux corresponding to arch.
|
||||||
// [runtime.GOARCH].
|
|
||||||
func linuxArch() string {
|
func linuxArch() string {
|
||||||
switch runtime.GOARCH {
|
switch arch {
|
||||||
case "amd64":
|
case "amd64":
|
||||||
return "x86_64"
|
return "x86_64"
|
||||||
case "arm64":
|
case "arm64":
|
||||||
@@ -66,11 +64,11 @@ func linuxArch() string {
|
|||||||
return "riscv64"
|
return "riscv64"
|
||||||
|
|
||||||
default:
|
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 {
|
func triplet() string {
|
||||||
return linuxArch() + "-rosa-linux-musl"
|
return linuxArch() + "-rosa-linux-musl"
|
||||||
}
|
}
|
||||||
@@ -80,9 +78,9 @@ type perArch[T any] map[string]T
|
|||||||
|
|
||||||
// unwrap returns the value for the current architecture.
|
// unwrap returns the value for the current architecture.
|
||||||
func (p perArch[T]) unwrap() T {
|
func (p perArch[T]) unwrap() T {
|
||||||
v, ok := p[runtime.GOARCH]
|
v, ok := p[arch]
|
||||||
if !ok {
|
if !ok {
|
||||||
panic("unsupported target " + runtime.GOARCH)
|
panic("unsupported target " + arch)
|
||||||
}
|
}
|
||||||
return v
|
return v
|
||||||
}
|
}
|
||||||
@@ -268,7 +266,7 @@ func (t Toolchain) New(
|
|||||||
support = append(support, extra...)
|
support = append(support, extra...)
|
||||||
support = append(support, cureEtc{})
|
support = append(support, cureEtc{})
|
||||||
if t == toolchainStage0 {
|
if t == toolchainStage0 {
|
||||||
support = append(support, NewStage0())
|
support = append(support, t.Load(stage0Dist))
|
||||||
} else {
|
} else {
|
||||||
support = append(support, _toolchainBusybox.New("gentoo", 0, nil, nil, nil, `
|
support = append(support, _toolchainBusybox.New("gentoo", 0, nil, nil, nil, `
|
||||||
tar -C /work -xf /usr/src/stage3.tar.xz
|
tar -C /work -xf /usr/src/stage3.tar.xz
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
package rosa
|
package rosa
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"sync"
|
|
||||||
|
|
||||||
"hakurei.app/fhs"
|
"hakurei.app/fhs"
|
||||||
"hakurei.app/internal/pkg"
|
"hakurei.app/internal/pkg"
|
||||||
)
|
)
|
||||||
@@ -32,25 +30,22 @@ func init() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
func init() {
|
||||||
// stage0 stores the tarball unpack artifact.
|
const version = "20260504"
|
||||||
stage0 pkg.Artifact
|
artifactsM[stage0Dist] = Metadata{
|
||||||
// stage0Once is for lazy initialisation of stage0.
|
f: func(Toolchain) (pkg.Artifact, string) {
|
||||||
stage0Once sync.Once
|
return newTar(
|
||||||
)
|
"https://hakurei.app/seed/"+version+"/"+
|
||||||
|
|
||||||
// NewStage0 returns a stage0 distribution created from curing [Stage0].
|
|
||||||
func NewStage0() pkg.Artifact {
|
|
||||||
stage0Once.Do(func() {
|
|
||||||
stage0 = newTar(
|
|
||||||
"https://hakurei.app/seed/20260504/"+
|
|
||||||
"stage0-"+triplet()+".tar.bz2",
|
"stage0-"+triplet()+".tar.bz2",
|
||||||
perArch[string]{
|
perArch[string]{
|
||||||
"amd64": "IQjFDkiAVLo1XzflgMMiLP3gnVY2hhDMTzl-QqJDCQhcLQ3lLtRzjI5WCxGyW_lk",
|
"amd64": "IQjFDkiAVLo1XzflgMMiLP3gnVY2hhDMTzl-QqJDCQhcLQ3lLtRzjI5WCxGyW_lk",
|
||||||
"arm64": "6fmwl2Umx2QssKQvxxb1JOGkAjzfA_MXKku0jVdGjYGb35OvwEVA5NYtd0HIy3yH",
|
"arm64": "6fmwl2Umx2QssKQvxxb1JOGkAjzfA_MXKku0jVdGjYGb35OvwEVA5NYtd0HIy3yH",
|
||||||
}.unwrap(),
|
}.unwrap(),
|
||||||
pkg.TarBzip2,
|
pkg.TarBzip2,
|
||||||
)
|
), version
|
||||||
})
|
},
|
||||||
return stage0
|
|
||||||
|
Name: "stage0-dist",
|
||||||
|
Description: "Rosa OS stage0 bootstrap seed",
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,6 @@
|
|||||||
package rosa
|
package rosa
|
||||||
|
|
||||||
import (
|
import "hakurei.app/internal/pkg"
|
||||||
"runtime"
|
|
||||||
|
|
||||||
"hakurei.app/internal/pkg"
|
|
||||||
)
|
|
||||||
|
|
||||||
func (t Toolchain) newTamaGo() (pkg.Artifact, string) {
|
func (t Toolchain) newTamaGo() (pkg.Artifact, string) {
|
||||||
const (
|
const (
|
||||||
@@ -26,7 +22,7 @@ chmod -R +w ..
|
|||||||
|
|
||||||
sed -i \
|
sed -i \
|
||||||
's,/lib/ld-musl-`+linuxArch()+`.so.1,/system/bin/linker,' \
|
's,/lib/ld-musl-`+linuxArch()+`.so.1,/system/bin/linker,' \
|
||||||
cmd/link/internal/`+runtime.GOARCH+`/obj.go
|
cmd/link/internal/`+arch+`/obj.go
|
||||||
sed -i \
|
sed -i \
|
||||||
's/cpu.X86.HasAVX512VBMI/& \&\& cpu.X86.HasPOPCNT/' \
|
's/cpu.X86.HasAVX512VBMI/& \&\& cpu.X86.HasPOPCNT/' \
|
||||||
internal/runtime/gc/scan/scan_amd64.go
|
internal/runtime/gc/scan/scan_amd64.go
|
||||||
|
|||||||
Reference in New Issue
Block a user