#_ _ _ _____ #| |__ | | __ _ ___| | ___ __ ___ ___ ___ _ __ |___ / #| '_ \| |/ _` |/ __| |/ / '_ ` _ \ / _ \ / _ \| '_ \ |_ \ #| |_) | | (_| | (__| <| | | | | | (_) | (_) | | | |___) | #|_.__/|_|\__,_|\___|_|\_\_| |_| |_|\___/ \___/|_| |_|____/ #Maintainer: blackmoon3 #Credits: Jan Alexander Steffens (heftig) #Credits: Andreas Radke #Credits: Kyle De'Vir (QuartzDragon) ################################# Arch ################################ ARCH=x86 ################################# Grep GCC version ################################ _gccversion=$(gcc -dumpversion) ################################# CC/CXX/HOSTCC/HOSTCXX ################################ #Set compiler to build the kernel #Set '1' to build with GCC #Set '2' to build with CLANG and LLVM #Default is empty. It will build with GCC. To build with different compiler just use : env _compiler=(1 or 2) makepkg -s if [ -z ${_compiler+x} ]; then _compiler= fi if [[ "$_compiler" = "1" ]]; then _compiler=1 BUILD_FLAGS=(CC=gcc CXX=g++ HOSTCC=gcc HOSTCXX=g++) elif [[ "$_compiler" = "2" ]]; then _compiler=2 BUILD_FLAGS=(CC=clang CXX=clang++ HOSTCC=clang HOSTCXX=clang++ LD=ld.lld LLVM=1 LLVM_IAS=1) else _compiler=1 BUILD_FLAGS=(CC=gcc CXX=g++ HOSTCC=gcc HOSTCXX=g++) fi ################################################################################### pkgbase=linux-pds pkgver=6.4.0 _pkgver=6.4 pkgrel=1 major=6.4 commit=1b45fa8cd58990bf455b429c598b6d4bad155172 arch=(x86_64) url='https://www.kernel.org/' license=(GPL2) makedepends=(bc cpio gettext git libelf pahole perl tar xz kmod xmlto) makepends+=(graphviz imagemagick python-sphinx texlive-latexextra) # htmldocs makedepends+=(bison flex zstd make patch gcc gcc-libs glibc binutils) if [[ "$_compiler" = "2" ]]; then makedepends+=(clang llvm llvm-libs lld python) fi options=(!strip) archlinuxpath=https://gitlab.archlinux.org/archlinux/packaging/packages/linux/-/raw/$commit patchpath=https://raw.githubusercontent.com/blacksky3/patches/main/$major source=(https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-$_pkgver.tar.xz ${archlinuxpath}/config # PRJC patch ${patchpath}/alfred/prjc_v6.4-r0.patch # Arch patches ${patchpath}/arch/v6.4-arch1/0001-ZEN-Add-sysctl-and-CONFIG-to-disallow-unprivileged-C.patch # Other patches # Sirlucjan ${patchpath}/sirlucjan/0001-bfq-cachyos-patches-v1.patch ${patchpath}/sirlucjan/0001-block-set-rq_affinity-to-force-full-multithreading-I-v1.patch ${patchpath}/sirlucjan/0001-btrfs-6.4-merge-changes-from-dev-tree-v1.patch ${patchpath}/sirlucjan/0001-drm-6.4-Add-HDR-patches-v1.patch ${patchpath}/sirlucjan/0001-hid-6.4-merge-changes-from-dev-tree-v1.patch ${patchpath}/sirlucjan/0001-x86-Avoid-relocation-information-in-final-vmlinux-v1.patch ${patchpath}/sirlucjan/0001-zstd-6.4-import-v1.5.5-v1.patch ${patchpath}/sirlucjan/0001-zstd-modules-cachyos-patches-v1.patch # TKG ${patchpath}/tkg/0001-mm-Support-soft-dirty-flag-reset-for-VA-range.patch ${patchpath}/tkg/0002-mm-Support-soft-dirty-flag-read-with-reset.patch ${patchpath}/tkg/0013-optimize_harder_O3.patch # Xanmod ${patchpath}/xanmod/0001-PCI-Enable-overrides-for-missing-ACS-capabilities.patch ${patchpath}/xanmod/0001-futex-Add-entry-point-for-FUTEX_WAIT_MULTIPLE-opcode.patch ${patchpath}/xanmod/0001-winesync-Introduce-the-winesync-driver-and-character.patch ${patchpath}/xanmod/0001-x86-kconfig-more-uarches-for-kernel-5.17-xm_rev2.patch ${patchpath}/xanmod/0001-XANMOD-x86-build-Add-more-x86_64-optimizations.patch ${patchpath}/xanmod/0002-XANMOD-Makefile-Move-ARM-and-x86-instruction-set-sel.patch\ ${patchpath}/xanmod/0002-XANMOD-fair-Remove-all-energy-efficiency-functions.patch ${patchpath}/xanmod/0003-XANMOD-fair-Increase-wake-up-granularity-time-to-3ms.patch ${patchpath}/xanmod/0011-XANMOD-dcache-cache_pressure-50-decreases-the-rate-a.patch ${patchpath}/xanmod/0012-XANMOD-mm-vmscan-vm_swappiness-30-decreases-the-amou.patch ${patchpath}/xanmod/0016-XANMOD-Makefile-Disable-GCC-vectorization-on-trees.patch # Xanmod Intel ${patchpath}/xanmod/intel/0001-sched-fair-Record-the-average-duration-of-a-task.patch ${patchpath}/xanmod/intel/0002-sched-fair-Introduce-SIS_CURRENT-to-wake-up-short-ta.patch ${patchpath}/xanmod/intel/0003-x86-vdso-Use-lfence-instead-of-rep-and-nop.patch ${patchpath}/xanmod/intel/0004-sched-wait-Do-accept-in-LIFO-order-for-cache-efficie.patch ${patchpath}/xanmod/intel/0005-intel_rapl-Silence-rapl-trace-debug.patch ${patchpath}/xanmod/intel/0006-firmware-Enable-stateless-firmware-loading.patch ${patchpath}/xanmod/intel/0007-locking-rwsem-spin-faster.patch ${patchpath}/xanmod/intel/0008-drivers-initialize-ata-before-graphics.patch ${patchpath}/xanmod/intel/0009-init-wait-for-partition-and-retry-scan.patch) 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 ${srcdir}/linux-$_pkgver local src for src in "${source[@]}"; do src="${src%%::*}" src="${src##*/}" [[ $src = *.patch ]] || continue msg2 "Applying patch $src..." patch -Np1 < "../$src" done plain "" # Copy the config file first # Copy "${srcdir}"/config to "${srcdir}"/linux-${_pkgver}/.config msg2 "Copy "${srcdir}"/config to "${srcdir}"/linux-$_pkgver/.config" cp "${srcdir}"/config .config sleep 2s plain "" # Remove gcc-plugin if gcc version = 13.0.0 if [[ "$_gccversion" = "13.0.0" ]]; then msg2 "Remove GCC_PLUGINS" scripts/config --disable CONFIG_HAVE_GCC_PLUGINS scripts/config --disable CONFIG_GCC_PLUGINS sleep 2s plain "" fi # Set LTO with CLANG/LLVM if [[ "$_compiler" = "2" ]]; then msg2 "Enable THIN LTO" scripts/config --enable CONFIG_LTO scripts/config --enable CONFIG_LTO_CLANG scripts/config --enable CONFIG_ARCH_SUPPORTS_LTO_CLANG scripts/config --enable CONFIG_ARCH_SUPPORTS_LTO_CLANG_THIN scripts/config --disable CONFIG_LTO_NONE scripts/config --enable CONFIG_HAS_LTO_CLANG scripts/config --disable CONFIG_LTO_CLANG_FULL scripts/config --enable CONFIG_LTO_CLANG_THIN scripts/config --enable CONFIG_HAVE_GCC_PLUGINS #msg2 "Enable FULL LTO" #scripts/config --enable CONFIG_LTO #scripts/config --enable CONFIG_LTO_CLANG #scripts/config --enable CONFIG_ARCH_SUPPORTS_LTO_CLANG #scripts/config --enable CONFIG_ARCH_SUPPORTS_LTO_CLANG_THIN #scripts/config --disable CONFIG_LTO_NONE #scripts/config --enable CONFIG_HAS_LTO_CLANG #scripts/config --enable CONFIG_LTO_CLANG_FULL #scripts/config --disable CONFIG_LTO_CLANG_THIN #scripts/config --enable CONFIG_HAVE_GCC_PLUGINS #msg2 "Disable LTO" #scripts/config --enable CONFIG_LTO_NONE sleep 2s plain "" fi msg "Apply some Archlinux config" msg2 "Compress modules by default (following Arch's kernel)" scripts/config --enable CONFIG_MODULE_COMPRESS_ZSTD sleep 2s msg2 "CONFIG_STACK_VALIDATION gives better stack traces. Also is enabled in all official kernel packages by Archlinux team" scripts/config --enable CONFIG_STACK_VALIDATION sleep 2s msg2 "Enable IKCONFIG following Arch's philosophy" scripts/config --enable CONFIG_IKCONFIG scripts/config --enable CONFIG_IKCONFIG_PROC sleep 2s msg2 "Enable FUNCTION_TRACER/GRAPH_TRACER" scripts/config --enable CONFIG_FUNCTION_TRACER scripts/config --enable CONFIG_STACK_TRACER sleep 2s msg2 "Enable CONFIG_USER_NS_UNPRIVILEGED" scripts/config --enable CONFIG_USER_NS sleep 2s msg "Apply config from Cachyos" # 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 msg2 "Disable NUMA" scripts/config --disable CONFIG_NUMA scripts/config --disable CONFIG_AMD_NUMA scripts/config --disable CONFIG_X86_64_ACPI_NUMA scripts/config --disable CONFIG_NODES_SPAN_OTHER_NODES scripts/config --disable CONFIG_NUMA_EMU scripts/config --disable CONFIG_USE_PERCPU_NUMA_NODE_ID scripts/config --disable CONFIG_ACPI_NUMA scripts/config --disable CONFIG_ARCH_SUPPORTS_NUMA_BALANCING scripts/config --disable CONFIG_NODES_SHIFT scripts/config --disable CONFIG_NODES_SHIFT scripts/config --disable CONFIG_NEED_MULTIPLE_NODES scripts/config --disable CONFIG_NUMA_BALANCING scripts/config --disable CONFIG_NUMA_BALANCING_DEFAULT_ENABLED sleep 2s # Disable debug to lower the size of the kernel msg2 "Disable debug to lower the size of the kernel" scripts/config --disable CONFIG_DEBUG_INFO scripts/config --disable CONFIG_DEBUG_INFO_BTF scripts/config --disable CONFIG_DEBUG_INFO_DWARF4 scripts/config --disable CONFIG_DEBUG_INFO_DWARF5 scripts/config --disable CONFIG_PAHOLE_HAS_SPLIT_BTF scripts/config --disable CONFIG_DEBUG_INFO_BTF_MODULES scripts/config --disable CONFIG_SLUB_DEBUG scripts/config --disable CONFIG_PM_DEBUG scripts/config --disable CONFIG_PM_ADVANCED_DEBUG scripts/config --disable CONFIG_PM_SLEEP_DEBUG scripts/config --disable CONFIG_ACPI_DEBUG scripts/config --disable CONFIG_SCHED_DEBUG scripts/config --disable CONFIG_LATENCYTOP scripts/config --disable CONFIG_DEBUG_PREEMPT sleep 2s msg "Apply config from linux-prjc (AUR)" # Disable CONFIG_DEBUG_INFO=y at build time otherwise memory usage blows up # And can easily overwhelm a system with 32 GB of memory using a tmpfs build # partition ... this was introduced by FS#66260, see: # https://git.archlinux.org/svntogit/packages.git/commit/trunk?h=packages/linux&id=663b08666b269eeeeaafbafaee07fd03389ac8d7 msg2 "Disable debug to lower the size of the kernel" scripts/config --disable CONFIG_CGROUP_BPF scripts/config --disable CONFIG_BPF_LSM scripts/config --disable CONFIG_BPF_PRELOAD scripts/config --disable CONFIG_BPF_LIRC_MODE2 scripts/config --disable CONFIG_BPF_KPROBE_OVERRIDE sleep 2s # https://gitlab.com/alfredchen/linux-prjc/-/issues/81 # Disable mellanox module msg2 "Disable mellanox module" scripts/config --disable CONFIG_MLX5_CORE sleep 2s msg "Patch addition config" msg2 "Enable CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE (O3) (0013-optimize_harder_O3.patch) (Replace O2 by O3)" scripts/config --disable CONFIG_CC_OPTIMIZE_FOR_SIZE scripts/config --enable CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE sleep 2s msg2 "Enable Winesync" scripts/config --enable CONFIG_WINESYNC sleep 2s msg2 "Set ZSTD modules and kernel compression level" scripts/config --enable CONFIG_KERNEL_ZSTD scripts/config --set-val CONFIG_ZSTD_COMP_VAL 19 scripts/config --set-val CONFIG_MODULE_COMPRESS_ZSTD_LVL 19 scripts/config --enable CONFIG_MODULE_COMPRESS_ZSTD_ULTRA scripts/config --set-val CONFIG_MODULE_COMPRESS_ZSTD_LEVEL_ULTRA 22 sleep 2s msg2 "Enable CONFIG_SCHED_ALT, this feature enable alternative CPU scheduler" scripts/config --enable CONFIG_SCHED_ALT sleep 2s msg2 "Enable PDS CPU scheduler" scripts/config --disable CONFIG_SCHED_BMQ scripts/config --enable CONFIG_SCHED_PDS sleep 2s plain "" msg "Supress depmod" sed -i '2iexit 0' scripts/depmod.sh sleep 2s plain "" # Setting localversion msg "Setting localversion..." # --save-scmversion as been removed in upstream # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/scripts/setlocalversion?h=v6.3-rc1&id=f6e09b07cc12a4d104bb19fe7566b0636f60c413 # scripts/setlocalversion --save-scmversion echo "-${pkgbase}" > localversion plain "" # Config if [[ "$_compiler" = "1" ]]; then make ARCH=${ARCH} ${BUILD_FLAGS[*]} olddefconfig elif [[ "$_compiler" = "2" ]]; then make ARCH=${ARCH} ${BUILD_FLAGS[*]} olddefconfig fi plain "" make -s kernelrelease > version msg "Prepared $pkgbase version $(