79 lines
2.1 KiB
Python
79 lines
2.1 KiB
Python
version = "7.0.9"
|
|
revision = 2
|
|
description = "Linux kernel"
|
|
license = "GPL-2.0-only"
|
|
source = tarball(
|
|
url=f"https://cdn.kernel.org/pub/linux/kernel/v7.x/linux-{version}.tar.xz",
|
|
sha256="ac07acdf76cf4621cc5187a2670270a1a699533c8a6b225e4878c416ad83f1c4",
|
|
)
|
|
host_deps = ["binutils", "gcc"]
|
|
deps = [profile["libc"]]
|
|
|
|
linux_archs = {"aarch64": "arm64"}
|
|
linux_subarchs = {"x86_64": "x86"}
|
|
|
|
|
|
def _make(self, *extra):
|
|
arch = linux_archs.get(self.arch, self.arch)
|
|
subarch = linux_subarchs.get(self.arch)
|
|
subarch_arg = (f"SUBARCH={subarch}",) if subarch else ()
|
|
return (
|
|
"make",
|
|
f"ARCH={arch}",
|
|
*subarch_arg,
|
|
f"CROSS_COMPILE={self.triple}-",
|
|
f"-j{self.jobs}",
|
|
*extra,
|
|
)
|
|
|
|
|
|
def configure(self):
|
|
self.run("cp", "-rp", f"{self.source_dir}/.", self.build_dir)
|
|
self.run(
|
|
"cp", self.files / f"config.{self.arch}", self.build_dir / ".config"
|
|
)
|
|
self.run(*_make(self, "olddefconfig"))
|
|
|
|
|
|
def build(self):
|
|
self.run(*_make(self))
|
|
|
|
|
|
def install(self):
|
|
self.run(
|
|
"install",
|
|
"-Dm644",
|
|
self.build_dir / "arch/x86/boot/bzImage",
|
|
self.dest_dir / f"boot/vmlinuz-{self.version}",
|
|
)
|
|
self.run(
|
|
"install",
|
|
"-Dm644",
|
|
self.build_dir / ".config",
|
|
self.dest_dir / f"boot/config-{self.version}",
|
|
)
|
|
self.run(
|
|
"install",
|
|
"-Dm644",
|
|
self.build_dir / "System.map",
|
|
self.dest_dir / f"boot/System.map-{self.version}",
|
|
)
|
|
# Install loadable modules so udev can autoload DRM/input drivers at boot.
|
|
# The kernel's modules_install target runs depmod itself (host kmod).
|
|
self.run(
|
|
*_make(
|
|
self,
|
|
f"INSTALL_MOD_PATH={self.dest_dir}",
|
|
"INSTALL_MOD_STRIP=1",
|
|
"modules_install",
|
|
)
|
|
)
|
|
# Drop the dangling build/source symlinks that point at the (ephemeral)
|
|
# build tree; they are useless in the target image.
|
|
self.run(
|
|
"sh",
|
|
"-c",
|
|
f"rm -f {self.dest_dir}/lib/modules/*/build "
|
|
f"{self.dest_dir}/lib/modules/*/source",
|
|
)
|