# 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.12.15 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=aa159a607fdfdc3cbf90ccd05ecc43d4bff96729 _bmqversion=5.12-r1 _bmq_patch="prjc_v${_bmqversion}.patch" _gcc_more_v=20210616 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/cea01833528ae4d26c26ba6d0474c90612b644af.patch" "0002-x86-setup-Consolidate-early-memory-reservations.patch::https://github.com/archlinux/linux/commit/8bd9e7d22ae0676f6dd2af4ea385111c052e745e.patch" "0003-x86-setup-Merge-several-reservations-of-start-of-mem.patch::https://github.com/archlinux/linux/commit/c1f1e2a2781a0c0ead90df1e873ba7f6aaad35ed.patch" "0004-x86-setup-Move-trim_snb_memory-later-in-setup_arch-t.patch::https://github.com/archlinux/linux/commit/743e1a2b9b6e79fb237ac84e20dc4411217deb24.patch" "0005-x86-setup-always-reserve-the-first-1M-of-RAM.patch::https://github.com/archlinux/linux/commit/f2c34dfc0b3903b5ebed62a7a8ec7c27c7c203d0.patch" "0006-x86-setup-remove-CONFIG_X86_RESERVE_LOW-and-reservel.patch::https://github.com/archlinux/linux/commit/24e66ca483c2908d24c82fd760f6ca9243fd9020.patch" "0007-x86-crash-remove-crash_reserve_low_1M.patch::https://github.com/archlinux/linux/commit/c0f0017776e7daff716b135824fb4ddb4cf14507.patch" "prjc-fix-compilation-error.patch::https://gitlab.com/alfredchen/linux-prjc/uploads/b1121adfd2d2a2c610a1a8d611947d8c/0001-prjc-fix-compilation-error.patch" ) validpgpkeys=( 'ABAF11C65A2970B130ABE3C479BE3E4300411886' # Linus Torvalds '647F28654894E3BD457199BE38DBBDC86092693E' # Greg Kroah-Hartman ) b2sums=('2d94859080bba686786b690733d6df4a17f6183c690854545b87d784d16fbc5050fc07be08b2360cc1d0a6fe11bd8f18add68c893d92bb52e10bb0f61ff4eb76' 'SKIP' 'e7b85b8015414c2405c35f811cc3d201e10fb717e94f4c54c921d4a51dafcd61a2ac61695cf4ad5f51a2dcf5fda0558d99a896ec6478f47e7577c7207a4f7a94' '77a1646ffbc67ed88af564b73cf63f0374772bdc1075e771a93ee4fe257b94cb3766a4842898b48f4343458d0b507229182220c7daeb5532df610b964c6640e7' '8eed6c5ac182266a254ad111389f2236e6664341c56d8e4854e722d7323e526d2caa5e5119060fd3cbc119a0682a7ef47fb8a0000cf83acbdfe3a0d4a5446e5d' '767ee2dc194b8dcf6fbfd90524f60a2847646549de864a89772d6cc49d9717bebb580082ea3c9f5bcd36e1b367b9434c97da6bf05872362cc2ceeb630bab6438' 'd5ca4a6c4c2e286b75907786c1b4e55f5781218ba4997aa118e99cbfe96e0d9cd9683d804811f85f9af0a83844f68e19909aed0643924406a62e573e4214c322' 'ada58e3c4ea1e251e479faba82389fec609de63f58d756b3848d158a033fcbfc8e33f5055cb47e6c57549976ed8acff11a813a68c1d8a3bacc42b215590f92ef' 'cfc0875c74b592c149f5f7f8fe8c349256c70b4c0d512b450e4dfdb84e1a59c1489ea207fe7a09b51134a73f959a85cce49d6a71f1acaa2137c8fd80399c33e7' '744a45124002cc3e820affbc294509525e4fee617bc514d58d066da6daf93d943a4acaecdfdd3640ddda03fee0fe6cf03d5c1edcbc4380171a173ba28646162b' '1b22ea47250d0d6961cf5b264a82ade77e4eddd39c9b3cd15c657341df60aed99c6c4cdf5cf0215698bfc3cc89df202da9917cf1102e7535b8a831785741736e' '9c9349f515312047f3aa26385d074b0585439a008c19d75fc17a9344e550cb5a07a136bfedcac39b09f048c070f9bec3486468d0766923cf391bb58c9ab20df4' '8bfdf114f40a4d4851c511003d0454b450ad1cffc59f360bef53b7cff9272a743e59da42e8ca067e2f48c1abd89dd4e03dcb681f9fb7a3180eff260cfed713ee') _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}" patch -Np1 -i "$srcdir/prjc-fix-compilation-error.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+.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="$(