nvidia-open-kmod/nvidia-open-kmod.spec

117 lines
3.5 KiB
RPMSpec

# Backport missing architecture macros
%{!?x86_64: %global x86_64 x86_64 amd64 em64t}
%{!?arm64: %global arm64 aarch64}
# Because Red Hat broke this macro by not including kernel-rpm-macros in the base buildroot
%{!?kernel_module_package_buildreqs:%global kernel_module_package_buildreqs kernel-devel kernel-abi-stablelists redhat-rpm-config kernel-rpm-macros elfutils-libelf-devel kmod}
# Don't enable auto set build flags
# We get flags from the kernel
%undefine _auto_set_build_flags
# Kernel package flavors
## TODO: Fix kernel packaging macros to handle debug kernel flavor builds
%dnl %global kernel_extra_flavor_devel_packages kernel-debug-devel
%ifarch %{arm64}
%dnl %global kernel_extra_flavor_devel_packages %{?kernel_extra_flavor_devel_packages} kernel-64k-devel kernel-64k-debug-devel
%global kernel_extra_flavor_devel_packages %{?kernel_extra_flavor_devel_packages} kernel-64k-devel
%endif
%global kmodname nvidia-open
Name: %{kmodname}-kmod
Version: 570.153.02
Release: 2%{?dist}
Summary: Kernel module (kmod) for NVIDIA GPU hardware
License: GPL-2.0-only and MIT
URL: https://github.com/NVIDIA/open-gpu-kernel-modules
Source0: %{url}/archive/%{version}/open-gpu-kernel-modules-%{version}.tar.gz
Patch0: 0001-kernel-open-nvidia-drm-Enable-kernel-mode-setting-by.patch
# For kmodtool
Source10: kmod-%{kmodname}.spec.preamble
# For locally fixed macros to handle kernel flavors properly
Source20: kmp-local-override.macros
Source21: kmodtool-local-override
# patch dependencies
BuildRequires: git-core
# kernel module package macros were split out sometime after EL7...
BuildRequires: kernel-rpm-macros
# kmod dependencies
BuildRequires: %kernel_module_package_buildreqs
%{?kernel_extra_flavor_devel_packages:BuildRequires: %kernel_extra_flavor_devel_packages}
BuildRequires: %{_bindir}/envsubst
BuildRequires: gcc
BuildRequires: gcc-c++
BuildRequires: make
# Depend on negativo17 kmod support packaging
Requires: nvidia-kmod-common = 3:%{version}
# Only supported architectures for the driver
ExclusiveArch: %{x86_64} %{arm64}
# Load override macros
%{load:%{S:20}}
%{?kernel_module_package:%kernel_module_package -s %{S:21} -n %{kmodname} -p %{S:10}}
%description
This package contains the kernel modules for providing
hardware support for the NVIDIA Turing (GTX 16/RTX 20)
and newer models of GPU hardware.
%prep
%autosetup -n open-gpu-kernel-modules-%{version} -S git_am
for flavor in %{flavors_to_build}; do
cp -a ../open-gpu-kernel-modules-%{version} ../%{name}-%{version}-kmodbuild-$flavor
mv ../%{name}-%{version}-kmodbuild-$flavor .
done
%build
# This module is useless
export NV_EXCLUDE_KERNEL_MODULES=nvidia-peermem
for flavor in %{flavors_to_build}; do
pushd %{name}-%{version}-kmodbuild-$flavor
export SYSSRC=%{kernel_source $flavor}
%make_build modules
popd
done
%install
# Set correct install paths
export INSTALL_MOD_PATH=%{buildroot}
export INSTALL_MOD_DIR=extra/%{kmodname}
# This module is useless
export NV_EXCLUDE_KERNEL_MODULES=nvidia-peermem
for flavor in %{flavors_to_build}; do
pushd %{name}-%{version}-kmodbuild-$flavor
export SYSSRC=%{kernel_source $flavor}
%{__make} V=1 modules_install
popd
done
%files
%license COPYING
%doc README.md
%changelog
* Fri May 30 2025 Jonathan Wright <jonathan@almalinux.org> - 570.153.02-2
- Update BR envsubst for EL9 compatibility
* Mon May 26 2025 Neal Gompa <ngompa@almalinux.org> - 570.153.02-1
- Initial package