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:
XXX
is the first.
delimited field in the driver version, ex:460
in460.32.03
-
RHEL8 or Fedora streams:
latest-dkms
andXXX-dkms
kmod-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-dkms
kmod-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
515
and newer:open-dkms
andXXX-open
kmod-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-dkms
is not available for RHEL7
These packages can be used in place of their equivalent pre-compiled packages:
-
RHEL8 or Fedora streams:
latest
andXXX
kmod-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:
latest
kmod-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-XXX
kmod-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.run
note: 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.spec
note:
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.spec
note: to build
kmod-nvidia-branch-XXX
andkmod-nvidia-latest
packages 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 modules
Copy .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_binary
Create 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-modprobe
- nvidia-persistenced
- dnf-plugin-nvidia & yum-plugin-nvidia
- nvidia-settings
- nvidia-xconfig
See CONTRIBUTING.md