kernel 6.12.12

This commit is contained in:
Anders Rytter Hansen 2025-02-03 11:09:15 +01:00
commit 1a262094b5

View file

@ -12,14 +12,14 @@
# Linux Kernel Versions # Linux Kernel Versions
%define _basekver 6.12 %define _basekver 6.12
%define _stablekver 10 %define _stablekver 12
%define _rpmver %{version}-%{release} %define _rpmver %{version}-%{release}
%define _kver %{_rpmver}.%{_arch} %define _kver %{_rpmver}.%{_arch}
%if %{_stablekver} == 0 %if %{_stablekver} == 0
%define _tarkver %{_basekver} %define _tarkver %{_basekver}
%else %else
%define _tarkver %{version} %define _tarkver %{version}
%endif %endif
# Build a minimal a kernel via modprobed.db # Build a minimal a kernel via modprobed.db
@ -32,9 +32,15 @@
# Builds nvidia-open kernel modules with # Builds nvidia-open kernel modules with
# the kernel # the kernel
%define _build_nv 1
%define _nv_ver 565.77
%define _nv_pkg open-gpu-kernel-modules-%{_nv_ver} %define _nv_pkg open-gpu-kernel-modules-%{_nv_ver}
%if 0%{?fedora} >= 42
%define _build_nv 0
%define _nv_ver 570.86.16
%else
%define _build_nv 1
%define _nv_ver 565.77
%define _nv_old 1
%endif
# Define the tickrate used by the kernel # Define the tickrate used by the kernel
# Valid values: 100, 250, 300, 500, 600, 750 and 1000 # Valid values: 100, 250, 300, 500, 600, 750 and 1000
@ -57,25 +63,25 @@
%define _patch_src https://raw.githubusercontent.com/CachyOS/kernel-patches/master/%{_basekver} %define _patch_src https://raw.githubusercontent.com/CachyOS/kernel-patches/master/%{_basekver}
%if %{_build_lto} %if %{_build_lto}
# Define build environment variables to build the kernel with clang # Define build environment variables to build the kernel with clang
%define _lto_args CC=clang CXX=clang++ LD=ld.lld LLVM=1 LLVM_IAS=1 %define _lto_args CC=clang CXX=clang++ LD=ld.lld LLVM=1 LLVM_IAS=1
%endif %endif
%define _module_args KERNEL_UNAME=%{_kver} IGNORE_PREEMPT_RT_PRESENCE=1 SYSSRC=%{_builddir}/linux-%{_tarkver} SYSOUT=%{_builddir}/linux-%{_tarkver} %define _module_args KERNEL_UNAME=%{_kver} IGNORE_PREEMPT_RT_PRESENCE=1 SYSSRC=%{_builddir}/linux-%{_tarkver} SYSOUT=%{_builddir}/linux-%{_tarkver}
Name: kernel-cachyos-lts%{?_lto_args:-lto}-skylake Name: kernel-cachyos-lts%{?_lto_args:-lto}-skylake
Summary:Linux BORE %{?_lto_args:+ LTO }Cachy Sauce Kernel by CachyOS with other patches and improvements. Summary: Linux BORE %{?_lto_args:+ LTO }Cachy Sauce Kernel by CachyOS with other patches and improvements.
Version:%{_basekver}.%{_stablekver} Version: %{_basekver}.%{_stablekver}
Release:cachylts4%{?_lto_args:.lto}.skylake%{?dist} Release: cachylts1%{?_lto_args:.lto}.skylake%{?dist}
License:GPL-2.0-only License: GPL-2.0-only
URL:https://cachyos.org URL: https://cachyos.org
Requires: kernel-core-uname-r = %{_kver} Requires: kernel-core-uname-r = %{_kver}
Requires: kernel-modules-uname-r = %{_kver} Requires: kernel-modules-uname-r = %{_kver}
Requires: kernel-modules-core-uname-r = %{_kver} Requires: kernel-modules-core-uname-r = %{_kver}
Provides: kernel-cachyos-lts%{?_lto_args:-lto}-skylake > 6.6.71-clts1.0%{?_lto_args:.lto}.skylake%{?dist} Provides: kernel-cachyos-lts%{?_lto_args:-lto}-skylake > 6.6.71-clts1.0%{?_lto_args:.lto}.skylake%{?dist}
Provides: installonlypkg(kernel) Provides: installonlypkg(kernel)
Obsoletes: kernel-cachyos-lts%{?_lto_args:-lto}-skylake <= 6.6.71-clts1.0%{?_lto_args:.lto}.skylake%{?dist} Obsoletes: kernel-cachyos-lts%{?_lto_args:-lto}-skylake <= 6.6.71-clts1.0%{?_lto_args:.lto}.skylake%{?dist}
BuildRequires: bc BuildRequires: bc
BuildRequires: bison BuildRequires: bison
@ -107,84 +113,86 @@ BuildRequires: gcc-c++
%endif %endif
# Indexes 0-9 are reserved for the kernel. 10-19 will be reserved for NVIDIA # Indexes 0-9 are reserved for the kernel. 10-19 will be reserved for NVIDIA
Source0:https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-%{_tarkver}.tar.xz Source0: https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-%{_tarkver}.tar.xz
Source1:https://raw.githubusercontent.com/CachyOS/linux-cachyos/master/linux-cachyos-lts/config Source1: https://raw.githubusercontent.com/CachyOS/linux-cachyos/master/linux-cachyos-lts/config
%if %{_build_minimal} %if %{_build_minimal}
# The default modprobed.db provided is used for linux-cachyos CI. # The default modprobed.db provided is used for linux-cachyos CI.
# This should not be used for production and ideally should only be used for compile tests. # This should not be used for production and ideally should only be used for compile tests.
# Note that any modprobed.db file is accepted # Note that any modprobed.db file is accepted
Source2:https://raw.githubusercontent.com/CachyOS/linux-cachyos/master/modprobed.db Source2: https://raw.githubusercontent.com/CachyOS/linux-cachyos/master/modprobed.db
%endif %endif
%if %{_build_nv} %if %{_build_nv}
Source10: https://github.com/NVIDIA/open-gpu-kernel-modules/archive/%{_nv_ver}/%{_nv_pkg}.tar.gz Source10: https://github.com/NVIDIA/open-gpu-kernel-modules/archive/%{_nv_ver}/%{_nv_pkg}.tar.gz
%endif %endif
Patch0: %{_patch_src}/all/0001-cachyos-base-all.patch Patch0: %{_patch_src}/all/0001-cachyos-base-all.patch
Patch1: %{_patch_src}/sched/0001-bore-cachy.patch Patch1: %{_patch_src}/sched/0001-bore-cachy.patch
%if %{_build_lto} %if %{_build_lto}
Patch2: %{_patch_src}/misc/dkms-clang.patch Patch2: %{_patch_src}/misc/dkms-clang.patch
%endif %endif
%if %{_build_nv} %if %{_build_nv}
Patch10:%{_patch_src}/misc/nvidia/0001-Make-modeset-and-fbdev-default-enabled.patch Patch10: %{_patch_src}/misc/nvidia/%{?_nv_old:565}/0001-Make-modeset-and-fbdev-default-enabled.patch
Patch11:%{_patch_src}/misc/nvidia/0002-Do-not-error-on-unkown-CPU-Type-and-add-Zen5-support.patch %if 0%{?fedora} < 42
Patch12:%{_patch_src}/misc/nvidia/0004-silence-event-assert-until-570.patch Patch11: %{_patch_src}/misc/nvidia/565/0002-Do-not-error-on-unkown-CPU-Type-and-add-Zen5-support.patch
Patch13:%{_patch_src}/misc/nvidia/0005-nvkms-Sanitize-trim-ELD-product-name-strings.patch Patch12: %{_patch_src}/misc/nvidia/565/0004-silence-event-assert-until-570.patch
Patch13: %{_patch_src}/misc/nvidia/565/0005-nvkms-Sanitize-trim-ELD-product-name-strings.patch
%endif
%endif %endif
%description %description
The meta package for %{name}. The meta package for %{name}.
%prep %prep
%setup -q %{?SOURCE10:-b 10} -n linux-%{_tarkver} %setup -q %{?SOURCE10:-b 10} -n linux-%{_tarkver}
%autopatch -p1 -v -M 9 %autopatch -p1 -v -M 9
cp %{SOURCE1} .config cp %{SOURCE1} .config
# Default configs to always enable # Default configs to always enable
# Enable CACHY sauce and the scheduler # Enable CACHY sauce and the scheduler
# used in the default linux-cachyos kernel # used in the default linux-cachyos kernel
scripts/config -e CACHY -e SCHED_BORE scripts/config -e CACHY -e SCHED_BORE
# Use SElinux by default # Use SElinux by default
# https://github.com/sirlucjan/copr-linux-cachyos/pull/1 # https://github.com/sirlucjan/copr-linux-cachyos/pull/1
scripts/config --set-str CONFIG_LSM lockdown,yama,integrity,selinux,bpf,landlock scripts/config --set-str CONFIG_LSM lockdown,yama,integrity,selinux,bpf,landlock
# Do not change the system's hostname # Do not change the system's hostname
scripts/config -u DEFAULT_HOSTNAME scripts/config -u DEFAULT_HOSTNAME
case %{_hz_tick} in case %{_hz_tick} in
100|250|300|500|600|750|1000) 100|250|300|500|600|750|1000)
scripts/config -e HZ_%{_hz_tick} --set-val HZ %{_hz_tick};; scripts/config -e HZ_%{_hz_tick} --set-val HZ %{_hz_tick};;
*) *)
echo "Invalid tickrate value, using default 1000" echo "Invalid tickrate value, using default 1000"
scripts/config -e HZ_1000 --set-val HZ 1000;; scripts/config -e HZ_1000 --set-val HZ 1000;;
esac esac
%if %{_x86_64_lvl} < 5 && %{_x86_64_lvl} > 0 %if %{_x86_64_lvl} < 5 && %{_x86_64_lvl} > 0
scripts/config --set-val X86_64_VERSION %{_x86_64_lvl} scripts/config --set-val X86_64_VERSION %{_x86_64_lvl}
%else %else
echo "Invalid x86_64 ISA Level. Using x86_64_v3" echo "Invalid x86_64 ISA Level. Using x86_64_v3"
scripts/config --set-val X86_64_VERSION 3 scripts/config --set-val X86_64_VERSION 3
%endif %endif
scripts/config -d GENERIC_CPU scripts/config -d GENERIC_CPU
scripts/config -e MSKYLAKE scripts/config -e MSKYLAKE
%if %{_build_lto} %if %{_build_lto}
scripts/config -e LTO_CLANG_THIN scripts/config -e LTO_CLANG_THIN
%endif %endif
%if %{_build_minimal} %if %{_build_minimal}
%make_build LSMOD=%{SOURCE2} localmodconfig %make_build LSMOD=%{SOURCE2} localmodconfig
%else %else
%make_build olddefconfig %make_build olddefconfig
%endif %endif
diff -u %{SOURCE1} .config || : diff -u %{SOURCE1} .config || :
%if %{_build_nv} %if %{_build_nv}
cd %{_builddir}/%{_nv_pkg}/kernel-open cd %{_builddir}/%{_nv_pkg}/kernel-open
@ -194,297 +202,295 @@ cd ..
%endif %endif
%build %build
%make_build EXTRAVERSION=-%{release}.%{_arch} all %make_build EXTRAVERSION=-%{release}.%{_arch} all
%make_build -C tools/bpf/bpftool vmlinux.h feature-clang-bpf-co-re=1 %make_build -C tools/bpf/bpftool vmlinux.h feature-clang-bpf-co-re=1
%if %{_build_nv} %if %{_build_nv}
cd %{_builddir}/%{_nv_pkg} cd %{_builddir}/%{_nv_pkg}
CFLAGS= CXXFLAGS= LDFLAGS= %make_build %{_module_args} IGNORE_CC_MISMATCH=yes modules CFLAGS= CXXFLAGS= LDFLAGS= %make_build %{_module_args} IGNORE_CC_MISMATCH=yes modules
%endif %endif
%install %install
echo "Installing the kernel image..." echo "Installing the kernel image..."
install -Dm644 "$(%make_build -s image_name)" "%{buildroot}%{_kernel_dir}/vmlinuz" install -Dm644 "$(%make_build -s image_name)" "%{buildroot}%{_kernel_dir}/vmlinuz"
zstdmt -19 < Module.symvers > %{buildroot}%{_kernel_dir}/symvers.zst zstdmt -19 < Module.symvers > %{buildroot}%{_kernel_dir}/symvers.zst
echo "Installing kernel modules..." echo "Installing kernel modules..."
ZSTD_CLEVEL=19 %make_build INSTALL_MOD_PATH="%{buildroot}" INSTALL_MOD_STRIP=1 DEPMOD=/doesnt/exist modules_install ZSTD_CLEVEL=19 %make_build INSTALL_MOD_PATH="%{buildroot}" INSTALL_MOD_STRIP=1 DEPMOD=/doesnt/exist modules_install
echo "Installing files for the development package..." echo "Installing files for the development package..."
install -Dt %{buildroot}%{_devel_dir} -m644 .config Makefile Module.symvers System.map tools/bpf/bpftool/vmlinux.h install -Dt %{buildroot}%{_devel_dir} -m644 .config Makefile Module.symvers System.map tools/bpf/bpftool/vmlinux.h
cp .config %{buildroot}%{_kernel_dir}/config cp .config %{buildroot}%{_kernel_dir}/config
cp System.map %{buildroot}%{_kernel_dir}/System.map cp System.map %{buildroot}%{_kernel_dir}/System.map
cp --parents `find -type f -name "Makefile*" -o -name "Kconfig*"` %{buildroot}%{_devel_dir} cp --parents `find -type f -name "Makefile*" -o -name "Kconfig*"` %{buildroot}%{_devel_dir}
rm -rf %{buildroot}%{_devel_dir}/scripts rm -rf %{buildroot}%{_devel_dir}/scripts
rm -rf %{buildroot}%{_devel_dir}/include rm -rf %{buildroot}%{_devel_dir}/include
cp -a scripts %{buildroot}%{_devel_dir} cp -a scripts %{buildroot}%{_devel_dir}
rm -rf %{buildroot}%{_devel_dir}/scripts/tracing rm -rf %{buildroot}%{_devel_dir}/scripts/tracing
rm -f %{buildroot}%{_devel_dir}/scripts/spdxcheck.py rm -f %{buildroot}%{_devel_dir}/scripts/spdxcheck.py
# The cp commands below are needed for parity with Fedora's packaging # The cp commands below are needed for parity with Fedora's packaging
# Install files that are needed for `make scripts` to succeed # Install files that are needed for `make scripts` to succeed
cp -a --parents security/selinux/include/classmap.h %{buildroot}%{_devel_dir} cp -a --parents security/selinux/include/classmap.h %{buildroot}%{_devel_dir}
cp -a --parents security/selinux/include/initial_sid_to_string.h %{buildroot}%{_devel_dir} cp -a --parents security/selinux/include/initial_sid_to_string.h %{buildroot}%{_devel_dir}
cp -a --parents tools/include/tools/be_byteshift.h %{buildroot}%{_devel_dir} cp -a --parents tools/include/tools/be_byteshift.h %{buildroot}%{_devel_dir}
cp -a --parents tools/include/tools/le_byteshift.h %{buildroot}%{_devel_dir} cp -a --parents tools/include/tools/le_byteshift.h %{buildroot}%{_devel_dir}
# Install files that are needed for `make prepare` to succeed -- Generic # Install files that are needed for `make prepare` to succeed -- Generic
cp -a --parents tools/include/linux/compiler* %{buildroot}%{_devel_dir} cp -a --parents tools/include/linux/compiler* %{buildroot}%{_devel_dir}
cp -a --parents tools/include/linux/types.h %{buildroot}%{_devel_dir} cp -a --parents tools/include/linux/types.h %{buildroot}%{_devel_dir}
cp -a --parents tools/build/Build.include %{buildroot}%{_devel_dir} cp -a --parents tools/build/Build.include %{buildroot}%{_devel_dir}
cp --parents tools/build/fixdep.c %{buildroot}%{_devel_dir} cp --parents tools/build/fixdep.c %{buildroot}%{_devel_dir}
cp --parents tools/objtool/sync-check.sh %{buildroot}%{_devel_dir} cp --parents tools/objtool/sync-check.sh %{buildroot}%{_devel_dir}
cp -a --parents tools/bpf/resolve_btfids %{buildroot}%{_devel_dir} cp -a --parents tools/bpf/resolve_btfids %{buildroot}%{_devel_dir}
cp --parents security/selinux/include/policycap_names.h %{buildroot}%{_devel_dir} cp --parents security/selinux/include/policycap_names.h %{buildroot}%{_devel_dir}
cp --parents security/selinux/include/policycap.h %{buildroot}%{_devel_dir} cp --parents security/selinux/include/policycap.h %{buildroot}%{_devel_dir}
cp -a --parents tools/include/asm %{buildroot}%{_devel_dir} cp -a --parents tools/include/asm %{buildroot}%{_devel_dir}
cp -a --parents tools/include/asm-generic %{buildroot}%{_devel_dir} cp -a --parents tools/include/asm-generic %{buildroot}%{_devel_dir}
cp -a --parents tools/include/linux %{buildroot}%{_devel_dir} cp -a --parents tools/include/linux %{buildroot}%{_devel_dir}
cp -a --parents tools/include/uapi/asm %{buildroot}%{_devel_dir} cp -a --parents tools/include/uapi/asm %{buildroot}%{_devel_dir}
cp -a --parents tools/include/uapi/asm-generic %{buildroot}%{_devel_dir} cp -a --parents tools/include/uapi/asm-generic %{buildroot}%{_devel_dir}
cp -a --parents tools/include/uapi/linux %{buildroot}%{_devel_dir} cp -a --parents tools/include/uapi/linux %{buildroot}%{_devel_dir}
cp -a --parents tools/include/vdso %{buildroot}%{_devel_dir} cp -a --parents tools/include/vdso %{buildroot}%{_devel_dir}
cp --parents tools/scripts/utilities.mak %{buildroot}%{_devel_dir} cp --parents tools/scripts/utilities.mak %{buildroot}%{_devel_dir}
cp -a --parents tools/lib/subcmd %{buildroot}%{_devel_dir} cp -a --parents tools/lib/subcmd %{buildroot}%{_devel_dir}
cp --parents tools/lib/*.c %{buildroot}%{_devel_dir} cp --parents tools/lib/*.c %{buildroot}%{_devel_dir}
cp --parents tools/objtool/*.[ch] %{buildroot}%{_devel_dir} cp --parents tools/objtool/*.[ch] %{buildroot}%{_devel_dir}
cp --parents tools/objtool/Build %{buildroot}%{_devel_dir} cp --parents tools/objtool/Build %{buildroot}%{_devel_dir}
cp --parents tools/objtool/include/objtool/*.h %{buildroot}%{_devel_dir} cp --parents tools/objtool/include/objtool/*.h %{buildroot}%{_devel_dir}
cp -a --parents tools/lib/bpf %{buildroot}%{_devel_dir} cp -a --parents tools/lib/bpf %{buildroot}%{_devel_dir}
cp --parents tools/lib/bpf/Build %{buildroot}%{_devel_dir} cp --parents tools/lib/bpf/Build %{buildroot}%{_devel_dir}
# Misc headers # Misc headers
cp -a --parents arch/x86/include %{buildroot}%{_devel_dir} cp -a --parents arch/x86/include %{buildroot}%{_devel_dir}
cp -a --parents tools/arch/x86/include %{buildroot}%{_devel_dir} cp -a --parents tools/arch/x86/include %{buildroot}%{_devel_dir}
cp -a include %{buildroot}%{_devel_dir}/include cp -a include %{buildroot}%{_devel_dir}/include
cp -a sound/soc/sof/sof-audio.h %{buildroot}%{_devel_dir}/sound/soc/sof cp -a sound/soc/sof/sof-audio.h %{buildroot}%{_devel_dir}/sound/soc/sof
cp -a tools/objtool/objtool %{buildroot}%{_devel_dir}/tools/objtool/ cp -a tools/objtool/objtool %{buildroot}%{_devel_dir}/tools/objtool/
cp -a tools/objtool/fixdep %{buildroot}%{_devel_dir}/tools/objtool/ cp -a tools/objtool/fixdep %{buildroot}%{_devel_dir}/tools/objtool/
# Install files that are needed for `make prepare` to succeed -- for x86_64 # Install files that are needed for `make prepare` to succeed -- for x86_64
cp -a --parents arch/x86/entry/syscalls/syscall_32.tbl %{buildroot}%{_devel_dir} cp -a --parents arch/x86/entry/syscalls/syscall_32.tbl %{buildroot}%{_devel_dir}
cp -a --parents arch/x86/entry/syscalls/syscall_64.tbl %{buildroot}%{_devel_dir} cp -a --parents arch/x86/entry/syscalls/syscall_64.tbl %{buildroot}%{_devel_dir}
cp -a --parents arch/x86/tools/relocs_32.c %{buildroot}%{_devel_dir} cp -a --parents arch/x86/tools/relocs_32.c %{buildroot}%{_devel_dir}
cp -a --parents arch/x86/tools/relocs_64.c %{buildroot}%{_devel_dir} cp -a --parents arch/x86/tools/relocs_64.c %{buildroot}%{_devel_dir}
cp -a --parents arch/x86/tools/relocs.c %{buildroot}%{_devel_dir} cp -a --parents arch/x86/tools/relocs.c %{buildroot}%{_devel_dir}
cp -a --parents arch/x86/tools/relocs_common.c %{buildroot}%{_devel_dir} cp -a --parents arch/x86/tools/relocs_common.c %{buildroot}%{_devel_dir}
cp -a --parents arch/x86/tools/relocs.h %{buildroot}%{_devel_dir} cp -a --parents arch/x86/tools/relocs.h %{buildroot}%{_devel_dir}
cp -a --parents arch/x86/purgatory/purgatory.c %{buildroot}%{_devel_dir} cp -a --parents arch/x86/purgatory/purgatory.c %{buildroot}%{_devel_dir}
cp -a --parents arch/x86/purgatory/stack.S %{buildroot}%{_devel_dir} cp -a --parents arch/x86/purgatory/stack.S %{buildroot}%{_devel_dir}
cp -a --parents arch/x86/purgatory/setup-x86_64.S %{buildroot}%{_devel_dir} cp -a --parents arch/x86/purgatory/setup-x86_64.S %{buildroot}%{_devel_dir}
cp -a --parents arch/x86/purgatory/entry64.S %{buildroot}%{_devel_dir} cp -a --parents arch/x86/purgatory/entry64.S %{buildroot}%{_devel_dir}
cp -a --parents arch/x86/boot/string.h %{buildroot}%{_devel_dir} cp -a --parents arch/x86/boot/string.h %{buildroot}%{_devel_dir}
cp -a --parents arch/x86/boot/string.c %{buildroot}%{_devel_dir} cp -a --parents arch/x86/boot/string.c %{buildroot}%{_devel_dir}
cp -a --parents arch/x86/boot/ctype.h %{buildroot}%{_devel_dir} cp -a --parents arch/x86/boot/ctype.h %{buildroot}%{_devel_dir}
cp -a --parents scripts/syscalltbl.sh %{buildroot}%{_devel_dir} cp -a --parents scripts/syscalltbl.sh %{buildroot}%{_devel_dir}
cp -a --parents scripts/syscallhdr.sh %{buildroot}%{_devel_dir} cp -a --parents scripts/syscallhdr.sh %{buildroot}%{_devel_dir}
cp -a --parents tools/arch/x86/include/asm %{buildroot}%{_devel_dir} cp -a --parents tools/arch/x86/include/asm %{buildroot}%{_devel_dir}
cp -a --parents tools/arch/x86/include/uapi/asm %{buildroot}%{_devel_dir} cp -a --parents tools/arch/x86/include/uapi/asm %{buildroot}%{_devel_dir}
cp -a --parents tools/objtool/arch/x86/lib %{buildroot}%{_devel_dir} cp -a --parents tools/objtool/arch/x86/lib %{buildroot}%{_devel_dir}
cp -a --parents tools/arch/x86/lib/ %{buildroot}%{_devel_dir} cp -a --parents tools/arch/x86/lib/ %{buildroot}%{_devel_dir}
cp -a --parents tools/arch/x86/tools/gen-insn-attr-x86.awk %{buildroot}%{_devel_dir} cp -a --parents tools/arch/x86/tools/gen-insn-attr-x86.awk %{buildroot}%{_devel_dir}
cp -a --parents tools/objtool/arch/x86/ %{buildroot}%{_devel_dir} cp -a --parents tools/objtool/arch/x86/ %{buildroot}%{_devel_dir}
# Final cleanups ala Fedora # Final cleanups ala Fedora
echo "Cleaning up development files..." echo "Cleaning up development files..."
find %{buildroot}%{_devel_dir}/scripts \( -iname "*.o" -o -iname "*.cmd" \) -exec rm -f {} + find %{buildroot}%{_devel_dir}/scripts \( -iname "*.o" -o -iname "*.cmd" \) -exec rm -f {} +
find %{buildroot}%{_devel_dir}/tools \( -iname "*.o" -o -iname "*.cmd" \) -exec rm -f {} + find %{buildroot}%{_devel_dir}/tools \( -iname "*.o" -o -iname "*.cmd" \) -exec rm -f {} +
touch -r %{buildroot}%{_devel_dir}/Makefile \ touch -r %{buildroot}%{_devel_dir}/Makefile \
%{buildroot}%{_devel_dir}/include/generated/uapi/linux/version.h \ %{buildroot}%{_devel_dir}/include/generated/uapi/linux/version.h \
%{buildroot}%{_devel_dir}/include/config/auto.conf %{buildroot}%{_devel_dir}/include/config/auto.conf
# These links will be owned by the modules package, creating a broken # These links will be owned by the modules package, creating a broken
# link unless the -devel package is installed. why?? # link unless the -devel package is installed. why??
rm -rf %{buildroot}%{_kernel_dir}/build rm -rf %{buildroot}%{_kernel_dir}/build
ln -s %{_devel_dir} %{buildroot}%{_kernel_dir}/build ln -s %{_devel_dir} %{buildroot}%{_kernel_dir}/build
ln -s %{_kernel_dir}/build %{buildroot}%{_kernel_dir}/source ln -s %{_kernel_dir}/build %{buildroot}%{_kernel_dir}/source
# Create stub initramfs to inflate disk space requirements. # Create stub initramfs to inflate disk space requirements.
# This should hopefully prevent some initramfs failures due to # This should hopefully prevent some initramfs failures due to
# insufficient space in /boot (#bz #530778) # insufficient space in /boot (#bz #530778)
# 90 seems to be a safe value nowadays. It is slightly inflated than the # 90 seems to be a safe value nowadays. It is slightly inflated than the
# measured average to also account for installed vmlinuz in /boot # measured average to also account for installed vmlinuz in /boot
echo "Creating stub initramfs..." echo "Creating stub initramfs..."
install -dm755 %{buildroot}/boot install -dm755 %{buildroot}/boot
dd if=/dev/zero of=%{buildroot}/boot/initramfs-%{_kver}.img bs=1M count=90 dd if=/dev/zero of=%{buildroot}/boot/initramfs-%{_kver}.img bs=1M count=90
%if %{_build_nv} %if %{_build_nv}
cd %{_builddir}/%{_nv_pkg} cd %{_builddir}/%{_nv_pkg}
echo "Installing NVIDIA open kernel modules..." echo "Installing NVIDIA open kernel modules..."
install -Dt %{buildroot}%{_kernel_dir}/nvidia -m644 kernel-open/*.ko install -Dt %{buildroot}%{_kernel_dir}/nvidia -m644 kernel-open/*.ko
find %{buildroot}%{_kernel_dir}/nvidia -name '*.ko' -exec zstd --rm -19 {} + find %{buildroot}%{_kernel_dir}/nvidia -name '*.ko' -exec zstd --rm -19 {} +
install -Dt %{buildroot}/%{_defaultlicensedir}/%{name}-nvidia-open -m644 COPYING install -Dt %{buildroot}/%{_defaultlicensedir}/%{name}-nvidia-open -m644 COPYING
%endif %endif
%package core %package core
Summary:Linux BORE Cachy Sauce Kernel by CachyOS with other patches and improvements Summary: Linux BORE Cachy Sauce Kernel by CachyOS with other patches and improvements
AutoReq:no AutoReq: no
Conflicts: xfsprogs < 4.3.0-1 Conflicts: xfsprogs < 4.3.0-1
Conflicts: xorg-x11-drv-vmmouse < 13.0.99 Conflicts: xorg-x11-drv-vmmouse < 13.0.99
Provides: kernel = %{_rpmver} Provides: kernel = %{_rpmver}
Provides: kernel-core-uname-r = %{_kver} Provides: kernel-core-uname-r = %{_kver}
Provides: kernel-uname-r = %{_kver} Provides: kernel-uname-r = %{_kver}
Provides: installonlypkg(kernel) Provides: installonlypkg(kernel)
Requires: kernel-modules-uname-r = %{_kver} Requires: kernel-modules-uname-r = %{_kver}
Requires(pre): /usr/bin/kernel-install Requires(pre): /usr/bin/kernel-install
Requires(pre): coreutils Requires(pre): coreutils
Requires(pre): dracut >= 027 Requires(pre): dracut >= 027
Requires(pre): systemd >= 203-2 Requires(pre): systemd >= 203-2
Requires(pre): ((linux-firmware >= 20150904-56.git6ebf5d57) if linux-firmware) Requires(pre): ((linux-firmware >= 20150904-56.git6ebf5d57) if linux-firmware)
Requires(preun):systemd >= 200 Requires(preun):systemd >= 200
Recommends: linux-firmware Recommends: linux-firmware
%description core %description core
The kernel package contains the Linux kernel (vmlinuz), the core of any The kernel package contains the Linux kernel (vmlinuz), the core of any
Linux operating system. The kernel handles the basic functions Linux operating system. The kernel handles the basic functions
of the operating system: memory allocation, process allocation, device of the operating system: memory allocation, process allocation, device
input and output, etc. input and output, etc.
%post core %post core
mkdir -p %{_localstatedir}/lib/rpm-state/%{name} mkdir -p %{_localstatedir}/lib/rpm-state/%{name}
touch %{_localstatedir}/lib/rpm-state/%{name}/installing_core_%{_kver} touch %{_localstatedir}/lib/rpm-state/%{name}/installing_core_%{_kver}
%posttrans core %posttrans core
rm -f %{_localstatedir}/lib/rpm-state/%{name}/installing_core_%{_kver} rm -f %{_localstatedir}/lib/rpm-state/%{name}/installing_core_%{_kver}
if [ ! -e /run/ostree-booted ]; then if [ ! -e /run/ostree-booted ]; then
/bin/kernel-install add %{_kver} %{_kernel_dir}/vmlinuz || exit $? /bin/kernel-install add %{_kver} %{_kernel_dir}/vmlinuz || exit $?
if [[ ! -e "/boot/symvers-%{_kver}.zst" ]]; then if [[ ! -e "/boot/symvers-%{_kver}.zst" ]]; then
cp "%{_kernel_dir}/symvers.zst" "/boot/symvers-%{_kver}.zst" cp "%{_kernel_dir}/symvers.zst" "/boot/symvers-%{_kver}.zst"
if command -v restorecon &>/dev/null; then if command -v restorecon &>/dev/null; then
restorecon "/boot/symvers-%{_kver}.zst" restorecon "/boot/symvers-%{_kver}.zst"
fi fi
fi fi
fi fi
%preun core %preun core
/bin/kernel-install remove %{_kver} || exit $? /bin/kernel-install remove %{_kver} || exit $?
if [ -x /usr/sbin/weak-modules ]; then if [ -x /usr/sbin/weak-modules ]; then
/usr/sbin/weak-modules --remove-kernel %{_kver} || exit $? /usr/sbin/weak-modules --remove-kernel %{_kver} || exit $?
fi fi
%files core %files core
%license COPYING %license COPYING
%ghost /boot/initramfs-%{_kver}.img %ghost /boot/initramfs-%{_kver}.img
%{_kernel_dir}/vmlinuz %{_kernel_dir}/vmlinuz
%{_kernel_dir}/symvers.zst %{_kernel_dir}/modules.builtin
%{_kernel_dir}/config %{_kernel_dir}/modules.builtin.modinfo
%{_kernel_dir}/System.map %{_kernel_dir}/symvers.zst
%{_kernel_dir}/config
%{_kernel_dir}/System.map
%package modules %package modules
Summary:Kernel modules package for %{name} Summary: Kernel modules package for %{name}
Provides: kernel-modules = %{_rpmver} Provides: kernel-modules = %{_rpmver}
Provides: kernel-modules-core = %{_rpmver} Provides: kernel-modules-core = %{_rpmver}
Provides: kernel-modules-extra = %{_rpmver} Provides: kernel-modules-extra = %{_rpmver}
Provides: kernel-modules-uname-r = %{_kver} Provides: kernel-modules-uname-r = %{_kver}
Provides: kernel-modules-core-uname-r = %{_kver} Provides: kernel-modules-core-uname-r = %{_kver}
Provides: kernel-modules-extra-uname-r = %{_kver} Provides: kernel-modules-extra-uname-r = %{_kver}
Provides: installonlypkg(kernel-module) Provides: installonlypkg(kernel-module)
Requires: kernel-uname-r = %{_kver} Requires: kernel-uname-r = %{_kver}
%description modules %description modules
This package provides kernel modules for the %{name}-core kernel package. This package provides kernel modules for the %{name}-core kernel package.
%post modules %post modules
/sbin/depmod -a %{_kver} if [ ! -f %{_localstatedir}/lib/rpm-state/%{name}/installing_core_%{_kver} ]; then
if [ ! -f %{_localstatedir}/lib/rpm-state/%{name}/installing_core_%{_kver} ]; then mkdir -p %{_localstatedir}/lib/rpm-state/%{name}
mkdir -p %{_localstatedir}/lib/rpm-state/%{name} touch %{_localstatedir}/lib/rpm-state/%{name}/need_to_run_dracut_%{_kver}
touch %{_localstatedir}/lib/rpm-state/%{name}/need_to_run_dracut_%{_kver} fi
fi
%posttrans modules %posttrans modules
rm -f %{_localstatedir}/lib/rpm-state/%{name}/need_to_run_dracut_%{_kver} rm -f %{_localstatedir}/lib/rpm-state/%{name}/need_to_run_dracut_%{_kver}
if [ ! -e /run/ostree-booted ]; then /sbin/depmod -a %{_kver}
if [ -f %{_localstatedir}/lib/rpm-state/%{name}/need_to_run_dracut_%{_kver} ]; then if [ ! -e /run/ostree-booted ]; then
echo "Running: dracut -f --kver %{_kver}" if [ -f %{_localstatedir}/lib/rpm-state/%{name}/need_to_run_dracut_%{_kver} ]; then
dracut -f --kver "%{_kver}" || exit $? echo "Running: dracut -f --kver %{_kver}"
fi dracut -f --kver "%{_kver}" || exit $?
fi fi
fi
%files modules %files modules
%dir %{_kernel_dir} %dir %{_kernel_dir}
%{_kernel_dir}/modules.builtin %{_kernel_dir}/modules.order
%{_kernel_dir}/modules.builtin.modinfo %{_kernel_dir}/build
%{_kernel_dir}/modules.order %{_kernel_dir}/source
%{_kernel_dir}/build %{_kernel_dir}/kernel
%{_kernel_dir}/source
%{_kernel_dir}/kernel
%package devel %package devel
Summary:Development package for building kernel modules to match %{name} Summary: Development package for building kernel modules to match %{name}
Provides: kernel-devel = %{_rpmver} Provides: kernel-devel = %{_rpmver}
Provides: kernel-devel-uname-r = %{_kver} Provides: kernel-devel-uname-r = %{_kver}
Provides: installonlypkg(kernel) Provides: installonlypkg(kernel)
AutoReqProv:no AutoReqProv: no
Requires(pre): findutils Requires(pre): findutils
Requires: findutils Requires: findutils
Requires: perl-interpreter Requires: perl-interpreter
Requires: openssl-devel Requires: openssl-devel
Requires: elfutils-libelf-devel Requires: elfutils-libelf-devel
Requires: bison Requires: bison
Requires: flex Requires: flex
Requires: make Requires: make
%if %{_build_lto} %if %{_build_lto}
Requires: clang Requires: clang
Requires: lld Requires: lld
Requires: llvm Requires: llvm
%else %else
Requires: gcc Requires: gcc
%endif %endif
%description devel %description devel
This package provides kernel headers and makefiles sufficient to build modules against %{name}. This package provides kernel headers and makefiles sufficient to build modules against %{name}.
%post devel %post devel
if [ -f /etc/sysconfig/kernel ]; then if [ -f /etc/sysconfig/kernel ]; then
. /etc/sysconfig/kernel || exit $? . /etc/sysconfig/kernel || exit $?
fi fi
if [ "$HARDLINK" != "no" -a -x /usr/bin/hardlink -a ! -e /run/ostree-booted ]; then if [ "$HARDLINK" != "no" -a -x /usr/bin/hardlink -a ! -e /run/ostree-booted ]; then
(cd /usr/src/kernels/%{_kver} && (cd /usr/src/kernels/%{_kver} &&
/usr/bin/find . -type f | while read f; do /usr/bin/find . -type f | while read f; do
hardlink -c /usr/src/kernels/*%{?dist}.*/$f $f > /dev/null hardlink -c /usr/src/kernels/*%{?dist}.*/$f $f > /dev/null
done; done;
) )
fi fi
%files devel %files devel
%{_devel_dir} %{_devel_dir}
%package devel-matched %package devel-matched
Summary:Meta package to install matching core and devel packages for %{name} Summary: Meta package to install matching core and devel packages for %{name}
Provides: kernel-devel-matched = %{_rpmver} Provides: kernel-devel-matched = %{_rpmver}
Requires: %{name}-core = %{_rpmver} Requires: %{name}-core = %{_rpmver}
Requires: %{name}-devel = %{_rpmver} Requires: %{name}-devel = %{_rpmver}
%description devel-matched %description devel-matched
This meta package is used to install matching core and devel packages for %{name}. This meta package is used to install matching core and devel packages for %{name}.
%files devel-matched %files devel-matched
%if %{_build_nv} %if %{_build_nv}
%package nvidia-open %package nvidia-open
Summary:nvidia-open %{_nv_ver} kernel modules for %{name} Summary: nvidia-open %{_nv_ver} kernel modules for %{name}
Provides: nvidia-kmod >= %{_nv_ver} Provides: nvidia-kmod >= %{_nv_ver}
Provides: installonlypkg(kernel-module) Provides: installonlypkg(kernel-module)
Requires: kernel-uname-r = %{_kver} Requires: kernel-uname-r = %{_kver}
Conflicts: akmod-nvidia Conflicts: akmod-nvidia
Recommends: xorg-x11-drv-nvidia >= %{_nv_ver} Recommends: xorg-x11-drv-nvidia >= %{_nv_ver}
%description nvidia-open %description nvidia-open
This package provides nvidia-open %{_nv_ver} kernel modules for %{name}. This package provides nvidia-open %{_nv_ver} kernel modules for %{name}.
%post nvidia-open %post nvidia-open
/sbin/depmod -a %{_kver} /sbin/depmod -a %{_kver}
%files nvidia-open %files nvidia-open
%license %{_defaultlicensedir}/%{name}-nvidia-open/COPYING %license %{_defaultlicensedir}/%{name}-nvidia-open/COPYING
%{_kernel_dir}/nvidia %{_kernel_dir}/nvidia
%endif %endif
%files %files