All checks were successful
Test / Create distribution (push) Successful in 1m7s
Test / Sandbox (push) Successful in 2m46s
Test / Hakurei (push) Successful in 3m47s
Test / ShareFS (push) Successful in 3m59s
Test / Sandbox (race detector) (push) Successful in 5m11s
Test / Hakurei (race detector) (push) Successful in 5m57s
Test / Flake checks (push) Successful in 1m28s
The older version no longer compiles on LLVM 22. Signed-off-by: Ophestra <cat@gensokyo.uk>
170 lines
3.7 KiB
Go
170 lines
3.7 KiB
Go
package rosa
|
|
|
|
import "hakurei.app/internal/pkg"
|
|
|
|
const kernelVersion = "6.12.75"
|
|
|
|
var kernelSource = pkg.NewHTTPGetTar(
|
|
nil, "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/"+
|
|
"snapshot/linux-"+kernelVersion+".tar.gz",
|
|
mustDecode("VnyTxt1W6qtKpJz2rYuwor0CfZrltozGwDgXQwK7q6o8kSsZF0veXldHYXCQXZ5L"),
|
|
pkg.TarGzip,
|
|
)
|
|
|
|
func (t Toolchain) newKernelSource() (pkg.Artifact, string) {
|
|
return t.New("kernel-"+kernelVersion+"-src", 0, nil, nil, nil, `
|
|
mkdir -p /work/usr/src/
|
|
cp -r /usr/src/linux /work/usr/src/
|
|
chmod -R +w /work/usr/src/linux/
|
|
`, pkg.Path(AbsUsrSrc.Append("linux"), false, kernelSource)), kernelVersion
|
|
}
|
|
func init() {
|
|
artifactsM[KernelSource] = Metadata{
|
|
f: Toolchain.newKernelSource,
|
|
|
|
Name: "kernel-source",
|
|
Description: "a writable kernel source tree installed to /usr/src/linux",
|
|
Website: "https://kernel.org/",
|
|
}
|
|
}
|
|
|
|
func (t Toolchain) newKernelHeaders() (pkg.Artifact, string) {
|
|
return t.NewPackage("kernel-headers", kernelVersion, kernelSource, &PackageAttr{
|
|
Flag: TEarly,
|
|
}, &MakeHelper{
|
|
SkipConfigure: true,
|
|
|
|
SkipCheck: true,
|
|
Make: []string{
|
|
"-f /usr/src/kernel-headers/Makefile",
|
|
"O=/tmp/kbuild",
|
|
"LLVM=1",
|
|
`HOSTLDFLAGS="${LDFLAGS:-''}"`,
|
|
"INSTALL_HDR_PATH=/work/system",
|
|
"headers_install",
|
|
},
|
|
Install: "# headers installed during make",
|
|
},
|
|
Rsync,
|
|
), kernelVersion
|
|
}
|
|
func init() {
|
|
artifactsM[KernelHeaders] = Metadata{
|
|
f: Toolchain.newKernelHeaders,
|
|
|
|
Name: "kernel-headers",
|
|
Description: "an installation of kernel headers",
|
|
Website: "https://kernel.org/",
|
|
}
|
|
}
|
|
|
|
func (t Toolchain) newKernel() (pkg.Artifact, string) {
|
|
return t.NewPackage("kernel", kernelVersion, kernelSource, &PackageAttr{
|
|
Env: []string{
|
|
"PATH=/system/sbin",
|
|
},
|
|
ScriptEarly: `
|
|
install -Dm0400 \
|
|
/usr/src/.config \
|
|
/tmp/kbuild/.config
|
|
install -Dm0500 \
|
|
/usr/src/.installkernel \
|
|
/sbin/installkernel
|
|
`,
|
|
|
|
Paths: []pkg.ExecPath{
|
|
pkg.Path(AbsUsrSrc.Append(
|
|
".config",
|
|
), false, pkg.NewFile(".config", kernelConfig)),
|
|
pkg.Path(AbsUsrSrc.Append(
|
|
".installkernel",
|
|
), false, pkg.NewFile("installkernel", []byte(`#!/bin/sh -e
|
|
echo "Installing linux $1..."
|
|
cp -av "$2" "$4"
|
|
cp -av "$3" "$4"
|
|
`))),
|
|
},
|
|
|
|
Flag: TExclusive,
|
|
}, &MakeHelper{
|
|
OmitDefaults: true,
|
|
SkipConfigure: true,
|
|
|
|
// Build, install, and boot kernel before running kselftest on it.
|
|
SkipCheck: true,
|
|
|
|
Make: []string{
|
|
"-f /usr/src/kernel/Makefile",
|
|
"O=/tmp/kbuild",
|
|
|
|
"LLVM=1",
|
|
"KBUILD_BUILD_VERSION='1-Rosa'",
|
|
"KBUILD_BUILD_TIMESTAMP='2106-02-07 06:28:15 UTC'",
|
|
"KBUILD_BUILD_USER=kbuild",
|
|
"KBUILD_BUILD_HOST=localhost",
|
|
"all",
|
|
},
|
|
Install: `
|
|
make \
|
|
"-j$(nproc)" \
|
|
-f /usr/src/kernel/Makefile \
|
|
O=/tmp/kbuild \
|
|
LLVM=1 \
|
|
INSTALL_PATH=/work \
|
|
install \
|
|
INSTALL_MOD_PATH=/work \
|
|
modules_install
|
|
rm -v /work/lib/modules/` + kernelVersion + `/build
|
|
`,
|
|
},
|
|
Flex,
|
|
Bison,
|
|
M4,
|
|
Tar,
|
|
Perl,
|
|
BC,
|
|
Sed,
|
|
Gawk,
|
|
Coreutils,
|
|
Diffutils,
|
|
Python,
|
|
|
|
XZ,
|
|
Zlib,
|
|
Gzip,
|
|
Bzip2,
|
|
Zstd,
|
|
Kmod,
|
|
Elfutils,
|
|
OpenSSL,
|
|
UtilLinux,
|
|
KernelHeaders,
|
|
), kernelVersion
|
|
}
|
|
func init() {
|
|
artifactsM[Kernel] = Metadata{
|
|
f: Toolchain.newKernel,
|
|
|
|
Name: "kernel",
|
|
Description: "the generic Rosa OS linux kernel",
|
|
Website: "https://kernel.org/",
|
|
|
|
ID: 375621,
|
|
}
|
|
}
|
|
|
|
func (t Toolchain) newGenInitCPIO() (pkg.Artifact, string) {
|
|
return t.New("gen_init_cpio-"+kernelVersion, 0, nil, nil, nil, `
|
|
mkdir -p /work/system/bin/
|
|
cc -o /work/system/bin/gen_init_cpio /usr/src/linux/usr/gen_init_cpio.c
|
|
`, pkg.Path(AbsUsrSrc.Append("linux"), false, kernelSource)), kernelVersion
|
|
}
|
|
func init() {
|
|
artifactsM[GenInitCPIO] = Metadata{
|
|
f: Toolchain.newGenInitCPIO,
|
|
|
|
Name: "gen_init_cpio",
|
|
Description: "a program in the kernel source tree for creating initramfs archive",
|
|
}
|
|
}
|