# 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.13 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=08ebe7e1fe2d69b89649a637dc2b9149ea0f5e9d _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/6f0534d5db472b538519a4673a4bffb2d4e408ec.patch" "0002-x86-setup-Consolidate-early-memory-reservations.patch::https://github.com/archlinux/linux/commit/dbb89f5d53a36eef51c8f42a6469eed55da2d59f.patch" "0003-x86-setup-Merge-several-reservations-of-start-of-mem.patch::https://github.com/archlinux/linux/commit/c0831ea64723acc90e36730d8b30b9aa8fe35740.patch" "0004-x86-setup-Move-trim_snb_memory-later-in-setup_arch-t.patch::https://github.com/archlinux/linux/commit/51a21625df206d92c5aaad513f43e33c8d8297fa.patch" "0005-x86-setup-always-reserve-the-first-1M-of-RAM.patch::https://github.com/archlinux/linux/commit/1a9870292e089e9d6914c5d82427236448ce63ca.patch" "0006-x86-setup-remove-CONFIG_X86_RESERVE_LOW-and-reservel.patch::https://github.com/archlinux/linux/commit/e948c77fea857a5dfa647ad41cfa1e32ee5c20ac.patch" "0007-x86-crash-remove-crash_reserve_low_1M.patch::https://github.com/archlinux/linux/commit/6f078aa59a65b2940905a2eb98b15d5c072930e0.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=('3a959a1779a8c19f59346e4b5cb6f9af84fdca993b248b2ea7c9fac6cd4c1f73d7a268a0f287143bdd4924711cf54223669a4e706327a40776ad0b9683b505de' 'SKIP' '11db4b5f4a22a2cdc75a61dde407957d458f495f38f6d2b6c79fbabc6bccbae999a6e32d1ab4f2f03f028ca64fa0c76480260a262144581691f7faa3c0914964' '77a1646ffbc67ed88af564b73cf63f0374772bdc1075e771a93ee4fe257b94cb3766a4842898b48f4343458d0b507229182220c7daeb5532df610b964c6640e7' '8eed6c5ac182266a254ad111389f2236e6664341c56d8e4854e722d7323e526d2caa5e5119060fd3cbc119a0682a7ef47fb8a0000cf83acbdfe3a0d4a5446e5d' 'e34985eb5060a3ef61f8bb7d352394468519f621f756ed54b5af49762166979d1b38de9fe33e3a180019796dbd601420aafa6868c802cde9b70d6aab562a16ef' '36b8988b889bface305f6a60768d3ff67082c73de178d6061c8035de89cba5f620f7625fb0eb3274c57c2cc40ddc1af621fbfcb27f5b297a554eec0f9e861be5' '5ad4cd57d35cc87061e3299c49cc53fbbeb2ff63d693d6adad77cf0d8966613f2719be3502d90478460476c533a2f407a9330bb4d111052f161940389236eefb' '86e0ab7dea3a2e771ffa8286602be33a2255a39527b90b9617f1e89e210e2f2d952da96ed1c308c1c01568e19bf59ab20e15540ec4785e5914b2ed2c340a3591' 'ce8c2b81568c54ae9774c4a2fec21ce4dbb01d016fa5ca30b7633cb88e9aaf2b9e87f48a98db4fc29e3bea31292d1c1fe69758b8662ba407ad075027b78e98f5' '7d50881e844d991e38c285f002673880b9dc2a074042840efda9e4de44aab9e04c03ef8936c463c90b4e579265bff0f5d4b223bf429bfbb945dd5284e0a942c0' '6d77a481a765c2c07d16233a95e3486467d22aa7c28a061fccf733584ebd5184c1ea15cb39d5962eabd7f13236461f3e082234148c109a5ed0f6fa19e9861157' '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="$(