From 5e4e076a8ef91e896beb38035294ae86579b2cb0 Mon Sep 17 00:00:00 2001 From: Eric Naim Date: Tue, 1 Oct 2024 08:55:33 +0800 Subject: [PATCH] linux-cachyos: Default to ThinLTO Signed-off-by: Eric Naim --- linux-cachyos/.SRCINFO | 10 +++++++++- linux-cachyos/PKGBUILD | 44 ++++++++++++++++++++++++++++++++++++++---- script-v3-v4.sh | 4 +++- 3 files changed, 52 insertions(+), 6 deletions(-) diff --git a/linux-cachyos/.SRCINFO b/linux-cachyos/.SRCINFO index fec04e32..cf03666f 100644 --- a/linux-cachyos/.SRCINFO +++ b/linux-cachyos/.SRCINFO @@ -1,7 +1,7 @@ pkgbase = linux-cachyos pkgdesc = Linux SCHED-EXT + BORE + Cachy Sauce Kernel by CachyOS with other patches and improvements pkgver = 6.11.1 - pkgrel = 1 + pkgrel = 2 url = https://github.com/CachyOS/linux-cachyos arch = x86_64 license = GPL-2.0-only @@ -15,6 +15,9 @@ pkgbase = linux-cachyos makedepends = tar makedepends = xz makedepends = zstd + makedepends = clang + makedepends = llvm + makedepends = lld options = !strip options = !debug options = !lto @@ -22,6 +25,7 @@ pkgbase = linux-cachyos source = config source = auto-cpu-optimization.sh source = https://raw.githubusercontent.com/cachyos/kernel-patches/master/6.11/all/0001-cachyos-base-all.patch + source = https://raw.githubusercontent.com/cachyos/kernel-patches/master/6.11/misc/dkms-clang.patch source = https://raw.githubusercontent.com/cachyos/kernel-patches/master/6.11/sched/0001-sched-ext.patch source = https://raw.githubusercontent.com/cachyos/kernel-patches/master/6.11/sched/0001-bore-cachy-ext.patch b2sums = ac9927d74542a2d244b9d683920363ec2dbbe851ae0e069b278f1a0ba82c58b00f0f0312104b46f1b8c06585c2e6acb7eb1e63bd28499891f629c00f9a32f6b5 @@ -45,8 +49,12 @@ pkgname = linux-cachyos provides = WIREGUARD-MODULE provides = KSMBD-MODULE provides = UKSMD-BUILTIN + provides = linux-cachyos-lto=6.11.1-2 + replaces = linux-cachyos-lto pkgname = linux-cachyos-headers pkgdesc = Headers and scripts for building modules for the Linux SCHED-EXT + BORE + Cachy Sauce Kernel by CachyOS with other patches and improvements kernel depends = pahole depends = linux-cachyos + provides = linux-cachyos-lto-headers=6.11.1-2 + replaces = linux-cachyos-lto-headers diff --git a/linux-cachyos/PKGBUILD b/linux-cachyos/PKGBUILD index a44406cf..34627b7f 100644 --- a/linux-cachyos/PKGBUILD +++ b/linux-cachyos/PKGBUILD @@ -109,7 +109,7 @@ _use_auto_optimization=${_use_auto_optimization-y} # "full: uses 1 thread for Linking, slow and uses more memory, theoretically with the highest performance gains." # "thin: uses multiple threads, faster and uses less memory, may have a lower runtime performance than Full." # "none: disable LTO -_use_llvm_lto=${_use_llvm_lto-none} +_use_llvm_lto=${_use_llvm_lto-thin} # Use suffix -lto only when requested by the user # Enabled by default. @@ -143,11 +143,11 @@ _build_nvidia_open=${_build_nvidia_open-} _build_debug=${_build_debug-} if [[ "$_use_llvm_lto" = "thin" || "$_use_llvm_lto" = "full" ]] && [ "$_use_lto_suffix" = "y" ]; then - _pkgsuffix=cachyos-lto + _pkgsuffix=cachyos pkgbase="linux-$_pkgsuffix" elif [ -n "$_use_llvm_lto" ] || [[ "$_use_lto_suffix" = "n" ]]; then - _pkgsuffix=cachyos + _pkgsuffix=cachyos-gcc pkgbase="linux-$_pkgsuffix" fi _major=6.11 @@ -161,7 +161,7 @@ _stable=${_major}.${_minor} _srcname=linux-${_stable} #_srcname=linux-${_major} pkgdesc='Linux SCHED-EXT + BORE + Cachy Sauce Kernel by CachyOS with other patches and improvements' -pkgrel=1 +pkgrel=2 _kernver="$pkgver-$pkgrel" _kernuname="${pkgver}-${_pkgsuffix}" arch=('x86_64') @@ -595,6 +595,12 @@ _package() { 'uksmd: Userspace KSM helper daemon') provides=(VIRTUALBOX-GUEST-MODULES WIREGUARD-MODULE KSMBD-MODULE UKSMD-BUILTIN) + # Replace LTO kernel with the default kernel + if [[ "$_use_llvm_lto" = "thin" || "$_use_llvm_lto" = "full" ]] || [ -n "$_use_kcfi" ]; then + provides+=(linux-cachyos-lto=$_kernver) + replaces=(linux-cachyos-lto) + fi + cd "$_srcname" local modulesdir="$pkgdir/usr/lib/modules/$(