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