diff options
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 } |
