# Maintainer: Leonidas Spyropoulos # Credit to graysky for shamelessly copying PKGBUILD from linux-ck ### BUILD OPTIONS # Set the next two variables to ANYTHING that is not null to enable them # Tweak kernel options prior to a build via nconfig _makenconfig= # Only compile active modules to VASTLY reduce 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 a try: https://aur.archlinux.org/packages/modprobed-db # This PKGBUILD reads the database kept if it exists # # More at this wiki page ---> https://wiki.archlinux.org/index.php/Modprobed-db _localmodcfg= # Optionally select a sub architecture by number or leave blank which will # require user interaction during the build. Note that the generic (default) # option is 36. # # 1. AMD Opteron/Athlon64/Hammer/K8 (MK8) # 2. AMD Opteron/Athlon64/Hammer/K8 with SSE3 (MK8SSE3) (NEW) # 3. AMD 61xx/7x50/PhenomX3/X4/II/K10 (MK10) (NEW) # 4. AMD Barcelona (MBARCELONA) (NEW) # 5. AMD Bobcat (MBOBCAT) (NEW) # 6. AMD Jaguar (MJAGUAR) (NEW) # 7. AMD Bulldozer (MBULLDOZER) (NEW) # 8. AMD Piledriver (MPILEDRIVER) (NEW) # 9. AMD Steamroller (MSTEAMROLLER) (NEW) # 10. AMD Excavator (MEXCAVATOR) (NEW) # 11. AMD Zen (MZEN) (NEW) # 12. AMD Zen 2 (MZEN2) (NEW) # 13. AMD Zen 3 (MZEN3) (NEW) # 14. Intel P4 / older Netburst based Xeon (MPSC) # 15. Intel Core 2 (MCORE2) # 16. Intel Atom (MATOM) # 17. Intel Nehalem (MNEHALEM) (NEW) # 18. Intel Westmere (MWESTMERE) (NEW) # 19. Intel Silvermont (MSILVERMONT) (NEW) # 20. Intel Goldmont (MGOLDMONT) (NEW) # 21. Intel Goldmont Plus (MGOLDMONTPLUS) (NEW) # 22. Intel Sandy Bridge (MSANDYBRIDGE) (NEW) # 23. Intel Ivy Bridge (MIVYBRIDGE) (NEW) # 24. Intel Haswell (MHASWELL) (NEW) # 25. Intel Broadwell (MBROADWELL) (NEW) # 26. Intel Skylake (MSKYLAKE) (NEW) # 27. Intel Skylake X (MSKYLAKEX) (NEW) # 28. Intel Cannon Lake (MCANNONLAKE) (NEW) # 29. Intel Ice Lake (MICELAKE) (NEW) # 30. Intel Cascade Lake (MCASCADELAKE) (NEW) # 31. Intel Cooper Lake (MCOOPERLAKE) (NEW) # 32. Intel Tiger Lake (MTIGERLAKE) (NEW) # 33. Intel Sapphire Rapids (MSAPPHIRERAPIDS) (NEW) # 34. Intel Rocket Lake (MROCKETLAKE) (NEW) # 35. Intel Alder Lake (MALDERLAKE) (NEW) # 36. Generic-x86-64 (GENERIC_CPU) # 37. Generic-x86-64-v2 (GENERIC_CPU2) (NEW) # 38. Generic-x86-64-v3 (GENERIC_CPU3) (NEW) # 39. Generic-x86-64-v4 (GENERIC_CPU4) (NEW) # 40. Intel-Native optimizations autodetected by GCC (MNATIVE_INTEL) (NEW) # 41. AMD-Native optimizations autodetected by GCC (MNATIVE_AMD) (NEW) _subarch= ### IMPORTANT: Do no edit below this line unless you know what you're doing pkgbase=linux-gc pkgver=5.14.11 pkgrel=1 pkgdesc='Linux' url="https://cchalpha.blogspot.co.uk/" arch=(x86_64) license=(GPL2) makedepends=(bc kmod libelf pahole cpio xmlto python-sphinx python-sphinx_rtd_theme graphviz imagemagick git) options=('!strip') _srcname=linux-${pkgver} _arch_config_commit=15fe7090369ec9ac511443ac8092aba2e3046e3d _bmqversion=5.14-r3 _bmq_patch="prjc_v${_bmqversion}.patch" _gcc_more_v=20210914 source=( "https://www.kernel.org/pub/linux/kernel/v5.x/linux-$pkgver.tar".{xz,sign} "config::https://raw.githubusercontent.com/archlinux/svntogit-packages/${_arch_config_commit}/trunk/config" "${_bmq_patch}::https://gitlab.com/alfredchen/projectc/raw/master/${_bmqversion%-*}/${_bmq_patch}" "more-uarches-$_gcc_more_v.tar.gz::https://github.com/graysky2/kernel_compiler_patch/archive/$_gcc_more_v.tar.gz" "0001-ZEN-Add-sysctl-and-CONFIG-to-disallow-unprivileged-C.patch::https://github.com/archlinux/linux/commit/f76db6fc04fadf872a138740592b4e8ec9ba9149.patch" "0002-Bluetooth-btusb-check-conditions-before-enabling-USB.patch::https://github.com/archlinux/linux/commit/810821eb3b1894f2cfcc29cffd42d193b8fe54a6.patch" "0003-Bluetooth-btusb-Add-support-for-Foxconn-Mediatek-Chi.patch::https://github.com/archlinux/linux/commit/38c2ca84b97f9d6021c2607e214f99acd84dac2d.patch" "0004-ALSA-pcm-Check-mmap-capability-of-runtime-dma-buffer.patch::https://github.com/archlinux/linux/commit/ab60c2d0242fc428a436c25c1144f6acd9d6f419.patch" "0005-ALSA-pci-rme-Set-up-buffer-type-properly.patch::https://github.com/archlinux/linux/commit/7b0c23ec626e579ffa7ef239cac20dc7fa1797e9.patch" "0006-ALSA-pci-cs46xx-Fix-set-up-buffer-type-properly.patch::https://github.com/archlinux/linux/commit/b5ed7b38f5551c5dfca87ab29d679f3d6d327557.patch" ) validpgpkeys=( 'ABAF11C65A2970B130ABE3C479BE3E4300411886' # Linus Torvalds '647F28654894E3BD457199BE38DBBDC86092693E' # Greg Kroah-Hartman ) b2sums=('b84afc268eaace7029d13b0e37b5366d042e96f1437b95b08a995d7717d6b6ed118e929c2d0e0929ddcc4dba772768d686d1c3a29a7c9ed60b9534797b006efa' 'SKIP' 'e549ff2253b3819d38df7e71d0ff377dc6faf332745295c8a2cf40d45a57128e3a707c8f715b6c1c11531575e37c08eb8bd1eba092b39acc432ab94c973fea67' '27cd56595a131b7c9a45429d775ff3a0eea79f95674711acf0c0688716a0952150f335540457dc7aab05ac92c58e32e576ce3d392c7e0df51c93be28b17522b6' 'd1c083f96f645679c5214e05f906b47f17ac6a8b3dd2faeb219e3ceda3a008e3fe47c4a79b0345978cec5c5e28da9b20727970cf5c788d52c3782dc5b36aa211' '73d7a6daab0a9eeb95e944f7a26e9c4a9e0a6b0b019e401873ac272b7213a9b011165d1a0c45cf49aaa4e46e468220f5c3570db467407bb8661c823e0fc79299' '5b70deed51bb2255b87136529324b33fe2b06e84f9e52a84beb2ca07b42a3569335ef34a81643edd6476cd5a8a667c0a0adfb40f926e409627178520e00349cd' 'ab13eeb4b49ca55198e49a77f75d9e4dacf899b9649b7d9f0e7217c7579f2db40ec12024563943adfd608066805ed7321e49eea72a8cacae46c652c71c15b5c9' '0be34a0b342d80d3a34452b0f7f0aacf32b6b17215de1775488d1ca4efa94a00811ba61898c8c1e9cf4ef061e2d381346a005875dfde1d93f290933c1b845bef' 'f05d04b05d36e6c5756632903182362b2e6f84b53b5e7a2b7992eb89f87c55d14166acc0ff0c36a9aaaf9afb9406c2fb48f0acbc647075e9de216e77913ac2c0' '40782be9898fba40d85e75a5bdf55a03a935c51bdac3c562968a1e52a95ad5fe42d4710e660b9e02a6e7b8c19d30e8455886723fbac40573a905a2a55f02c41d') _kernelname=${pkgbase#linux} : ${_kernelname:=-gc} 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 echo "Setting version..." scripts/setlocalversion --save-scmversion echo "-$pkgrel" > localversion.10-pkgrel echo "$_kernelname" > localversion.20-pkgname local src for src in "${source[@]}"; do src="${src%%::*}" src="${src##*/}" [[ $src = 0*.patch ]] || continue echo "Applying patch $src..." patch -Np1 < "../$src" done echo "Setting config..." cp ../config .config # 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 scripts/config --disable CONFIG_DEBUG_INFO 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 # https://bbs.archlinux.org/viewtopic.php?pid=1824594#p1824594 scripts/config --enable CONFIG_PSI_DEFAULT_DISABLED # https://bbs.archlinux.org/viewtopic.php?pid=1863567#p1863567 scripts/config --disable CONFIG_LATENCYTOP scripts/config --disable CONFIG_SCHED_DEBUG # FS#66613 # https://bugzilla.kernel.org/show_bug.cgi?id=207173#c6 scripts/config --disable CONFIG_KVM_WERROR echo "Applying patch ${_bmq_patch}..." patch -Np1 -i "$srcdir/${_bmq_patch}" # non-interactively apply gc default options # this isn't redundant if we want a clean selection of subarch below make olddefconfig # https://github.com/graysky2/kernel_gcc_patch # make sure to apply after olddefconfig to allow the next section echo "Patching to enable GCC optimization for other uarchs..." patch -Np1 -i "$srcdir/kernel_compiler_patch-$_gcc_more_v/more-uarches-for-kernel-5.8-5.14.patch" if [ -n "$_subarch" ]; then # user wants a subarch so apply choice defined above interactively via 'yes' yes "$_subarch" | make oldconfig else # no subarch defined so allow user to pick one make oldconfig 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 make -s kernelrelease > version echo "Prepared ${pkgbase} version $( "${startdir}/config.last" # uncomment if you want to build with distcc ### sed -i '/HAVE_GCC_PLUGINS/d' arch/x86/Kconfig } build() { cd $_srcname make all } _package() { pkgdesc="The ${pkgbase/linux/Linux} kernel and modules with the Project C scheduler" depends=(coreutils kmod initramfs) optdepends=('crda: to set the correct wireless channels of your country' 'linux-firmware: firmware images needed for some devices') cd $_srcname local kernver="$(