forked from semios/ports
Merge pull request 'feat: add linux kernel initramfs and related tools' (#1) from sisungo/ports:kernel-tools into main
Reviewed-on: semios/ports#1
This commit is contained in:
+18
-6
@@ -10,21 +10,21 @@ def is_abslink(path):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def autolink_bin(composer: pkgcomposer.PkgComposer):
|
def autolink_bin():
|
||||||
if is_abslink("bin"):
|
if is_abslink("bin"):
|
||||||
return
|
return
|
||||||
for i in common.treedir("bin"):
|
for i in common.treedir("bin"):
|
||||||
if i.is_file() and os.access(i.path, os.X_OK):
|
if i.is_file() and os.access(i.path, os.X_OK):
|
||||||
make.link(f"bin/{i.name}", "/bin/" + i.name)
|
make.link(f"bin/{i.name}", "/bin/" + i.name)
|
||||||
|
|
||||||
def autolink_lib(composer: pkgcomposer.PkgComposer):
|
def autolink_lib():
|
||||||
if is_abslink("lib"):
|
if is_abslink("lib"):
|
||||||
return
|
return
|
||||||
for i in common.treedir("lib"):
|
for i in common.treedir("lib"):
|
||||||
if i.is_file():
|
if i.is_file():
|
||||||
make.link(f"lib/{i.name}", "/lib/" + arch.get_target() + "/" + i.name)
|
make.link(f"lib/{i.name}", "/lib/" + arch.get_target() + "/" + i.name)
|
||||||
|
|
||||||
def autolink_include(composer: pkgcomposer.PkgComposer):
|
def autolink_include():
|
||||||
if is_abslink("include"):
|
if is_abslink("include"):
|
||||||
return
|
return
|
||||||
for i in common.treedir("include"):
|
for i in common.treedir("include"):
|
||||||
@@ -34,21 +34,33 @@ def autolink_include(composer: pkgcomposer.PkgComposer):
|
|||||||
"/lib/" + arch.get_target() + "/include/" + i.name,
|
"/lib/" + arch.get_target() + "/include/" + i.name,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def autolink_share_pkgconfig():
|
||||||
|
if is_abslink("share/pkgconfig"):
|
||||||
|
return
|
||||||
|
for i in common.treedir("share/pkgconfig"):
|
||||||
|
if i.is_file():
|
||||||
|
make.link(f"share/pkgconfig/{i.name}", "/share/pkgconfig/" + i.name)
|
||||||
|
|
||||||
|
|
||||||
def autolink(composer: pkgcomposer.PkgComposer):
|
def autolink(composer: pkgcomposer.PkgComposer):
|
||||||
os.chdir(composer.workdir + "/bundle/")
|
os.chdir(composer.workdir + "/bundle/")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
autolink_bin(composer)
|
autolink_bin()
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
try:
|
try:
|
||||||
autolink_lib(composer)
|
autolink_lib()
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
try:
|
try:
|
||||||
autolink_include(composer)
|
autolink_include()
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
try:
|
||||||
|
autolink_share_pkgconfig()
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|||||||
@@ -145,6 +145,9 @@ def _auto_pack(profiles: list[str], pc: pkgcomposer.PkgComposer):
|
|||||||
if "dev" in profiles:
|
if "dev" in profiles:
|
||||||
_do_auto_pack(pc, "lib", "lib", _autopack_filter_dev)
|
_do_auto_pack(pc, "lib", "lib", _autopack_filter_dev)
|
||||||
_do_auto_pack(pc, "include", "include", _autopack_filter_dev)
|
_do_auto_pack(pc, "include", "include", _autopack_filter_dev)
|
||||||
|
if os.path.exists("share/gir-1.0"):
|
||||||
|
pc.makedirs("include/gir")
|
||||||
|
pc.add_dir("share/gir-1.0", "include/gir/gir-1.0")
|
||||||
|
|
||||||
|
|
||||||
def use_auto_pack(profiles: list[str]):
|
def use_auto_pack(profiles: list[str]):
|
||||||
|
|||||||
+4
-3
@@ -1,5 +1,6 @@
|
|||||||
import typing
|
import typing
|
||||||
import hashlib
|
import hashlib
|
||||||
|
import os
|
||||||
|
|
||||||
from lib import arch
|
from lib import arch
|
||||||
|
|
||||||
@@ -46,11 +47,11 @@ def builddep(s: str):
|
|||||||
_builddep += ["gnu-make", "gnu-sed", "awk", "grep"]
|
_builddep += ["gnu-make", "gnu-sed", "awk", "grep"]
|
||||||
elif s == "shortcut/rust":
|
elif s == "shortcut/rust":
|
||||||
builddep("shortcut/c")
|
builddep("shortcut/c")
|
||||||
_builddep += ["cargo", "rustc"]
|
_builddep += ["cargo", "rust"]
|
||||||
elif s == "shortcut/cmake":
|
elif s == "shortcut/cmake":
|
||||||
_builddep += ["cmake", "ninja"]
|
_builddep += ["cmake", "ninja", "pkgconf"]
|
||||||
elif s == "shortcut/meson":
|
elif s == "shortcut/meson":
|
||||||
_builddep += ["meson", "ninja"]
|
_builddep += ["meson", "ninja", "pkgconf"]
|
||||||
else:
|
else:
|
||||||
_builddep += [s.replace("@target", f"@{arch.get_target()}")]
|
_builddep += [s.replace("@target", f"@{arch.get_target()}")]
|
||||||
|
|
||||||
|
|||||||
@@ -65,3 +65,11 @@ class PkgComposer:
|
|||||||
|
|
||||||
def link_external(self, src: str, dst: str):
|
def link_external(self, src: str, dst: str):
|
||||||
os.symlink(src, f"{self.workdir}/bundle/{dst}")
|
os.symlink(src, f"{self.workdir}/bundle/{dst}")
|
||||||
|
|
||||||
|
def add(self, src: str, dst: str | None = None):
|
||||||
|
if dst is None:
|
||||||
|
dst = src
|
||||||
|
if os.path.islink(src) or os.path.isfile(src):
|
||||||
|
self.addfile(src, dst)
|
||||||
|
else:
|
||||||
|
self.add_dir(src, dst, True)
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
import os
|
||||||
|
|
||||||
|
from lib import arch
|
||||||
|
from lib.make import *
|
||||||
|
|
||||||
|
|
||||||
|
version("0.1.0-alpha.1")
|
||||||
|
description("AirBoot Linux initramfs generator.")
|
||||||
|
maintainer("sisungo <[email protected]>")
|
||||||
|
source_url("https://gitea.semilabs.org/semios/airboot-linux-stage2/archive/0.1.0-alpha.1.tar.gz")
|
||||||
|
|
||||||
|
|
||||||
|
def build():
|
||||||
|
os.system("./arch-support/build.sh")
|
||||||
|
|
||||||
|
on_build(build)
|
||||||
|
|
||||||
|
|
||||||
|
def pack_arch(composer):
|
||||||
|
composer.add(f"arch-support/target/{arch.get_target().split('-')[0]}", "data")
|
||||||
|
|
||||||
|
def pack_mkinitramfs(composer):
|
||||||
|
composer.makedir("bin")
|
||||||
|
composer.add("mkinitramfs.sh", "bin/mkinitramfs")
|
||||||
|
|
||||||
|
package("airboot-linux-stage2-arch")
|
||||||
|
on_pack(pack_arch)
|
||||||
|
|
||||||
|
package("airboot-linux-stage2-mkinitramfs")
|
||||||
|
dep("mksh")
|
||||||
|
arch_any()
|
||||||
|
on_pack(pack_mkinitramfs)
|
||||||
@@ -76,6 +76,7 @@ package("bash")
|
|||||||
dep("semi-libc @same-arch")
|
dep("semi-libc @same-arch")
|
||||||
dep("libncurses @same-arch")
|
dep("libncurses @same-arch")
|
||||||
on_pack(pack_bash)
|
on_pack(pack_bash)
|
||||||
|
link("bin/bash", "/bin/sh")
|
||||||
|
|
||||||
package("bash-dev")
|
package("bash-dev")
|
||||||
dep("bash (same)")
|
dep("bash (same)")
|
||||||
|
|||||||
@@ -1,24 +1,31 @@
|
|||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
|
import subprocess
|
||||||
|
|
||||||
import lib.arch as arch
|
from lib import cpp, arch, packie
|
||||||
import lib.cpp as cpp
|
|
||||||
from lib.make import *
|
from lib.make import *
|
||||||
|
|
||||||
upstream_version = "6.18.45"
|
|
||||||
|
upstream_version = "7.2.3"
|
||||||
|
|
||||||
version(f"{upstream_version}")
|
version(f"{upstream_version}")
|
||||||
description("the Linux operating system kernel")
|
description("the Linux operating system kernel")
|
||||||
maintainer("sisungo <[email protected]>")
|
maintainer("sisungo <[email protected]>")
|
||||||
source_url(
|
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/c")
|
||||||
builddep("shortcut/autotools")
|
builddep("shortcut/autotools")
|
||||||
builddep("libncurses-dev")
|
builddep("libncurses-dev")
|
||||||
builddep("aws-lc-dev")
|
builddep("aws-lc-dev @target")
|
||||||
builddep("aws-lc-tools")
|
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():
|
def get_arch():
|
||||||
@@ -43,6 +50,14 @@ def build():
|
|||||||
)
|
)
|
||||||
os.remove(f"../kmod_install/lib/modules/{upstream_version}/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)
|
on_build(build)
|
||||||
|
|
||||||
@@ -78,6 +93,7 @@ def pack_linux(composer):
|
|||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
composer.add_dir(f"../kmod_install/lib/modules/{upstream_version}", "modules")
|
composer.add_dir(f"../kmod_install/lib/modules/{upstream_version}", "modules")
|
||||||
|
composer.addfile("../initramfs.img", "initramfs.img")
|
||||||
|
|
||||||
|
|
||||||
package(f"{base_name}")
|
package(f"{base_name}")
|
||||||
|
|||||||
@@ -0,0 +1,74 @@
|
|||||||
|
import os
|
||||||
|
|
||||||
|
from lib import rust
|
||||||
|
from lib.make import *
|
||||||
|
|
||||||
|
|
||||||
|
version("0.1.0-alpha.2")
|
||||||
|
description("Linux device userspace daemon.")
|
||||||
|
maintainer("sisungo <[email protected]>")
|
||||||
|
source_url("https://gitea.semilabs.org/semios/lxdeviced/archive/0.1.0-alpha.2.tar.gz")
|
||||||
|
|
||||||
|
builddep("shortcut/rust")
|
||||||
|
|
||||||
|
|
||||||
|
def build():
|
||||||
|
rust.build()
|
||||||
|
|
||||||
|
on_build(build)
|
||||||
|
|
||||||
|
|
||||||
|
PKGCONF_LIBUDEV="""
|
||||||
|
prefix=/
|
||||||
|
exec_prefix=/
|
||||||
|
libdir=
|
||||||
|
includedir=
|
||||||
|
|
||||||
|
Name: libudev
|
||||||
|
Description: Udev library -- compatible, powered by lxdeviced
|
||||||
|
Version: 260
|
||||||
|
Cflags: -I${includedir}
|
||||||
|
Libs: -L${libdir} -ludev
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
def pack(composer):
|
||||||
|
composer.makedirs("share/device")
|
||||||
|
composer.add_dir("misc/rules", "share/device/rules")
|
||||||
|
oldpwd = os.getcwd()
|
||||||
|
os.chdir(rust.artifacts_dir())
|
||||||
|
composer.makedir("bin")
|
||||||
|
composer.addfile("lxdeviced", "bin/lxdeviced")
|
||||||
|
composer.addfile("device", "bin/device")
|
||||||
|
os.chdir(oldpwd)
|
||||||
|
|
||||||
|
def pack_libudev(composer):
|
||||||
|
oldpwd = os.getcwd()
|
||||||
|
os.chdir(rust.artifacts_dir())
|
||||||
|
composer.makedir("lib")
|
||||||
|
composer.addfile("libudev.so", "lib/libudev.so")
|
||||||
|
os.chdir(oldpwd)
|
||||||
|
|
||||||
|
def pack_libudev_dev(composer):
|
||||||
|
oldpwd = os.getcwd()
|
||||||
|
composer.makedir("include")
|
||||||
|
composer.addfile("libcompat/udev/include/libudev.h", "include/libudev.h")
|
||||||
|
composer.makedirs("lib/pkgconfig")
|
||||||
|
pkgconf = PKGCONF_LIBUDEV.replace("libdir=", f"libdir={get_prefix('lxdeviced-libudev')}/lib")
|
||||||
|
pkgconf = PKGCONF_LIBUDEV.replace("includedir=", f"includedir={get_prefix('lxdeviced-libudev-dev')}/include")
|
||||||
|
with open(f"{composer.workdir}/bundle/lib/pkgconfig/libudev.pc", "wt+") as file:
|
||||||
|
file.write(pkgconf)
|
||||||
|
os.chdir(oldpwd)
|
||||||
|
|
||||||
|
|
||||||
|
package("lxdeviced")
|
||||||
|
on_pack(pack)
|
||||||
|
dep("semi-libc @same-arch")
|
||||||
|
|
||||||
|
package("lxdeviced-libudev")
|
||||||
|
on_pack(pack_libudev)
|
||||||
|
dep("semi-libc @same-arch")
|
||||||
|
|
||||||
|
package("lxdeviced-libudev-dev")
|
||||||
|
on_pack(pack_libudev_dev)
|
||||||
|
dep("lxdeviced-libudev (same)")
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
import os
|
||||||
|
|
||||||
|
from lib import cpp
|
||||||
|
from lib.make import *
|
||||||
|
|
||||||
|
|
||||||
|
version("2.8")
|
||||||
|
description("A parallel implementation of gzip for modern multi-processor, multi-core machines")
|
||||||
|
maintainer("sisungo <[email protected]>")
|
||||||
|
source_url("http://zlib.net/pigz/pigz-2.8.tar.gz")
|
||||||
|
|
||||||
|
builddep("shortcut/c")
|
||||||
|
builddep("shortcut/autotools")
|
||||||
|
builddep("libz-ng-dev @target")
|
||||||
|
builddep("pkgconf")
|
||||||
|
|
||||||
|
|
||||||
|
def build():
|
||||||
|
cc=os.environ.get("CC", "cc")
|
||||||
|
cpp.make([f"CC={cc}"])
|
||||||
|
|
||||||
|
on_build(build)
|
||||||
|
|
||||||
|
|
||||||
|
def pack(composer):
|
||||||
|
composer.makedir("bin")
|
||||||
|
composer.add("pigz", "bin/pigz")
|
||||||
|
composer.add("unpigz", "bin/unpigz")
|
||||||
|
|
||||||
|
def pack_docs(composer):
|
||||||
|
composer.makedirs("share/man/man1")
|
||||||
|
composer.add("pigz.1", "share/man/man1")
|
||||||
|
|
||||||
|
package("pigz")
|
||||||
|
dep("semi-libc @same-arch")
|
||||||
|
dep("libz-ng @same-arch")
|
||||||
|
provide("gzip")
|
||||||
|
link("bin/pigz", "/bin/gzip")
|
||||||
|
link("bin/unpigz", "/bin/gunzip")
|
||||||
|
cpp.use_auto_pack(["bin"])
|
||||||
|
|
||||||
|
package("pigz-docs")
|
||||||
|
on_pack(pack_docs)
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
from lib import cpp
|
||||||
|
from lib.make import *
|
||||||
|
|
||||||
|
|
||||||
|
version("2026.6.4")
|
||||||
|
description("QuickJS is a small and embeddable Javascript engine. It supports the ES2025 specification.")
|
||||||
|
maintainer("sisungo <[email protected]>")
|
||||||
|
source_url("https://bellard.org/quickjs/quickjs-2026-06-04.tar.xz")
|
||||||
|
|
||||||
|
builddep("shortcut/c")
|
||||||
|
|
||||||
|
|
||||||
|
def build():
|
||||||
|
cpp.make()
|
||||||
|
cpp.make_install()
|
||||||
|
|
||||||
|
on_build(build)
|
||||||
|
|
||||||
|
|
||||||
|
package("quickjs")
|
||||||
|
dep("semi-libc @same-arch")
|
||||||
|
cpp.use_auto_pack(["bin"])
|
||||||
|
|
||||||
|
package("libquickjs-dev")
|
||||||
|
dep("semi-libc @same-arch")
|
||||||
|
cpp.use_auto_pack(["dev"])
|
||||||
Reference in New Issue
Block a user