%global commit0 bcc4ea26f0a7e6620165907c85f940531fe92064 %global shortcommit0 %(c=%{commit0}; echo ${c:0:7}) Name: linux-cachyos-bore-zen4 Version: 7.1.3 Release: 202607200318%{?dist} Summary: Linux BORE + Cachy Sauce Kernel by CachyOS License: GPLv2 URL: https://github.com/CachyOS/linux-cachyos Source0: https://github.com/CachyOS/linux/releases/download/cachyos-%{version}-1/cachyos-%{version}-1.tar.gz Source1: https://raw.githubusercontent.com/cachyos/linux-cachyos/master/linux-cachyos-bore/config Source2: https://raw.githubusercontent.com/cachyos/kernel-patches/master/7.1/sched/0001-bore-cachy.patch Source3: https://raw.githubusercontent.com/cachyos/kernel-patches/master/7.1/misc/dkms-clang.patch BuildRequires: gcc, make, bc, binutils, elfutils-libelf-devel, openssl, openssl-devel, perl, python3, flex, bison, zstd, rsync, kmod, tar, xz, patch BuildRequires: clang, llvm, lld # Prevent stripping by rpmbuild to avoid breaking kernel modules %global __os_install_post %{nil} %global debug_package %{nil} %description Linux kernel with CachyOS patches and BORE scheduler, optimized for AMD Zen4/5. Compiled with LLVM/Clang ThinLTO. %prep %setup -q -n cachyos-%{version}-1 # Apply patches patch -Np1 < %{SOURCE2} patch -Np1 < %{SOURCE3} cp %{SOURCE1} .config # Define localversion to match our RPM name echo "-cachyos-zen4" > localversion.10-cachyos # Architecture optimizations for zen4 scripts/config -d GENERIC_CPU -e MZEN4 -d X86_NATIVE_CPU # Apply config options for BORE (non-RT, full preempt) scripts/config -e CACHY -e SCHED_BORE scripts/config -e PREEMPT -d PREEMPT_LAZY # Enable LLVM ThinLTO scripts/config -e LTO_CLANG_THIN # Enable performance optimizations scripts/config -d CC_OPTIMIZE_FOR_PERFORMANCE -e CC_OPTIMIZE_FOR_PERFORMANCE_O3 %global make_opts LLVM=1 LLVM_IAS=1 CC=clang LD=ld.lld make %{make_opts} olddefconfig %build make %{make_opts} %{?_smp_mflags} all %install make %{make_opts} INSTALL_MOD_PATH=%{buildroot}/usr INSTALL_MOD_STRIP=1 modules_install KVER=$(ls %{buildroot}/usr/lib/modules/ | head -n 1) mkdir -p %{buildroot}/boot install -m 644 arch/x86/boot/bzImage %{buildroot}/boot/vmlinuz-${KVER} install -m 644 System.map %{buildroot}/boot/System.map-${KVER} install -m 644 .config %{buildroot}/boot/config-${KVER} %post KVER=$(ls /usr/lib/modules/ | grep "cachyos-zen4" | head -n 1) /usr/sbin/depmod -a ${KVER} if [ -x /usr/bin/dracut ]; then /usr/bin/dracut --force /boot/initramfs-${KVER}.img ${KVER} fi if [ -x /usr/sbin/grubby ]; then /usr/sbin/grubby --add-kernel=/boot/vmlinuz-${KVER} --title="CachyOS BORE Zen4" --initrd=/boot/initramfs-${KVER}.img --copy-default fi %preun KVER=$(ls /usr/lib/modules/ | grep "cachyos-zen4" | head -n 1) if [ -x /usr/sbin/grubby ]; then /usr/sbin/grubby --remove-kernel=/boot/vmlinuz-${KVER} fi %files /boot/vmlinuz-* /boot/System.map-* /boot/config-* /usr/lib/modules/*