## Look inside 'choose-gcc-optimization.sh' to choose your microarchitecture ## Valid numbers between: 0 to 99 ## Default is: 0 => generic ## Good option if your package is for one machine: 98 (Intel native) or 99 (AMD native) _microarchitecture=0 ## Major kernel version _major=6.8 ## Minor kernel version _minor=9 ## PKGBUILD ## pkgbase=linux-multimedia #pkgver=${_major} pkgver=${_major}.${_minor} pkgrel=1 pkgdesc='Linux Multimedia Optimized' url="https://www.kernel.org/" arch=(x86_64) license=(GPL2) makedepends=('bc' 'cpio' 'gettext' 'libelf' 'pahole' 'perl' 'python' 'tar' 'xz' 'git') options=('!strip') _srcname=linux-${pkgver} source=( https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-${pkgver}.tar.{xz,sign} "git+https://github.com/graysky2/kernel_compiler_patch.git" "git+https://github.com/Frogging-Family/linux-tkg.git" "choose-gcc-optimization.sh" ) validpgpkeys=( 'ABAF11C65A2970B130ABE3C479BE3E4300411886' # Linus Torvalds '647F28654894E3BD457199BE38DBBDC86092693E' # Greg Kroah-Hartman '83BC8889351B5DEBBB68416EB8AC08600F108CDF' # Jan Alexander Steffens (heftig) ) sha256sums=('f905f1238ea7a8e85314bacf283302e8097006010d25fcea726d0de0ea5bc9b6' 'SKIP' 'SKIP' 'SKIP' '1ac18cad2578df4a70f9346f7c6fccbb62f042a0ee0594817fdef9f2704904ee') 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..." echo "-$pkgrel" > localversion.10-pkgrel echo "${pkgbase#linux}" > localversion.20-pkgname make defconfig make -s kernelrelease > version make mrproper ## --- Patches ### Apply patches # GCC Optimizations msg2 "Apply GCC Optimization Patch..." patch -Np1 < ${srcdir}/kernel_compiler_patch/more-uarches-for-kernel-6.8-rc4+.patch # TKG Patches msg2 "Apply 0001-add-sysctl-to-disallow-unprivileged-CLONE_NEWUSER-by.patch..." patch -Np1 < ${srcdir}/linux-tkg/linux-tkg-patches/${_major}/0001-add-sysctl-to-disallow-unprivileged-CLONE_NEWUSER-by.patch msg2 "Apply 0002-clear-patches.patch..." patch -Np1 < ${srcdir}/linux-tkg/linux-tkg-patches/${_major}/0002-clear-patches.patch msg2 "Apply 0003-glitched-base.patch..." patch -Np1 < ${srcdir}/linux-tkg/linux-tkg-patches/${_major}/0003-glitched-base.patch msg2 "Apply 0003-glitched-cfs.patch..." patch -Np1 < ${srcdir}/linux-tkg/linux-tkg-patches/${_major}/0003-glitched-cfs.patch msg2 "Apply 0003-glitched-eevdf-additions.patch..." patch -Np1 < ${srcdir}/linux-tkg/linux-tkg-patches/${_major}/0003-glitched-eevdf-additions.patch msg2 "Apply 0006-add-acs-overrides_iommu.patch..." patch -Np1 < ${srcdir}/linux-tkg/linux-tkg-patches/${_major}/0006-add-acs-overrides_iommu.patch #msg2 "Apply 0007-v${_major}-winesync.patch..." #patch -Np1 < ${srcdir}/linux-tkg/linux-tkg-patches/${_major}/0007-v${_major}-winesync.patch msg2 "Apply 0007-v${_major}-fsync1_via_futex_waitv.patch..." patch -Np1 < ${srcdir}/linux-tkg/linux-tkg-patches/${_major}/0007-v${_major}-fsync1_via_futex_waitv.patch msg2 "Apply 0012-misc-additions.patch..." patch -Np1 < ${srcdir}/linux-tkg/linux-tkg-patches/${_major}/0012-misc-additions.patch msg2 "Apply 0013-optimize_harder_O3.patch..." patch -Np1 < ${srcdir}/linux-tkg/linux-tkg-patches/${_major}/0013-optimize_harder_O3.patch msg2 "Apply 0014-OpenRGB.patch..." patch -Np1 < ${srcdir}/linux-tkg/linux-tkg-patches/${_major}/0014-OpenRGB.patch ### Setting config echo "Setting config..." cp ${srcdir}/linux-tkg/linux-tkg-config/${_major}/config.x86_64 .config make olddefconfig diff -u ../config .config || : # Let's user choose microarchitecture optimization in GCC sh ${srcdir}/choose-gcc-optimization.sh $_microarchitecture ## --- Configs And Tweaks msg2 "Disable old dynticks..." scripts/config --disable CONFIG_HZ_PERIODIC scripts/config --disable CONFIG_NO_HZ scripts/config --disable CONFIG_NO_HZ_IDLE scripts/config --disable CONFIG_CONTEXT_TRACKING scripts/config --disable CONFIG_CONTEXT_TRACKING_FORCE scripts/config --enable CONFIG_NO_HZ_COMMON scripts/config --enable CONFIG_NO_HZ_FULL scripts/config --enable CONFIG_NO_HZ_FULL_NODEF msg2 "Set up a GCC -O3 optimized kernel..." scripts/config --disable CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE scripts/config --enable CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3 msg2 "Set tick rate to 1000HZ..." scripts/config --disable CONFIG_HZ_300 scripts/config --enable CONFIG_HZ_1000 scripts/config --set-val CONFIG_HZ 1000 msg2 "Set default CPU governor to performance..." scripts/config --disable CONFIG_CPU_FREQ_DEFAULT_GOV_SCHEDUTIL scripts/config --disable CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE scripts/config --disable CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE scripts/config --disable CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND scripts/config --disable CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE scripts/config --enable CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE msg2 "Disable kernel debugging for smaller builds..." scripts/config --disable CONFIG_DEBUG_KERNEL scripts/config --disable CONFIG_DEBUG_INFO scripts/config --disable CONFIG_UNUSED_SYMBOLS scripts/config --disable CONFIG_DEBUG_FS scripts/config --disable CONFIG_KGDB scripts/config --disable CONFIG_FUNCTION_TRACER scripts/config --disable CONFIG_STACK_TRACER ### Use Nconfig to customize compile options #make nconfig make -s kernelrelease > version echo "Prepared $pkgbase version $(