Skip to content

Commit 8f74fc9

Browse files
Shiva Kumarshivakunv
authored andcommitted
Support Data Center precompiled driver container for Arm (Ubuntu 24.04)
Signed-off-by: Shiva Kumar (SW-CLOUD) <shivaku@nvidia.com>
1 parent e2eef7b commit 8f74fc9

10 files changed

Lines changed: 166 additions & 104 deletions

File tree

.github/precompiled-matrix-config.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
"kernel_flavors": ["aws", "azure", "azure-fde", "generic", "nvidia", "oracle"],
44
"dist": ["ubuntu22.04", "ubuntu24.04"],
55
"lts_kernel": ["5.15", "6.8"],
6+
"platforms": ["amd64", "arm64"],
67
"exclude_build_matrix_pairs": [
7-
{ "dist": "ubuntu24.04", "driver_branch": "535" }
8+
{ "dist": "ubuntu24.04", "driver_branch": "535" },
9+
{ "dist": "ubuntu24.04", "driver_branch": "570" }
810
],
911
"exclude_precompiled_build_matrix": [
1012
{ "dist": "ubuntu24.04", "driver_branch": "535" },

.github/workflows/image.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,5 +205,11 @@ jobs:
205205
PRECOMPILED: "true"
206206
DIST: signed_${{ matrix.dist }}
207207
run: |
208-
source kernel_version.txt && \
208+
source kernel_version.txt
209+
# arm64 does not support azure-fde (package linux-objects-nvidia-*-azure-fde not available for arm64)
210+
if [[ "${{ matrix.dist }}" == "ubuntu24.04" ]] && [[ "${{ matrix.flavor }}" != "azure-fde" ]]; then
211+
export DOCKER_BUILD_PLATFORM_OPTIONS="--platform=linux/amd64,linux/arm64"
212+
else
213+
export DOCKER_BUILD_PLATFORM_OPTIONS="--platform=linux/amd64"
214+
fi
209215
make DRIVER_VERSIONS=${DRIVER_VERSIONS} DRIVER_BRANCH=${{ matrix.driver }} build-${DIST}-${DRIVER_VERSION}

.github/workflows/precompiled.yaml

Lines changed: 94 additions & 67 deletions
Large diffs are not rendered by default.

Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,12 +151,13 @@ build-%: DOCKERFILE = $(CURDIR)/$(SUBDIR)/Dockerfile
151151
# build-ubuntu22.04-$(DRIVER_VERSION) triggers a build for a specific $(DRIVER_VERSION)
152152
$(DISTRIBUTIONS): %: build-%
153153
$(BUILD_TARGETS): %: $(foreach driver_version, $(DRIVER_VERSIONS), $(addprefix %-, $(driver_version)))
154+
DRIVER_BUILD_TAG = $(if $(findstring type=oci,$(DOCKER_BUILD_OPTIONS)),,--tag $(IMAGE))
154155
$(DRIVER_BUILD_TARGETS):
155156
DOCKER_BUILDKIT=1 \
156157
$(DOCKER) $(BUILDX) build --pull \
157158
$(DOCKER_BUILD_OPTIONS) \
158159
$(DOCKER_BUILD_PLATFORM_OPTIONS) \
159-
--tag $(IMAGE) \
160+
$(DRIVER_BUILD_TAG) \
160161
--build-arg DRIVER_VERSION="$(DRIVER_VERSION)" \
161162
--build-arg GOLANG_VERSION="$(GOLANG_VERSION)" \
162163
--build-arg DRIVER_BRANCH="$(DRIVER_BRANCH)" \
@@ -202,6 +203,7 @@ $(BASE_BUILD_TARGETS):
202203
DOCKER_BUILDKIT=1 \
203204
$(DOCKER) $(BUILDX) build --pull --no-cache \
204205
$(DOCKER_BUILD_OPTIONS) \
206+
$(DOCKER_BUILD_PLATFORM_OPTIONS) \
205207
--tag $(IMAGE) \
206208
--target $(TARGET) \
207209
--build-arg CUDA_VERSION="$(CUDA_VERSION)" \

multi-arch.mk

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,3 @@ $(DRIVER_PUSH_TARGETS): push-%:
2525

2626
# No multi-arch support for the following distributions
2727
build-signed_ubuntu22.04%: DOCKER_BUILD_PLATFORM_OPTIONS = --platform=linux/amd64
28-
build-signed_ubuntu24.04%: DOCKER_BUILD_PLATFORM_OPTIONS = --platform=linux/amd64
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
get_kernel_versions_to_test() {
2-
if [[ "$#" -ne 4 ]]; then
3-
echo " Error:$0 must be called with KERNEL_FLAVORS DRIVER_BRANCHES DIST LTS_KERNEL" >&2
2+
if [[ "$#" -lt 4 || "$#" -gt 5 ]]; then
3+
echo " Error:$0 must be called with KERNEL_FLAVORS DRIVER_BRANCHES DIST LTS_KERNEL or KERNEL_FLAVORS DRIVER_BRANCHES DIST LTS_KERNEL PLATFORM_SUFFIX" >&2
44
exit 1
55
fi
66

77
local -a KERNEL_FLAVORS=("${!1}")
88
local -a DRIVER_BRANCHES=("${!2}")
99
local DIST="$3"
1010
local LTS_KERNEL="$4"
11-
11+
local PLATFORM_SUFFIX="$5"
1212
kernel_versions=()
1313
for kernel_flavor in "${KERNEL_FLAVORS[@]}"; do
1414
for DRIVER_BRANCH in "${DRIVER_BRANCHES[@]}"; do
15-
source ./tests/scripts/findkernelversion.sh "${kernel_flavor}" "$DRIVER_BRANCH" "$DIST" "$LTS_KERNEL" >&2
15+
source ./tests/scripts/findkernelversion.sh "${kernel_flavor}" "$DRIVER_BRANCH" "$DIST" "$LTS_KERNEL" "$PLATFORM_SUFFIX" >&2
1616
if [[ "$should_continue" == true ]]; then
1717
break
1818
fi
@@ -25,7 +25,7 @@ get_kernel_versions_to_test() {
2525
# Remove duplicates
2626
kernel_versions=($(printf "%s\n" "${kernel_versions[@]}" | sort -u))
2727
for i in "${!kernel_versions[@]}"; do
28-
kernel_versions[$i]="${kernel_versions[$i]}-$DIST"
28+
kernel_versions[$i]="${kernel_versions[$i]}-$DIST$PLATFORM_SUFFIX"
2929
done
3030
echo "${kernel_versions[@]}"
3131
}

tests/scripts/findkernelversion.sh

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
#!/bin/bash
22

3-
if [[ $# -ne 4 ]]; then
4-
echo " KERNEL_FLAVOR DRIVER_BRANCH DIST LTS_KERNEL are required"
3+
if [[ $# -lt 4 || $# -gt 5 ]]; then
4+
echo " KERNEL_FLAVOR DRIVER_BRANCH DIST LTS_KERNEL or KERNEL_FLAVOR DRIVER_BRANCH DIST LTS_KERNEL PLATFORM_SUFFIX are required"
55
exit 1
66
fi
77

88
export KERNEL_FLAVOR="${1}"
99
export DRIVER_BRANCH="${2}"
1010
export DIST="${3}"
1111
export LTS_KERNEL="${4}"
12+
export PLATFORM_SUFFIX="${5}"
1213

1314
export REGCTL_VERSION=v0.7.1
1415
mkdir -p bin
@@ -21,21 +22,21 @@ prefix="kernel-version-${DRIVER_BRANCH}-${LTS_KERNEL}"
2122
suffix="${KERNEL_FLAVOR}-${DIST}"
2223

2324
artifact_dir="./kernel-version-artifacts"
24-
artifact=$(find "$artifact_dir" -maxdepth 1 -type d -name "${prefix}*-${suffix}" | head -1)
25-
if [ -n "$artifact" ]; then
26-
artifact_name=$(basename "$artifact")
27-
if [ -f "$artifact/${artifact_name}.tar" ]; then
28-
tar -xf "$artifact/${artifact_name}.tar" -C ./
29-
export $(grep -oP 'KERNEL_VERSION=[^ ]+' ./kernel_version.txt)
30-
rm -f kernel_version.txt
31-
fi
25+
artifact_file=$(find "$artifact_dir" -maxdepth 1 -type f -name "${prefix}*-${suffix}.tar" | head -1)
26+
if [ -n "$artifact_file" ]; then
27+
tar -xf "$artifact_file" -C ./
28+
export $(grep -oE 'KERNEL_VERSION=[^ ]+' ./kernel_version.txt)
29+
rm -f kernel_version.txt
3230
fi
3331

3432
# calculate driver tag
3533
status_nvcr=0
3634
status_ghcr=0
37-
regctl tag ls nvcr.io/nvidia/driver | grep "^${DRIVER_BRANCH}-${KERNEL_VERSION}-${DIST}$" || status_nvcr=$?
38-
regctl tag ls ghcr.io/nvidia/driver | grep "^${DRIVER_BRANCH}-${KERNEL_VERSION}-${DIST}$" || status_ghcr=$?
35+
PLATFORM=$(echo "${PLATFORM_SUFFIX}" | sed 's/-//')
36+
[ -z "$PLATFORM" ] && PLATFORM=amd64
37+
regctl manifest inspect nvcr.io/nvidia/driver:${DRIVER_BRANCH}-${KERNEL_VERSION}-${DIST} --platform=linux/${PLATFORM} > /dev/null 2>&1; status_nvcr=$?
38+
regctl manifest inspect ghcr.io/nvidia/driver:${DRIVER_BRANCH}-${KERNEL_VERSION}-${DIST} --platform=linux/${PLATFORM} > /dev/null 2>&1; status_ghcr=$?
39+
3940
if [[ $status_nvcr -eq 0 || $status_ghcr -eq 0 ]]; then
4041
export should_continue=false
4142
else

ubuntu24.04/precompiled/Dockerfile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ ENV NVIDIA_VISIBLE_DEVICES=void
1818

1919
RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
2020

21-
RUN dpkg --add-architecture i386 && \
21+
# Add i386 architecture only for amd64 builds (not available on ARM)
22+
RUN if [ "$TARGETARCH" = "amd64" ]; then dpkg --add-architecture i386; fi && \
2223
apt-get update && apt-get install -y --no-install-recommends \
2324
apt-utils \
2425
build-essential \
@@ -31,9 +32,10 @@ RUN dpkg --add-architecture i386 && \
3132
pkg-config && \
3233
rm -rf /var/lib/apt/lists/*
3334

34-
# Fetch GPG keys for CUDA repo
35-
RUN rm -f /etc/apt/sources.list.d/cuda* && \
36-
curl -fsSL https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2404/x86_64/cuda-keyring_1.1-1_all.deb -o cuda-keyring_1.1-1_all.deb && \
35+
# Fetch GPG keys for CUDA repo (architecture-specific)
36+
RUN CUDA_ARCH=$([ "$TARGETARCH" = "arm64" ] && echo "sbsa" || echo "x86_64") && \
37+
rm -f /etc/apt/sources.list.d/cuda* && \
38+
curl -fsSL https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2404/${CUDA_ARCH}/cuda-keyring_1.1-1_all.deb -o cuda-keyring_1.1-1_all.deb && \
3739
dpkg -i cuda-keyring_1.1-1_all.deb && \
3840
rm -f cuda-keyring_1.1-1_all.deb
3941

ubuntu24.04/precompiled/local-repo.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,23 @@ download_driver_package_deps () {
6868
pushd ${LOCAL_REPO_DIR}
6969

7070
download_apt_with_dep linux-objects-nvidia-${DRIVER_BRANCH}-server-${KERNEL_VERSION}
71-
download_apt_with_dep linux-signatures-nvidia-${KERNEL_VERSION}
71+
72+
# linux-signatures-nvidia (secure boot signatures) is not available for arm64
73+
if [ "$TARGETARCH" = "amd64" ]; then
74+
download_apt_with_dep linux-signatures-nvidia-${KERNEL_VERSION}
75+
fi
76+
7277
download_apt_with_dep linux-modules-nvidia-${DRIVER_BRANCH}-server-${KERNEL_VERSION}
7378
download_apt_with_dep linux-modules-nvidia-${DRIVER_BRANCH}-server-open-${KERNEL_VERSION}
7479
download_apt_with_dep nvidia-utils-${DRIVER_BRANCH}-server
7580
download_apt_with_dep nvidia-headless-no-dkms-${DRIVER_BRANCH}-server
7681
download_apt_with_dep libnvidia-decode-${DRIVER_BRANCH}-server
7782
download_apt_with_dep libnvidia-extra-${DRIVER_BRANCH}-server
7883
download_apt_with_dep libnvidia-encode-${DRIVER_BRANCH}-server
79-
download_apt_with_dep libnvidia-fbc1-${DRIVER_BRANCH}-server
84+
# libnvidia-fbc1 (FrameBuffer Capture) is not available for arm64
85+
if [ "$TARGETARCH" = "amd64" ]; then
86+
download_apt_with_dep libnvidia-fbc1-${DRIVER_BRANCH}-server
87+
fi
8088
download_apt_with_dep libnvidia-gl-${DRIVER_BRANCH}-server
8189

8290
fabricmanager_download

ubuntu24.04/precompiled/nvidia-driver

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -416,22 +416,37 @@ _install_driver() {
416416
nvidia-headless-no-dkms-${DRIVER_BRANCH}-server \
417417
libnvidia-decode-${DRIVER_BRANCH}-server \
418418
libnvidia-extra-${DRIVER_BRANCH}-server \
419-
libnvidia-encode-${DRIVER_BRANCH}-server \
420-
libnvidia-fbc1-${DRIVER_BRANCH}-server \
421-
libnvidia-gl-${DRIVER_BRANCH}-server
419+
libnvidia-encode-${DRIVER_BRANCH}-server
420+
# libnvidia-fbc1 (FrameBuffer Capture) is not available for arm64
421+
if [ "$TARGETARCH" = "amd64" ]; then
422+
apt-get install -y --no-install-recommends libnvidia-fbc1-${DRIVER_BRANCH}-server
423+
fi
424+
apt-get install -y --no-install-recommends libnvidia-gl-${DRIVER_BRANCH}-server
422425

423426
# Now install the precompiled kernel module packages signed by Canonical
427+
# linux-signatures-nvidia (secure boot signatures) is not available for arm64
424428
if [ "$KERNEL_TYPE" = "kernel-open" ]; then
425429
echo "Installing Open NVIDIA driver kernel modules..."
426-
apt-get install --no-install-recommends -y \
427-
linux-signatures-nvidia-${KERNEL_VERSION} \
428-
linux-modules-nvidia-${DRIVER_BRANCH}-server-open-${KERNEL_VERSION}
430+
if [ "$TARGETARCH" = "amd64" ]; then
431+
apt-get install --no-install-recommends -y \
432+
linux-signatures-nvidia-${KERNEL_VERSION} \
433+
linux-modules-nvidia-${DRIVER_BRANCH}-server-open-${KERNEL_VERSION}
434+
else
435+
apt-get install --no-install-recommends -y \
436+
linux-modules-nvidia-${DRIVER_BRANCH}-server-open-${KERNEL_VERSION}
437+
fi
429438
else
430439
echo "Installing Closed NVIDIA driver kernel modules..."
431-
apt-get install --no-install-recommends -y \
432-
linux-objects-nvidia-${DRIVER_BRANCH}-server-${KERNEL_VERSION} \
433-
linux-signatures-nvidia-${KERNEL_VERSION} \
434-
linux-modules-nvidia-${DRIVER_BRANCH}-server-${KERNEL_VERSION}
440+
if [ "$TARGETARCH" = "amd64" ]; then
441+
apt-get install --no-install-recommends -y \
442+
linux-objects-nvidia-${DRIVER_BRANCH}-server-${KERNEL_VERSION} \
443+
linux-signatures-nvidia-${KERNEL_VERSION} \
444+
linux-modules-nvidia-${DRIVER_BRANCH}-server-${KERNEL_VERSION}
445+
else
446+
apt-get install --no-install-recommends -y \
447+
linux-objects-nvidia-${DRIVER_BRANCH}-server-${KERNEL_VERSION} \
448+
linux-modules-nvidia-${DRIVER_BRANCH}-server-${KERNEL_VERSION}
449+
fi
435450
fi
436451
}
437452

0 commit comments

Comments
 (0)