internal/rosa: kernel artifact
All checks were successful
Test / Create distribution (push) Successful in 1m0s
Test / Sandbox (push) Successful in 2m38s
Test / Hakurei (push) Successful in 3m58s
Test / ShareFS (push) Successful in 4m4s
Test / Hpkg (push) Successful in 4m38s
Test / Sandbox (race detector) (push) Successful in 5m3s
Test / Hakurei (race detector) (push) Successful in 5m58s
Test / Flake checks (push) Successful in 1m37s

The configuration still wants some cleanup, but this works fine as a generic kernel for now.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2026-02-21 22:53:51 +09:00
parent d021621fba
commit 7f1e4cf43c
4 changed files with 12600 additions and 0 deletions

View File

@@ -41,3 +41,83 @@ func (t Toolchain) newKernelHeaders() pkg.Artifact {
)
}
func init() { artifactsF[KernelHeaders] = Toolchain.newKernelHeaders }
func (t Toolchain) newKernel() pkg.Artifact {
return t.NewViaMake("kernel", kernelVersion, kernelSource, &MakeAttr{
OmitDefaults: true,
SkipConfigure: true,
// Build, install, and boot kernel before running kselftest on it.
SkipCheck: true,
Env: []string{
"PATH=/system/sbin",
},
ScriptEarly: `
install -Dm0400 \
/usr/src/.config \
/tmp/kbuild/.config
install -Dm0500 \
/usr/src/.installkernel \
/sbin/installkernel
`,
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",
},
ScriptInstall: `
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
`,
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"
`))),
},
},
t.Load(Flex),
t.Load(Bison),
t.Load(M4),
t.Load(Tar),
t.Load(Perl),
t.Load(BC),
t.Load(Sed),
t.Load(Gawk),
t.Load(Coreutils),
t.Load(Diffutils),
t.Load(XZ),
t.Load(Zlib),
t.Load(Gzip),
t.Load(Bzip2),
t.Load(Zstd),
t.Load(Kmod),
t.Load(Elfutils),
t.Load(OpenSSL),
t.Load(KernelHeaders),
)
}
func init() { artifactsF[Kernel] = Toolchain.newKernel }