Packaging templates using DKMS on yum and dnf based Linux distros to manage NVIDIA driver kernel module compilation.
For pre-compiled packaging see: yum-packaging-precompiled-kmod
The main branch contains this README and a sample build script. The .spec and .conf files can be found in the appropriate rhel7, rhel8, and fedora branches.
This repo contains the .spec file(s) used to build the following RPM packages:
note:
XXXis the first.delimited field in the driver version, ex:460in460.32.03
-
RHEL8 or Fedora streams:
latest-dkmsandXXX-dkmskmod-nvidia-latest-dkms-${version}-${rel}.${dist}.${arch}.rpm > ex: kmod-nvidia-latest-dkms-460.32.03-1.el8.x86_64.rpm > ex: kmod-nvidia-latest-dkms-460.27.04-1.fc33.x86_64.rpm
-
RHEL7 flavor:
latest-dkmskmod-nvidia-latest-dkms-${version}-${rel}.${dist}.${arch}.rpm > ex: kmod-nvidia-latest-dkms-460.32.03-1.el7.x86_64.rpm
-
Open GPU Kernel Modules streams available in
515and newer:open-dkmsandXXX-openkmod-nvidia-open-dkms-${version}-${rel}.${dist}.${arch}.rpm > ex: kmod-nvidia-open-dkms-515.48.07-1.el9.x86_64.rpm > ex: kmod-nvidia-open-dkms-515.43.04-1.fc35.x86_64.rpm
The latest and latest-dkms streams/flavors always update to the highest versioned driver, while the XXX and XXX-dkms streams/flavors lock driver updates to the specified driver branch.
note:
XXX-dkmsis not available for RHEL7
These packages can be used in place of their equivalent pre-compiled packages:
-
RHEL8 or Fedora streams:
latestandXXXkmod-nvidia-${driver}-${kernel}-${driver}-${rel}.${dist}.${arch}.rpm > ex: kmod-nvidia-460.32.03-4.18.0-240.15.1-460.32.03-3.el8_3.x86_64.rpm
-
RHEL7 flavor:
latestkmod-nvidia-latest-${kernel}.r${driver}.${dist}.${arch}.rpm > ex: kmod-nvidia-latest-3.10.0-1160.15.2.r460.32.03.el7.x86_64.rpm
-
RHEL7 flavor:
branch-XXXkmod-nvidia-branch-XXX-${kernel}.r${driver}.${dist}.${arch}.rpm > ex: kmod-nvidia-branch-460-3.10.0-1160.r460.32.03.el7.x86_64.rpm
Supported branches: rhel7, rhel8 & fedora
git clone -b ${branch} https://github.com/NVIDIA/yum-packaging-dkms-nvidia
> ex: git clone -b rhel8 https://github.com/NVIDIA/yum-packaging-dkms-nvidia# Packaging
yum install rpm-build dkms
# Optional: compile open kernel modules from source
yum install g++cd yum-packaging-dkms-nvidia
git checkout remotes/origin/main -- build.sh./build.sh path/to/*.run
> ex: time ./build.sh ~/Downloads/NVIDIA-Linux-x86_64-450.102.04.runnote: architecture is
x86_64,ppc64le, oraarch64(sbsa)
version="450.102.04"
sh NVIDIA-Linux-${arch}-${version}.run --extract-only --target extract
mkdir nvidia-kmod-${version}-${arch}
mv extract/kernel nvidia-kmod-${version}-${arch}/
tar -cJf nvidia-kmod-${version}-${arch}.tar.xz nvidia-kmod-${version}-${arch}note:
fedora&rhel8-based distros
mkdir BUILD BUILDROOT RPMS SRPMS SOURCES SPECS
cp dkms-nvidia.conf SOURCES/
cp nvidia-kmod-${version}-${arch}.tar.xz SOURCES/
cp dkms-nvidia.spec SPECS/
rpmbuild \
--define "%_topdir $(pwd)" \
--define "debug_package %{nil}" \
--define "version $version" \
--define "epoch 3" \
--target "${arch}" \
-v -bb SPECS/dkms-nvidia.specnote:
rhel7-based distros
mkdir BUILD BUILDROOT RPMS SRPMS SOURCES SPECS
cp dkms-nvidia.conf SOURCES/
cp nvidia-kmod-${version}-${arch}.tar.xz SOURCES/
cp dkms-nvidia.spec SPECS/
# latest-dkms
rpmbuild \
--define "%_topdir $(pwd)" \
--define "debug_package %{nil}" \
--define "version $version" \
--define "driver_branch latest-dkms" \
--define "is_dkms 1" \
--define "is_latest 1" \
--define "epoch 3" \
--target "${arch}" \
-v -bb SPECS/dkms-nvidia.specnote: to build
kmod-nvidia-branch-XXXandkmod-nvidia-latestpackages see yum-packaging-precompiled-kmod
note: architecture is
x86_64, oraarch64(sbsa)
This method uses pre-build nvidia.o and nvidia-drm.o modules included with the NVIDIA driver runfile
version="515.48.07"
sh NVIDIA-Linux-${arch}-${version}.run --extract-only --target extract
mkdir nvidia-open-kmod-${version}-${arch}
mv extract/kernel-open nvidia-open-kmod-${version}-${arch}/
tar -cJf nvidia-open-kmod-${version}-${arch}.tar.xz nvidia-open-kmod-${version}-${arch}or
This method builds nvidia.o and nvidia-drm.o modules from NVIDIA-kernel-module-source*.tar.xz
Compile from source code
version="515.48.07"
tar -xf NVIDIA-kernel-module-source-${version}.tar.xz
cd NVIDIA-kernel-module-source-${version}
make -j6 modulesCopy .o modules to expected location (work-in-progress)
rm -f kernel-open/nvidia/nv-kernel.o_binary &&
cp -av src/nvidia/_out/Linux_${arch}/nv-kernel.o kernel-open/nvidia/nv-kernel.o_binary
rm -f kernel-open/nvidia-modeset/nv-modeset-kernel.o_binary &&
cp -av src/nvidia-modeset/_out/Linux_${arch}/nv-modeset-kernel.o kernel-open/nvidia-modeset/nv-modeset-kernel.o_binaryCreate input tarball
cd ..
mkdir nvidia-open-kmod-${version}-${arch}
mv NVIDIA-kernel-module-source-${version}/kernel-open nvidia-open-kmod-${version}-${arch}/
tar -cJf nvidia-open-kmod-${version}-${arch}.tar.xz nvidia-open-kmod-${version}-${arch}
mkdir BUILD BUILDROOT RPMS SRPMS SOURCES SPECS
cp dkms-nvidia.conf SOURCES/
cp nvidia-open-kmod-${version}-${arch}.tar.xz SOURCES/
cp NVIDIA-kernel-module-source-${version}.tar.xz SOURCES/
cp dkms-open-nvidia.spec SPECS/
rpmbuild \
--define "%_topdir $(pwd)" \
--define "debug_package %{nil}" \
--define "version $version" \
--define "epoch 3" \
--target "${arch}" \
-v -bb SPECS/dkms-open-nvidia.spec- Alternative to DKMS
- nvidia-driver
- nvidia-modprobe
- nvidia-persistenced
- dnf-plugin-nvidia & yum-plugin-nvidia
- nvidia-settings
- nvidia-xconfig
See CONTRIBUTING.md