diff options
| author | Ophestra <cat@gensokyo.uk> | 2026-02-21 22:53:51 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2026-02-21 23:19:16 +0900 |
| commit | 7f1e4cf43c8ad6dcf771fa43d28c0ce3c093e319 (patch) | |
| tree | 2dcb776c33bfe41eea19f356d4ef8857ef70aad1 /internal/rosa/kernel.go | |
| parent | d021621fbaebf3a565ec837ca7201c1c56b672ff (diff) | |
internal/rosa: kernel artifact
The configuration still wants some cleanup, but this works fine as a generic kernel for now.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/rosa/kernel.go')
| -rw-r--r-- | internal/rosa/kernel.go | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/internal/rosa/kernel.go b/internal/rosa/kernel.go index e9c9dee8..ac6e0c4d 100644 --- a/internal/rosa/kernel.go +++ b/internal/rosa/kernel.go @@ -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 } |
