# Maintainer: MischiefTomato # Contributor: Joan Figueras # Contributor: Torge Matthies # Contributor: Jan Alexander Steffens (heftig) # Contributor: Yoshi2889 # Contributor: Tobias Powalowski # Contributor: Thomas Baechler ## Set 98 (Intel native) or 99 (AMD native) if [ -z ${_microarchitecture+x} ]; then _microarchitecture=0 fi ## Disable NUMA since most users do not have multiple processors. Breaks CUDA/NvEnc. ## Archlinux and Xanmod enable it by default. ## Set variable "use_numa" to: n to disable (possibly increase performance) ## y to enable (stock default) if [ -z ${use_numa+x} ]; then use_numa=y fi ## For performance you can disable FUNCTION_TRACER/GRAPH_TRACER. Limits debugging and analyzing of the kernel. ## Stock Archlinux and Xanmod have this enabled. ## Set variable "use_tracers" to: n to disable (possibly increase performance) ## y to enable (stock default) if [ -z ${use_tracers+x} ]; then use_tracers=y fi ## Choose between GCC and CLANG config (default is GCC) if [ -z ${_compiler+x} ]; then _compiler=gcc fi # Compress modules with ZSTD (to save disk space) if [ -z ${_compress_modules+x} ]; then _compress_modules=y fi pkgbase=linux-mt _major=5.15 _minor=7 pkgver=${_major}.${_minor} _branch=5.x pkgrel=2 pkgdesc='Linux kernel with personal customizations.' url="https://kernel.org/" arch=(x86_64) license=(GPL2) makedepends=( bc kmod libelf pahole cpio perl tar xz xmlto python-sphinx python-sphinx_rtd_theme graphviz imagemagick git ) options=('!strip') _srcname="linux-${pkgver}-cpu-optimized${pkgrel}" source=( "https://cdn.kernel.org/pub/linux/kernel/v${_branch}/linux-${_major}.${_minor}.tar."{xz,sign} "https://raw.githubusercontent.com/graysky2/kernel_compiler_patch/master/more-uarches-for-kernel-5.15+.patch" choose-gcc-optimization.sh "https://raw.githubusercontent.com/archlinux/svntogit-packages/master/linux/trunk/config" # Config file to edit linux-mt-prepare.sh ) validpgpkeys=( 'ABAF11C65A2970B130ABE3C479BE3E4300411886' # Linus Torvalds '647F28654894E3BD457199BE38DBBDC86092693E' # Greg Kroah-Hartman 'A2FF3A36AAA56654109064AB19802F8B0D70FC30' # Jan Alexander Steffens (heftig) 'C7E7849466FE2358343588377258734B41C31549' # David Runge ) # Archlinux patches #_commit="ec9e9a4219fe221dec93fa16fddbe44a34933d8d" #_patches=() #for _patch in ${_patches[@]}; do #source+=("${_patch}::https://git.archlinux.org/svntogit/packages.git/plain/trunk/${_patch}?h=packages/linux&id=${_commit}") #source+=("${_patch}::https://raw.gigthubusercontent.com/archlinux/svntogit-packages/${_commit}/trunk/${_patch}") #done sha256sums=('5d9050a839edc7480c5c8f7a284cd28bee6db07bec9e41c684f399192bbe5db1' 'SKIP' '380bcf40cc8396e97bd1d7f2577ab2ace51885858d3f155b1fb2dd5469efd00d' 'f0559045319db718af902f0f9f1ba183b63d89190a4d2dceb0d39d6a814156f7' '324a9d46c2338806a0c3ce0880c8d5e85c2ef30d342af3dc96f87b54fae7a586' '670d69688c0d745db13fd2116038d4644a41830511415399b7f2296c86099b9c') export KBUILD_BUILD_HOST=${KBUILD_BUILD_HOST:-archlinux} export KBUILD_BUILD_USER=${KBUILD_BUILD_USER:-makepkg} export KBUILD_BUILD_TIMESTAMP=${KBUILD_BUILD_TIMESTAMP:-$(date -Ru${SOURCE_DATE_EPOCH:+d @$SOURCE_DATE_EPOCH})} prepare() { cd linux-${_major}.${_minor} echo "Setting version..." scripts/setlocalversion --save-scmversion echo "-$pkgrel" > localversion.10-pkgrel echo "${pkgbase#linux}" > localversion.20-pkgname # Patching local src for src in "${source[@]}"; do src="${src%%::*}" src="${src##*/}" [[ $src = *.patch ]] || continue echo "Applying patch $src..." patch -Np1 < "../$src" done echo "Setting config..." cp ../config .config cp ../linux-mt-prepare.sh linux-mt-prepare.sh ./linux-mt-prepare.sh make olddefconfig diff -u ../config .config || : # Set the timer to 1000. scripts/config --enable CONFIG_HZ_1000 # CONFIG_STACK_VALIDATION gives better stack traces. Also is enabled in all official kernel packages by Archlinux team scripts/config --enable CONFIG_STACK_VALIDATION # Enable IKCONFIG following Arch's philosophy scripts/config --enable CONFIG_IKCONFIG \ --enable CONFIG_IKCONFIG_PROC # User set. See at the top of this file if [ "$use_tracers" = "n" ]; then msg2 "Disabling FUNCTION_TRACER/GRAPH_TRACER only if we are not compiling with clang..." if [ "${_compiler}" = "gcc" ]; then scripts/config --disable CONFIG_FUNCTION_TRACER \ --disable CONFIG_STACK_TRACER fi fi if [ "$use_numa" = "n" ]; then msg2 "Disabling NUMA..." scripts/config --disable CONFIG_NUMA fi # Compress modules by default (following Arch's kernel) if [ "$_compress_modules" = "y" ]; then scripts/config --enable CONFIG_MODULE_COMPRESS_ZSTD fi # Let's user choose microarchitecture optimization in GCC sh ${srcdir}/choose-gcc-optimization.sh $_microarchitecture make -s kernelrelease > version echo "Prepared $pkgbase version $(