forked from semios/semios-packages
83 lines
2.0 KiB
Python
83 lines
2.0 KiB
Python
import os
|
|
import shutil
|
|
|
|
import lib.arch as arch
|
|
import lib.cpp as cpp
|
|
from lib.make import *
|
|
|
|
upstream_version = "6.18.38"
|
|
|
|
version(f"{upstream_version}")
|
|
source_url(
|
|
f"https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-{upstream_version}.tar.xz"
|
|
)
|
|
|
|
builddep("shortcut/c")
|
|
builddep("shortcut/autotools")
|
|
builddep("libncurses-dev")
|
|
builddep("aws-lc-dev")
|
|
builddep("aws-lc-tools")
|
|
|
|
|
|
def get_arch():
|
|
return arch.get_target().split("-")[0].replace("aarch64", "arm64")
|
|
|
|
|
|
def build():
|
|
makeopts = [f"ARCH={get_arch()}", "LLVM=1"]
|
|
config_name = get_arch()
|
|
if os.environ.get("LINUX_VARIANT"):
|
|
config_name += "-" + os.environ["LINUX_VARIANT"]
|
|
config_file = "../../configs/config." + config_name
|
|
|
|
shutil.copy2(config_file, ".config")
|
|
|
|
cpp.make(makeopts + ["olddefconfig"])
|
|
cpp.make(makeopts)
|
|
cpp.make(["headers_install", "INSTALL_HDR_PATH=../kheaders_install"])
|
|
cpp.make(["install", "INSTALL_PATH=../kimage_install"])
|
|
cpp.make(
|
|
["modules_install", "INSTALL_MOD_STRIP=1", "INSTALL_MOD_PATH=../kmod_install"]
|
|
)
|
|
os.remove(f"../kmod_install/lib/modules/{upstream_version}/build")
|
|
|
|
|
|
on_build(build)
|
|
|
|
base_name = "linux"
|
|
if os.environ.get("LINUX_VARIANT"):
|
|
base_name += "-" + os.environ["LINUX_VARIANT"]
|
|
|
|
|
|
def pack_linux_dev(composer):
|
|
composer.add_dir(
|
|
"../kheaders_install/include",
|
|
"include",
|
|
)
|
|
|
|
|
|
package(f"{base_name}-dev")
|
|
on_pack(pack_linux_dev)
|
|
|
|
|
|
def pack_linux(composer):
|
|
try:
|
|
composer.addfile(f"../kimage_install/vmlinux-{upstream_version}", "vmlinux")
|
|
except Exception:
|
|
pass
|
|
try:
|
|
composer.addfile(f"../kimage_install/vmlinuz-{upstream_version}", "vmlinuz")
|
|
except Exception:
|
|
pass
|
|
try:
|
|
composer.addfile(
|
|
f"../kimage_install/System.map-{upstream_version}", "System.map"
|
|
)
|
|
except Exception:
|
|
pass
|
|
composer.add_dir(f"../kmod_install/lib/modules/{upstream_version}", "modules")
|
|
|
|
|
|
package(f"{base_name}")
|
|
on_pack(pack_linux)
|