Skip to content

NVIDIA/yum-packaging-nvidia-driver

Repository files navigation

yum packaging nvidia driver

License Contributing

Overview

Packaging templates for yum and dnf based Linux distros to build NVIDIA driver packages.

The main branch contains this README. The .spec, .conf, and .sh files can be found in the rhel7, rhel8, and fedora virtual branches.

note: Virtual branches point to the highest available driver branch. Please use the appropriate XXX-rhel7 (RHEL7-like) or XXX (Fedora/RHEL8-like) git branch to package older driver major versions.

Table of Contents

Deliverables

This repo contains the .spec file used to build the following RPM packages:

note: XXX is the first . delimited field in the driver version, ex: 460 in 460.32.03

  • RHEL8 or Fedora streams: XXX, XXX-dkms, latest, and latest-dkms
- nvidia-driver
- nvidia-driver-cuda
- nvidia-driver-cuda-libs
- nvidia-driver-devel
- nvidia-driver-libs
- nvidia-driver-NvFBCOpenGL
- nvidia-driver-NVML

For RHEL7 and derivatives, there are three sets of packages with different package dependencies.

The latest and latest-dkms flavors always update to the highest versioned driver, while the branch-XXX flavor locks driver updates to the specified driver branch.

  • RHEL7 flavor: latest-dkms
- nvidia-driver-latest-dkms
- nvidia-driver-latest-dkms-cuda
- nvidia-driver-latest-dkms-cuda-libs
- nvidia-driver-latest-dkms-devel
- nvidia-driver-latest-dkms-libs
- nvidia-driver-latest-dkms-NvFBCOpenGL
- nvidia-driver-latest-dkms-NVML

note: XXX-dkms is not supported for RHEL7

To use the precompiled flavors latest and branch-XXX, use yum-packaging-precompiled-kmod to build kmod-nvidia-latest or kmod-nvidia-branch-XXX kernel modules for a specific kernel and driver combination.

  • RHEL7 flavor: latest
- nvidia-driver-latest
- nvidia-driver-latest-cuda
- nvidia-driver-latest-cuda-libs
- nvidia-driver-latest-devel
- nvidia-driver-latest-libs
- nvidia-driver-latest-NvFBCOpenGL
- nvidia-driver-latest-NVML
  • RHEL7 flavor: branch-XXX
- nvidia-driver-branch-XXX
- nvidia-driver-branch-XXX-cuda
- nvidia-driver-branch-XXX-cuda-libs
- nvidia-driver-branch-XXX-devel
- nvidia-driver-branch-XXX-libs
- nvidia-driver-branch-XXX-NvFBCOpenGL
- nvidia-driver-branch-XXX-NVML

Packaging Guide

note: this guide covers building all of the yum-packaging NVIDIA driver packages. To build only the deliverables in this repository, see Prerequisites and Building Manually sections.

RHEL8 and Fedora-derivatives

RHEL7-derivatives

Demo

RHEL8

Demo-RHEL8

webm asciinema gist

RHEL7

Demo-RHEL7

mp4 asciinema gist

Prerequisites

Clone this git repository:

Virtual branches: rhel7, rhel8 & fedora point to the latest branch Supported branches: XXX-rhel7 (RHEL7-like) and XXX (Fedora/RHEL8-like)

git clone -b ${branch} https://github.com/NVIDIA/yum-packaging-nvidia-driver
> ex: git clone -b 510 https://github.com/NVIDIA/yum-packaging-nvidia-driver
> ex: git clone -b 470-rhel7 https://github.com/NVIDIA/yum-packaging-nvidia-driver

Install build dependencies

# Misc
yum install libappstream-glib
# Packaging
yum install rpm-build

Building with script

Fetch script from main branch

cd yum-packaging-nvidia-driver
git checkout remotes/origin/main -- build.sh

Usage

note: distro is fedora33, rhel7, rhel8

./build.sh path/to/*.run ${distro}
> ex: time ./build.sh ~/Downloads/NVIDIA-Linux-x86_64-460.32.03.run rhel7

Building Manually

Generate tarballs from runfile

version="460.32.03"
export RUN_FILE="/path/to/NVIDIA-Linux-${arch}-${version}.run"
export VERSION="$version"
rm -rf temp
nvidia-generate-tarballs-${arch}.sh
ls *.tar.xz
> nvidia-driver-${version}-${arch}.tar.xz  # x86_64 script does not have -${arch} suffix
> nvidia-driver-${version}-i386.tar.xz     # 32-bit libraries for x86_64 only
> nvidia-kmod-${version}-${arch}.tar.xz    # not used here

Packaging (dnf distros)

note: fedora & rhel8-based distros

mkdir BUILD BUILDROOT RPMS SRPMS SOURCES SPECS
cp *.conf SOURCES/
cp nvidia-driver-${version}-${arch}.tar.xz SOURCES/
cp nvidia-driver.spec SPECS/

rpmbuild \
    --define "%_topdir $(pwd)" \
    --define "debug_package %{nil}" \
    --define "version $version" \
    --define "epoch 3" \
    --target "${arch}" \
    -v -bb SPECS/nvidia-driver.spec

Packaging (yum distros)

note: rhel7-based distros

mkdir BUILD BUILDROOT RPMS SRPMS SOURCES SPECS
cp *.rules SOURCES/
cp *.conf SOURCES/
cp nvidia-driver-${version}-${arch}.tar.xz SOURCES/
cp nvidia-driver.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/nvidia-driver.spec

# latest
rpmbuild \
    --define "%_topdir $(pwd)" \
    --define "debug_package %{nil}" \
    --define "version $version" \
    --define "driver_branch latest" \
    --define "is_dkms 0" \
    --define "is_latest 1" \
    --define "epoch 3" \
    --target "${arch}" \
    -v -bb SPECS/nvidia-driver.spec

# branch-460
rpmbuild \
    --define "%_topdir $(pwd)" \
    --define "debug_package %{nil}" \
    --define "version $version" \
    --define "driver_branch branch-460" \
    --define "is_dkms 0" \
    --define "is_latest 0" \
    --define "epoch 3" \
    --target "${arch}" \
    -v -bb SPECS/nvidia-driver.spec

Related

DKMS nvidia

NVIDIA kmod common

NVIDIA modprobe

NVIDIA persistenced

NVIDIA plugin

NVIDIA precompiled kmod

NVIDIA settings

NVIDIA xconfig

See also

Ubuntu driver

SUSE driver

Contributing

See CONTRIBUTING.md