# Maintainer: MischievousTomat # 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-cpu-optimized _major=5.14 _minor=14 pkgver=${_major}.${_minor} _branch=5.x pkgrel=1 pkgdesc='Linux with cpu optimizations' 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} config # the main kernel config file "https://raw.githubusercontent.com/graysky2/kernel_compiler_patch/master/more-uarches-for-kernel-5.8-5.14.patch" choose-gcc-optimization.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=('4dff4e96d4052195002538027f8a810411ba6116a41bff5575952702d509d06a' 'SKIP' 'be98ee1a3b9b4eaa547ca6d54692513d3073cdb776785c8608eb05afc259ac6d' '2f99d9e37f372925e054115bfead4723a328ffbdb7bf958753aab2ac48dc5673' '1ac18cad2578df4a70f9346f7c6fccbb62f042a0ee0594817fdef9f2704904ee') 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 make olddefconfig diff -u ../config .config || : # 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 $(