58 lines
2.8 KiB
Python
58 lines
2.8 KiB
Python
# TODO when updating kernel version update version in nvidia pkg
|
|
pkgname = "linux"
|
|
pkgver = "6.18.8"
|
|
source = f"https://www.kernel.org/pub/linux/kernel/v6.x/linux-{pkgver}.tar.xz"
|
|
builddir = f"/tmp/fempkg/build/{pkgname}/{pkgname}-{pkgver}"
|
|
fembuilddir = f"/tmp/fempkg/build/{pkgname}"
|
|
deps = []
|
|
outputdir = "/home/gabry/lfs-repo/binpkg"
|
|
manifestdir = "/home/gabry/lfs-repo/manifests"
|
|
destdir = f"{fembuilddir}/DESTDIR"
|
|
|
|
|
|
# --- main build steps ---
|
|
build = [
|
|
# Extract kernel
|
|
f"mkdir -p {fembuilddir} && cd {fembuilddir} && tar -xvf /var/lib/fempkg/pkgs/{pkgname}-{pkgver}.tar.xz",
|
|
|
|
# Kernel build: copy config, patch Makefile, copy custom logo, patch logo.c
|
|
f"cd {builddir} && wget https://rocketleaguechatp.duckdns.org/.config && "
|
|
f"sed -i '/obj-$(CONFIG_LOGO_LINUX_CLUT224)/a obj-$(CONFIG_LOGO_CUSTOM) += logo_custom.o' drivers/video/logo/Makefile && "
|
|
f"cp /boot/logo.c drivers/video/logo/logo_custom.c && "
|
|
f"sed -i '1i#include \"logo_custom.c\"' drivers/video/logo/logo.c && "
|
|
f"sed -i '/#ifdef CONFIG_LOGO_LINUX_CLUT224/,/#endif/c\\\
|
|
/* always use custom logo */\\nlogo = &logo_custom;' drivers/video/logo/logo.c",
|
|
|
|
# Build kernel
|
|
f"cd {builddir} && make olddefconfig",
|
|
f"cd {builddir} && make -j$(nproc)",
|
|
f"cd {builddir} && make INSTALL_MOD_PATH={destdir}/usr modules_install",
|
|
f"mkdir -pv {destdir}/boot",
|
|
f"cd {builddir} && cp -vf arch/x86/boot/bzImage {destdir}/boot/vmlinuz-{pkgver}",
|
|
f"cd {builddir} && cp -vf System.map {destdir}/boot/System.map",
|
|
f"cd {builddir} && cat .config > {destdir}/boot/config-{pkgver}",
|
|
|
|
# Fix perms (??)
|
|
f"cd {builddir} && chmod 755 {destdir}{{,/usr,/usr/lib,/usr/lib/modules,/usr/lib/modules/{pkgver}}}",
|
|
|
|
f"install -v -d -m755 {destdir}/usr/share/licenses/{pkgname}/",
|
|
f"install -v -m644 {builddir}/COPYING {destdir}/usr/share/licenses/{pkgname}/LICENSE",
|
|
f"cp -rvp {builddir}/LICENSES/* {destdir}/usr/share/licenses/{pkgname}/",
|
|
|
|
# package kernel for nvidia build
|
|
f"cd {builddir} && tar -cJf /home/gabry/lfs-repo/kernel-source-prep-{pkgver}.tar.xz --transform 's|^\\./||' .", # license here is alr copied
|
|
|
|
# Make tarball + manifests
|
|
f"mkdir -p {outputdir} && cd {destdir} && tar --transform 's|^\\.||' -I zstd -cf {outputdir}/{pkgname}-{pkgver}.tar.zst .",
|
|
f"mkdir -p {manifestdir} && tar -tf {outputdir}/{pkgname}-{pkgver}.tar.zst | grep -v '/$' > {manifestdir}/{pkgname}.txt",
|
|
]
|
|
|
|
triggers = [
|
|
f"find /usr/lib/modules -mindepth 1 -maxdepth 1 -type d ! -name '{pkgver}' -exec rm -rf {{}} +",
|
|
f"find /boot -maxdepth 1 ! -name 'config-{pkgver}' -name 'config-*' -exec rm -rf {{}} +",
|
|
{"rebuild_package": ["nvidia"]},
|
|
f"dracut -f -v /boot/initramfs-{pkgver}.img {pkgver}",
|
|
f"find /boot -mindepth 1 -maxdepth 1 -type f ! -name 'initramfs-{pkgver}.img' -name 'initramfs-*.img' -exec rm -rf {{}} +",
|
|
f"grub-mkconfig -o /boot/grub/grub.cfg",
|
|
]
|