Skip to content

Commit

Permalink
add open nvidia driver support for ubuntu
Browse files Browse the repository at this point in the history
  • Loading branch information
shivakunv committed Jul 5, 2024
1 parent ac7eb3e commit 251f23a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
4 changes: 3 additions & 1 deletion ubuntu22.04/precompiled/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends nvidia-driver-$
# avoid cleaning the cache after this to retain these packages during runtime.
RUN apt-get update && apt-get install --download-only --no-install-recommends -y linux-objects-nvidia-${DRIVER_BRANCH}-server-${KERNEL_VERSION} \
linux-signatures-nvidia-${KERNEL_VERSION} \
linux-modules-nvidia-${DRIVER_BRANCH}-server-${KERNEL_VERSION}
linux-modules-nvidia-${DRIVER_BRANCH}-server-${KERNEL_VERSION} \
# add support for nvidia open source driver packages during runtime
linux-modules-nvidia-${DRIVER_BRANCH}-server-open-${KERNEL_VERSION}

COPY nvidia-driver /usr/local/bin

Expand Down
17 changes: 13 additions & 4 deletions ubuntu22.04/precompiled/nvidia-driver
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
set -eu

KERNEL_VERSION=$(uname -r)
OPEN_KERNEL_MODULES_ENABLED="${OPEN_KERNEL_MODULES_ENABLED:-false}"
RUN_DIR=/run/nvidia
PID_FILE=${RUN_DIR}/${0##*/}.pid
DRIVER_BRANCH=${DRIVER_BRANCH:?"Missing driver version"}
Expand Down Expand Up @@ -210,10 +211,18 @@ _unload_driver() {

# Link and install the kernel modules from a precompiled packages
_install_driver() {
echo "Installing NVIDIA driver kernel modules..."
apt-get install --no-install-recommends -y linux-objects-nvidia-${DRIVER_BRANCH}-server-${KERNEL_VERSION} \
linux-signatures-nvidia-${KERNEL_VERSION} \
linux-modules-nvidia-${DRIVER_BRANCH}-server-${KERNEL_VERSION}
if [ "$OPEN_KERNEL_MODULES_ENABLED" = true ]; then
echo "Installing Open NVIDIA driver kernel modules..."
apt-get install --no-install-recommends -y \
linux-signatures-nvidia-${KERNEL_VERSION} \
linux-modules-nvidia-${DRIVER_BRANCH}-server-open-${KERNEL_VERSION}
else
echo "Installing Closed NVIDIA driver kernel modules..."
apt-get install --no-install-recommends -y \
linux-objects-nvidia-${DRIVER_BRANCH}-server-${KERNEL_VERSION} \
linux-signatures-nvidia-${KERNEL_VERSION} \
linux-modules-nvidia-${DRIVER_BRANCH}-server-${KERNEL_VERSION}
fi
}

# Mount the driver rootfs into the run directory with the exception of sysfs.
Expand Down

0 comments on commit 251f23a

Please sign in to comment.