1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
package rosa
import (
"slices"
"hakurei.app/internal/pkg"
)
// newKernel is a helper for interacting with Kbuild.
func (t Toolchain) newKernel(
script string,
extra ...pkg.Artifact,
) pkg.Artifact {
const (
version = "6.18.5"
checksum = "-V1e1WWl7HuePkmm84sSKF7nLuHfUs494uNMzMqXEyxcNE_PUE0FICL0oGWn44mM"
)
return t.New("kernel-"+version, slices.Concat([]pkg.Artifact{
t.NewMake(),
}, extra), nil, nil, `
export LLVM=1
export HOSTLDFLAGS="${LDFLAGS}"
chmod -R +w /usr/src/linux && cd /usr/src/linux
`+script, pkg.Path(AbsUsrSrc.Append("linux"), true, pkg.NewHTTPGetTar(
nil,
"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/"+
"snapshot/linux-"+version+".tar.gz",
mustDecode(checksum),
pkg.TarGzip,
)))
}
// NewKernelHeaders returns a [pkg.Artifact] containing kernel headers.
func (t Toolchain) NewKernelHeaders() pkg.Artifact {
return t.newKernel(`
make "-j$(nproc)" \
INSTALL_HDR_PATH=/work/system \
headers_install
`, t.NewRsync())
}
|