Skip to content

NVIDIA/yum-packaging-dkms-nvidia

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

yum packaging dkms nvidia

License Contributing

Overview

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.

Table of Contents

Deliverables

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 in 460.32.03

  • RHEL8 or Fedora streams: latest-dkms and XXX-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 and XXX-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 and XXX

    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

Prerequisites

Clone this git repository:

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

Install build dependencies

# Packaging
yum install rpm-build dkms

# Optional: compile open kernel modules from source
yum install g++

Building with script

Fetch script from main branch

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

Usage

./build.sh path/to/*.run
> ex: time ./build.sh ~/Downloads/NVIDIA-Linux-x86_64-450.102.04.run

Building Manually (legacy modules)

Generate tarball from runfile

note: architecture is x86_64, ppc64le, or aarch64 (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}

Packaging (dnf distros)

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

Packaging (yum distros)

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 and kmod-nvidia-latest packages see yum-packaging-precompiled-kmod

Building Manually (open modules)

Generate input

note: architecture is x86_64, or aarch64 (sbsa)

Use runfile

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

Use NVIDIA-kernel-module-source tarball

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}

Packaging (open modules)

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

Related

Precompiled kernel modules

NVIDIA driver

NVIDIA kmod common

NVIDIA modprobe

NVIDIA persistenced

NVIDIA plugin

NVIDIA settings

NVIDIA xconfig

Contributing

See CONTRIBUTING.md

Releases

No releases published

Packages

No packages published

Languages