# Maintainer: Piotr Gorski # Contributor: Jan Alexander Steffens (heftig) # Contributor: Tobias Powalowski # Contributor: Thomas Baechler # Contributor: Timofey Titovets ### BUILD OPTIONS # Set these variables to ANYTHING that is not null to enable them ### Tweak kernel options prior to a build via nconfig _makenconfig= ### Tweak kernel options prior to a build via menuconfig _makemenuconfig= ### Tweak kernel options prior to a build via xconfig _makexconfig= ### Tweak kernel options prior to a build via gconfig _makegconfig= # NUMA is optimized for multi-socket motherboards. # A single multi-core CPU actually runs slower with NUMA enabled. # See, https://bugs.archlinux.org/task/31187 _NUMAdisable= # Compile ONLY used modules to VASTLYreduce the number of modules built # and the build time. # # To keep track of which modules are needed for your specific system/hardware, # give module_db script a try: https://aur.archlinux.org/packages/modprobed-db # This PKGBUILD read the database kept if it exists # # More at this wiki page ---> https://wiki.archlinux.org/index.php/Modprobed-db _localmodcfg= # Use the current kernel's .config file # Enabling this option will use the .config of the RUNNING kernel rather than # the ARCH defaults. Useful when the package gets updated and you already went # through the trouble of customizing your config options. NOT recommended when # a new kernel is released, but again, convenient for package bumps. _use_current= ### Running with a 1000 HZ tick rate _1k_HZ_ticks= ### Do not edit below this line unless you know what you're doing pkgbase=linux-next-git pkgver=20240417.r0.g4eab35893071 _srcname=linux-next pkgrel=1 pkgdesc='Linux NEXT' arch=('x86_64') url="http://www.kernel.org/" license=(GPL-2.0-only) options=( !debug !strip ) makedepends=('bc' 'libelf' 'git' 'pahole' 'cpio' 'perl' 'tar' 'xz' 'python') _lucjanver=next #_lucjanpath="https://raw.githubusercontent.com/sirlucjan/kernel-patches/master/${_lucjanver}" _lucjanpath="https://gitlab.com/sirlucjan/kernel-patches/raw/master/${_lucjanver}" source=("git+https://git.kernel.org/pub/scm/linux/kernel/git/next/${_srcname}.git" "${_lucjanpath}/arch-patches-sep/0001-ZEN-Add-sysctl-and-CONFIG-to-disallow-unprivileged-C.patch" "${_lucjanpath}/arch-patches-sep/0002-arch-Kconfig-Default-to-maximum-amount-of-ASLR-bits.patch" # the main kernel config files 'config') export KBUILD_BUILD_HOST=archlinux export KBUILD_BUILD_USER=$pkgbase export KBUILD_BUILD_TIMESTAMP="$(date -Ru${SOURCE_DATE_EPOCH:+d @$SOURCE_DATE_EPOCH})" pkgver() { cd $_srcname git describe --long --tags | sed 's/next.//;s/\([^-]*-g\)/r\1/;s/-/./g' } prepare() { cd $_srcname ### Setting version echo "Setting version..." echo "-$pkgrel" > localversion.10-pkgrel echo "${pkgbase#linux}" > localversion.20-pkgname ### Patching sources local src for src in "${source[@]}"; do src="${src%%::*}" src="${src##*/}" src="${src%.zst}" [[ $src = *.patch ]] || continue echo "Applying patch $src..." patch -Np1 < "../$src" done ### Setting config echo "Setting config..." cp ../config .config make olddefconfig diff -u ../config .config || : ### Prepared version make -s kernelrelease > version echo "Prepared $pkgbase version $( ./.config else warning "Your kernel was not compiled with IKCONFIG_PROC!" warning "You cannot read the current config!" warning "Aborting!" exit fi fi ### Optionally set tickrate to 1000 if [ -n "$_1k_HZ_ticks" ]; then echo "Setting tick rate to 1k..." scripts/config -d HZ_300 \ -e HZ_1000 \ --set-val HZ 1000 fi ### Disable NUMA if [ -n "$_NUMAdisable" ]; then echo "Disabling NUMA from kernel config..." scripts/config -d NUMA \ -d AMD_NUMA \ -d X86_64_ACPI_NUMA \ -d NODES_SPAN_OTHER_NODES \ -d NUMA_EMU \ -d USE_PERCPU_NUMA_NODE_ID \ -d ACPI_NUMA \ -d ARCH_SUPPORTS_NUMA_BALANCING \ -d NODES_SHIFT \ -u NODES_SHIFT \ -d NEED_MULTIPLE_NODES \ -d NUMA_BALANCING \ -d NUMA_BALANCING_DEFAULT_ENABLED fi ### Optionally load needed modules for the make localmodconfig # See https://aur.archlinux.org/packages/modprobed-db if [ -n "$_localmodcfg" ]; then if [ -f $HOME/.config/modprobed.db ]; then echo "Running Steven Rostedt's make localmodconfig now" make LSMOD=$HOME/.config/modprobed.db localmodconfig else echo "No modprobed.db data found" exit fi fi ### Running make nconfig [[ -z "$_makenconfig" ]] || make nconfig ### Running make menuconfig [[ -z "$_makemenuconfig" ]] || make menuconfig ### Running make xconfig [[ -z "$_makexconfig" ]] || make xconfig ### Running make gconfig [[ -z "$_makegconfig" ]] || make gconfig ### Save configuration for later reuse cat .config > "${startdir}/config.last" } build() { cd $_srcname make all make -C tools/bpf/bpftool vmlinux.h feature-clang-bpf-co-re=1 } _package() { pkgdesc="The $pkgdesc kernel and modules" depends=('coreutils' 'kmod' 'initramfs') optdepends=('wireless-regdb: to set the correct wireless channels of your country' 'linux-firmware: firmware images needed for some devices' 'modprobed-db: Keeps track of EVERY kernel module that has ever been probed - useful for those of us who make localmodconfig') provides=(VIRTUALBOX-GUEST-MODULES WIREGUARD-MODULE KSMBD-MODULE) cd $_srcname local modulesdir="$pkgdir/usr/lib/modules/$(