# Contributor: Piotr Gorski # Contributor: Jan Alexander Steffens (heftig) # Contributor: Tobias Powalowski # Contributor: Thomas Baechler # Maintainer: ptr1337 ### BUILD OPTIONS # Set these variables to ANYTHING that is not null to enable them # 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=y # Enable fsync _fsync=y #enable futex2 _futex2= #enable winesync _winesync= ### Set performance governor as default _per_gov=y ### Disable Deadline I/O scheduler _deadline_disable=y ### Disable Kyber I/O scheduler _kyber_disable=y ### Running with a 2000 HZ, 1000HZ or 500HZ tick rate _2k_HZ_ticks= _1k_HZ_ticks= _750_HZ_ticks=y _mm_protect=y _lrng_enable=y ## Apply Kernel automatic Optimization _use_optimization= ## Apply Kernel Optimization selecting _use_optimization_select=y ## compiling with LLVM/LTO _use_llvm_lto=y # Comfpile 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= ### Do not edit below this line unless you know what you're doing pkgbase=linux-cacule-rc # pkgname=('linux-cacule' linux-cacule-headers) _major=5.15 #_minor=1 #_minorc=$((_minor+1)) _rcver=rc5 pkgver=${_major}.${_rcver} #_stable=${_major}.${_minor} _stablerc=${_major}-${_rcver} _srcname=linux-${_stablerc} pkgrel=1 pkgdesc='Linux-CacULE Kernel-RC by Hamad Marri and with some other patchsets' arch=('x86_64' 'x86_64_v3') url="https://github.com/hamadmarri/cacule-cpu-scheduler" license=('GPL2') options=('!strip') makedepends=('kmod' 'bc' 'libelf' 'python-sphinx' 'python-sphinx_rtd_theme' 'graphviz' 'imagemagick' 'pahole' 'cpio' 'perl' 'tar' 'xz') _caculepatches="https://raw.githubusercontent.com/ptr1337/kernel-patches/master/CacULE" _patchsource="https://raw.githubusercontent.com/ptr1337/kernel-patches/master/5.15" source=("https://git.kernel.org/torvalds/t/linux-${_stablerc}.tar.gz" "config" # "${_patchsource}/arch-patches/0001-ZEN-Add-sysctl-and-CONFIG-to-disallow-unprivileged-C.patch" "${_caculepatches}/v5.15/cacule-5.15-full.patch" # "${_patchsource}/0001-CK-TIMER.patch" "${_patchsource}/misc/0007-v5.15-fsync.patch" "${_patchsource}/misc/0003-glitched-cfs.patch" "${_patchsource}/misc/more-uarches-for-kernel-5.15+.patch" # "${_patchsource}/misc/le9ec-5.15-rc2.patch" "${_patchsource}/misc/0002-clear-patches.patch" "${_patchsource}/misc/amd/0006-amd-cppc.patch" "${_patchsource}/misc/0002-init-Kconfig-enable-O3-for-all-arches.patch" "${_patchsource}/0001-mm.patch" "${_patchsource}/0001-misc.patch" "${_patchsource}/0001-lrng.patch" "${_patchsource}/zstd-dev-patches-v6/0001-zstd-dev-patches.patch" "${_patchsource}/0001-bbr2.patch" "auto-cpu-optimization.sh" ) if [ -n "$_use_llvm_lto" ]; then BUILD_FLAGS=( LLVM=1 LLVM_IAS=1 ) fi export KBUILD_BUILD_HOST=archlinux export KBUILD_BUILD_USER=$pkgbase export KBUILD_BUILD_TIMESTAMP="$(date -Ru${SOURCE_DATE_EPOCH:+d @$SOURCE_DATE_EPOCH})" prepare() { cd $_srcname ### Setting version echo "Setting version..." sed -e "/^EXTRAVERSION =/s/=.*/=/" -i Makefile scripts/setlocalversion --save-scmversion 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 = *.patch ]] || continue echo "Applying patch $src..." patch -Np1 < "../$src" done ### Setting config echo "Setting config..." cp ../config .config ### Microarchitecture Optimization (GCC/CLANG) if [ -n "$_use_optimization" ]; then "${srcdir}"/auto-cpu-optimization.sh fi if [ -n "$_use_optimization_select" ]; then source "${startdir}"/configure cpu_arch fi ### Enable Linux Random Number Generator if [ -n "$_lrng_enable" ]; then echo "Enabling Linux Random Number Generator ..." scripts/config --enable CONFIG_LRNG scripts/config --disable CONFIG_LRNG_OVERSAMPLE_ENTROPY_SOURCES scripts/config --set-val CONFIG_CONFIG_LRNG_OVERSAMPLE_ES_BITS 0 scripts/config --set-val CONFIG_LRNG_SEED_BUFFER_INIT_ADD_BITS 0 scripts/config --enable CONFIG_LRNG_CONTINUOUS_COMPRESSION_ENABLED scripts/config --disable CONFIG_LRNG_CONTINUOUS_COMPRESSION_DISABLED scripts/config --disable CONFIG_LRNG_SWITCHABLE_CONTINUOUS_COMPRESSION scripts/config --disable CONFIG_LRNG_COLLECTION_SIZE_32 scripts/config --disable CONFIG_LRNG_COLLECTION_SIZE_256 scripts/config --disable CONFIG_LRNG_COLLECTION_SIZE_512 scripts/config --enable CONFIG_LRNG_COLLECTION_SIZE_1024 scripts/config --disable CONFIG_LRNG_COLLECTION_SIZE_2048 scripts/config --disable CONFIG_LRNG_COLLECTION_SIZE_4096 scripts/config --disable CONFIG_LRNG_COLLECTION_SIZE_8192 scripts/config --set-val CONFIG_LRNG_COLLECTION_SIZE 1024 scripts/config --disable CONFIG_LRNG_HEALTH_TESTS scripts/config --set-val CONFIG_LRNG_RCT_CUTOFF 31 scripts/config --set-val CONFIG_LRNG_APT_CUTOFF 325 scripts/config --set-val CONFIG_LRNG_IRQ_ENTROPY_RATE 256 scripts/config --enable CONFIG_LRNG_JENT scripts/config --set-val CONFIG_LRNG_JENT_ENTROPY_RATE 16 scripts/config --set-val CONFIG_LRNG_CPU_ENTROPY_RATE 8 scripts/config --disable CONFIG_LRNG_DRNG_SWITCH scripts/config --disable CONFIG_LRNG_DRBG scripts/config --disable CONFIG_LRNG_TESTING_MENU scripts/config --disable CONFIG_LRNG_SELFTEST fi ### Enable protect file mappings under memory pressure if [ -n "$_mm_protect" ]; then echo "Enabling protect file mappings under memory pressure..." scripts/config --enable CONFIG_UNEVICTABLE_FILE scripts/config --set-val CONFIG_UNEVICTABLE_FILE_KBYTES_LOW 262144 scripts/config --set-val CONFIG_UNEVICTABLE_FILE_KBYTES_MIN 131072 scripts/config --enable CONFIG_UNEVICTABLE_ANON scripts/config --set-val CONFIG_UNEVICTABLE_ANON_KBYTES_LOW 65536 scripts/config --set-val CONFIG_UNEVICTABLE_ANON_KBYTES_MIN 32768 fi echo "Disabling TCP_CONG_CUBIC..." scripts/config --module CONFIG_TCP_CONG_CUBIC scripts/config --disable CONFIG_DEFAULT_CUBIC echo "Enabling TCP_CONG_BBR2..." scripts/config --enable CONFIG_TCP_CONG_BBR2 scripts/config --enable CONFIG_DEFAULT_BBR2 scripts/config --set-str CONFIG_DEFAULT_TCP_CONG bbr2 echo "Enable VHBA-Module" scripts/config --module CONFIG_VHBA ### Enabling ZSTD COMPRESSION ## echo "Set module compression to ZSTD" scripts/config --enable CONFIG_MODULE_COMPRESS scripts/config --disable CONFIG_MODULE_COMPRESS_XZ scripts/config --enable CONFIG_MODULE_COMPRESS_ZSTD scripts/config --set-val CONFIG_MODULE_COMPRESS_ZSTD_LEVEL 19 scripts/config --disable CONFIG_KERNEL_ZSTD_LEVEL_ULTRA echo "Enabling KBUILD_CFLAGS -O3..." scripts/config --disable CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE scripts/config --enable CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3 echo "Enable AMD PSTATE v3 driver" Cscripts/config --enable CONFIG_X86_AMD_PSTATE ### Optionally use running kernel's config # code originally by nous; http://aur.archlinux.org/packages.php?ID=40191 if [ -n "$_use_current" ]; then if [[ -s /proc/config.gz ]]; then echo "Extracting config from /proc/config.gz..." # modprobe configs zcat /proc/config.gz > ./.config else warning "Your kernel was not compiled with IKCONFIG_PROC!" warning "You cannot read the current config!" warning "Aborting!" exit fi fi ### Optionally load needed modules for the make localmodconfig # See https://aur.archlinux.org/packages/modprobed-db if [ -n "$_localmodcfg" ]; then if [ -e $HOME/.config/modprobed.db ]; then echo "Running Steven Rostedt's make localmodconfig now" make ${BUILD_FLAGS[*]} LSMOD=$HOME/.config/modprobed.db localmodconfig else echo "No modprobed.db data found" exit fi fi make ${BUILD_FLAGS[*]} olddefconfig make ${BUILD_FLAGS[*]} -s kernelrelease > version echo "Prepared $pkgbase version $(