feat: add linux kernel initramfs and related tools

Signed-off-by: sisungo <[email protected]>
This commit is contained in:
2026-09-07 03:13:55 +00:00
parent 5c89842dc0
commit 47ade913e2
10 changed files with 230 additions and 14 deletions
+21 -5
View File
@@ -1,24 +1,31 @@
import os
import shutil
import subprocess
import lib.arch as arch
import lib.cpp as cpp
from lib import cpp, arch, packie
from lib.make import *
upstream_version = "6.18.45"
upstream_version = "7.2.3"
version(f"{upstream_version}")
description("the Linux operating system kernel")
maintainer("sisungo <[email protected]>")
source_url(
f"https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-{upstream_version}.tar.xz"
f"https://cdn.kernel.org/pub/linux/kernel/v7.x/linux-{upstream_version}.tar.xz"
)
builddep("shortcut/c")
builddep("shortcut/autotools")
builddep("libncurses-dev")
builddep("aws-lc-dev")
builddep("aws-lc-dev @target")
builddep("aws-lc-tools")
builddep("airboot-linux-stage2-mkinitramfs")
builddep("airboot-linux-stage2-arch @target")
builddep("flex")
builddep("bison")
builddep("bc")
builddep("gzip")
def get_arch():
@@ -43,6 +50,14 @@ def build():
)
os.remove(f"../kmod_install/lib/modules/{upstream_version}/build")
asp_prefix = packie.prefix_of(f"airboot-linux-stage2-arch @{arch.get_target()}")
subprocess.run([
"mkinitramfs",
"-a", f"{asp_prefix}/data",
"-o", f"{os.getcwd()}/../initramfs.img",
"-m", f"{os.getcwd()}/../kmod_install",
"-k", upstream_version,
], check=True)
on_build(build)
@@ -78,6 +93,7 @@ def pack_linux(composer):
except Exception:
pass
composer.add_dir(f"../kmod_install/lib/modules/{upstream_version}", "modules")
composer.addfile("../initramfs.img", "initramfs.img")
package(f"{base_name}")