# 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.12 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=17c6883dfda0ee7f58cb11c7fa4063ccf0c00af7 _bmqversion=5.12-r1 _bmq_patch="prjc_v${_bmqversion}.patch" _gcc_more_v=20210610 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://git.archlinux.org/linux.git/patch/?id=5681b74293d983752bf033fbadd190e9a1265825" "0002-x86-setup-Consolidate-early-memory-reservations.patch::https://git.archlinux.org/linux.git/patch/?id=d95db8299235d164f12f11b0ea8acd60c7e13dcf" "0003-x86-setup-Merge-several-reservations-of-start-of-mem.patch::https://git.archlinux.org/linux.git/patch/?id=a3a4cc7df405aeff7d70a11ee4e90965809ed09e" "0004-x86-setup-Move-trim_snb_memory-later-in-setup_arch-t.patch::https://git.archlinux.org/linux.git/patch/?id=0ad14408305e590f26efe4437f925b40d283e67d" "0005-x86-setup-always-reserve-the-first-1M-of-RAM.patch::https://git.archlinux.org/linux.git/patch/?id=d95f872247541176d4edf5664198ed9edb12f134" "0006-x86-setup-remove-CONFIG_X86_RESERVE_LOW-and-reservel.patch::https://git.archlinux.org/linux.git/patch/?id=f42fcdafbd9c6232c086bd717fa29f1664ccaadb" "0007-x86-crash-remove-crash_reserve_low_1M.patch::https://git.archlinux.org/linux.git/patch/?id=74d8a788eff7fd6cfed8aa5901a6abf3d6b5be7f" "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=('f9aef3da2f65916cc30da9a066217d3379036e6a32a732224da7fee86c80810315484f48132b50b8cf8eb5e0b055ad1b7bbe63dadd0eb54b0b0626bc57c20963' 'SKIP' '9d38db65163a640071539e20a2ac4d8352e07cee26cfb997e6d0e9951bcbe2184c3be4f41a6a4073080e73b743dd86690a056cf6aa1aa607c967e37fa470a8cf' '77a1646ffbc67ed88af564b73cf63f0374772bdc1075e771a93ee4fe257b94cb3766a4842898b48f4343458d0b507229182220c7daeb5532df610b964c6640e7' '30d1df754608bb423cbc99c2097ad521baa091b9a3b39df4bd5c2d50c57eec54d8fa0e4a4a04b847c3d1b87ba682cadc8db45fabeefdc9ad7caaf8e77b96e41a' 'b98e3f25f462229b14d7127f2c12e7e1981ace66c21db82daa2e58e0915ee25fc714395975a2067bd0f80c62bc2edd3c7168697fa5f7ba77d572a9c859cae948' '3a1a77419b060c8da3cd1357f4d62675f61f271a328ac3c8e7d2d202b430e4aed8183431e23d159e01c0b35a10ffb0da8fedebe5e446d276614bb447e84caf15' '018651b7c5ba0010b134d032995ac6c2ed2b0262394a2d4811d6c0350c4cdf04aaeea0126dd5a79f79859988c320c0f22164a3f58e7f0a9e54981215f147b33a' 'b6ea62d9bbbc9852bc6869bdaada00077d77a9120e5884c3386a73ddd56a2d2443c666fba1febcf2f810b148d32a21b55f8701f5813da9374a958d9de4d6df31' '1f352876f4f6eddd9ec8991c3fea3c21f568f2818a7d0633893b64ca1d7cdb56644adf7fef2bbc6176e29920c2860a3c49c1e390905cbe4d2b2be4dda9c4693f' '18d680cc1cb4980822754ca7f679035fa06e9077c35ac2b41acd953ca48cdc3f96224336624033ae9a1adcd886773ca8fa06c2e083cc65885da4bb7c755bd950' '067a8587ff19b2fd29b24f3603348d71999a19e0551bc65f54521991cfcd4121bdd707b14438858639f4533e50323e0b0960f12e9980a1b086508c29a6a5fc2d' '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="$(