From 6db611566191ab1d1edcdd87bfc9b24246602d24 Mon Sep 17 00:00:00 2001 From: Shiva Kumar Date: Mon, 20 Jul 2026 14:35:09 +0530 Subject: [PATCH] [precompiled]: Add support for nvidia-64k precompiled driver container Signed-off-by: Shiva Kumar (SW-CLOUD) --- .common-ci.yml | 2 +- .github/precompiled-matrix-config.json | 7 +++++-- .github/workflows/precompiled.yaml | 9 +++++++- base/Dockerfile | 19 ++++++++++++----- base/generate-ci-config | 7 ++++++- multi-arch.mk | 6 ++++-- scripts/precompiled.sh | 29 +++++++++++++++++++------- tests/scripts/build-kernel-matrix.sh | 8 ++++++- 8 files changed, 67 insertions(+), 20 deletions(-) diff --git a/.common-ci.yml b/.common-ci.yml index 8d787e2dd..4940b1935 100644 --- a/.common-ci.yml +++ b/.common-ci.yml @@ -112,7 +112,7 @@ trigger-pipeline: parallel: matrix: - DRIVER_BRANCH: [580, 595] - KERNEL_FLAVOR: [aws, azure, azure-fde, generic, nvidia, oracle] + KERNEL_FLAVOR: [aws, azure, azure-fde, generic, nvidia, nvidia-64k, oracle] LTS_KERNEL: ["6.8"] # Define the matrix of precompiled jobs that can be run in parallel for ubuntu26.04 diff --git a/.github/precompiled-matrix-config.json b/.github/precompiled-matrix-config.json index 8d7223aa6..d244d6c76 100644 --- a/.github/precompiled-matrix-config.json +++ b/.github/precompiled-matrix-config.json @@ -1,6 +1,6 @@ { "driver_branch": ["580", "595"], - "kernel_flavors": ["aws", "azure", "azure-fde", "generic", "nvidia", "oracle"], + "kernel_flavors": ["aws", "azure", "azure-fde", "generic", "nvidia", "nvidia-64k", "oracle"], "dist": ["ubuntu22.04", "ubuntu24.04", "ubuntu26.04"], "lts_kernel": ["5.15", "6.8", "7.0"], "platforms": ["amd64", "arm64"], @@ -14,7 +14,10 @@ { "lts_kernel": "5.15", "dist": "ubuntu26.04" }, { "lts_kernel": "6.8", "dist": "ubuntu26.04" }, { "lts_kernel": "7.0", "dist": "ubuntu22.04" }, - { "flavor": "azure-fde", "dist": "ubuntu22.04" } + { "flavor": "azure-fde", "dist": "ubuntu22.04" }, + { "flavor": "nvidia-64k", "dist": "ubuntu22.04" }, + { "flavor": "nvidia-64k", "dist": "ubuntu26.04" }, + { "flavor": "nvidia-64k", "lts_kernel": "5.15" } ], "exclude_precompiled_e2e_matrix": [ { "lts_kernel": "5.15", "dist": "ubuntu24.04" }, diff --git a/.github/workflows/precompiled.yaml b/.github/workflows/precompiled.yaml index d2dea1c81..d07f77deb 100644 --- a/.github/workflows/precompiled.yaml +++ b/.github/workflows/precompiled.yaml @@ -109,7 +109,14 @@ jobs: BASE_TARGET="resolute" fi # kernel version is the same for amd64 and arm64, so base image is always built for amd64 - export DOCKER_BUILD_PLATFORM_OPTIONS="--platform=linux/amd64" + # nvidia-64k is arm64-only, so its base image must be built for arm64 + if [[ "${{ matrix.flavor }}" == "nvidia-64k" ]]; then + export DOCKER_BUILD_PLATFORM_OPTIONS="--platform=linux/arm64" + # --load is required for cross-platform builds so docker run can find the image locally for different host architectures(amd64) + export DOCKER_BUILD_OPTIONS="--load --provenance=false --sbom=false" + else + export DOCKER_BUILD_PLATFORM_OPTIONS="--platform=linux/amd64" + fi make DRIVER_BRANCH=${{ matrix.driver_branch }} KERNEL_FLAVOR=${{ matrix.flavor }} LTS_KERNEL=${LTS_KERNEL} build-base-${BASE_TARGET} trap "docker rm -f base-${BASE_TARGET}-${{ matrix.flavor }}" EXIT diff --git a/base/Dockerfile b/base/Dockerfile index 3ac3becd9..5475b45d0 100644 --- a/base/Dockerfile +++ b/base/Dockerfile @@ -54,11 +54,20 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ apt-utils git curl && \ rm -rf /var/lib/apt/lists/* -RUN echo "deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ noble main universe" > /etc/apt/sources.list && \ - echo "deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ noble-updates main universe" >> /etc/apt/sources.list && \ - echo "deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ noble-security main universe" >> /etc/apt/sources.list && \ - echo "deb [arch=amd64] http://us.archive.ubuntu.com/ubuntu noble-updates main restricted" >> /etc/apt/sources.list && \ - echo "deb [arch=amd64] http://us.archive.ubuntu.com/ubuntu noble-security main restricted" >> /etc/apt/sources.list && \ +RUN ARCH=$(dpkg --print-architecture) && \ + # kernel version is the same for amd64 and arm64, so base image is always built for amd64 ( non-nvidia-64k) + # for nvidia-64k is arm64-only, so its base image must be built for arm64 + if [ "$ARCH" = "arm64" ]; then \ + echo "deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ noble main universe" > /etc/apt/sources.list && \ + echo "deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ noble-updates main universe" >> /etc/apt/sources.list && \ + echo "deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ noble-security main universe" >> /etc/apt/sources.list; \ + else \ + echo "deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ noble main universe" > /etc/apt/sources.list && \ + echo "deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ noble-updates main universe" >> /etc/apt/sources.list && \ + echo "deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ noble-security main universe" >> /etc/apt/sources.list && \ + echo "deb [arch=amd64] http://us.archive.ubuntu.com/ubuntu noble-updates main restricted" >> /etc/apt/sources.list && \ + echo "deb [arch=amd64] http://us.archive.ubuntu.com/ubuntu noble-security main restricted" >> /etc/apt/sources.list; \ + fi && \ usermod -o -u 0 -g 0 _apt COPY generate-ci-config /usr/local/bin/generate-ci-config diff --git a/base/generate-ci-config b/base/generate-ci-config index 75fa77135..42b661657 100755 --- a/base/generate-ci-config +++ b/base/generate-ci-config @@ -26,7 +26,12 @@ DRIVER_VERSION=$(apt-cache show nvidia-utils-${DRIVER_BRANCH}-server |grep Versi # Get the latest kernel from linux-signatures-list and linux-images-list # As list is already sorted , compare the kernel version and find exact match # get the latest kernel version with tail -SK=$(grep -Fxf <(echo "$SUPPORTED_KERNELS_LINUX_SIGNATURES_LIST") <(echo "$SUPPORTED_KERNELS_LINUX_IMAGE_LIST") | tail -n1) +# linux-signatures-nvidia is not available for arm64 (e.g. nvidia-64k flavor); fall back to linux-image list only +if [ -n "$SUPPORTED_KERNELS_LINUX_SIGNATURES_LIST" ]; then + SK=$(grep -Fxf <(echo "$SUPPORTED_KERNELS_LINUX_SIGNATURES_LIST") <(echo "$SUPPORTED_KERNELS_LINUX_IMAGE_LIST") | tail -n1) +else + SK=$(echo "$SUPPORTED_KERNELS_LINUX_IMAGE_LIST" | tail -n1) +fi # Write to file echo "export KERNEL_VERSION=$SK DRIVER_VERSION=$DRIVER_VERSION DRIVER_VERSIONS=$DRIVER_VERSION" > /var/kernel_version.txt diff --git a/multi-arch.mk b/multi-arch.mk index be26f5a1c..4e32a5318 100644 --- a/multi-arch.mk +++ b/multi-arch.mk @@ -26,8 +26,10 @@ $(DRIVER_PUSH_TARGETS): push-%: # No multi-arch support for the following distributions build-signed_ubuntu22.04%: DOCKER_BUILD_PLATFORM_OPTIONS = --platform=linux/amd64 build-signed_ubuntu26.04%: DOCKER_BUILD_PLATFORM_OPTIONS = --platform=linux/amd64 - +# nvidia-64k is arm64-only +ifeq ($(KERNEL_FLAVOR),nvidia-64k) +build-signed_ubuntu24.04%: DOCKER_BUILD_PLATFORM_OPTIONS = --platform=linux/arm64 # arm64 does not support azure-fde -ifeq ($(KERNEL_FLAVOR),azure-fde) +else ifeq ($(KERNEL_FLAVOR),azure-fde) build-signed_ubuntu24.04%: DOCKER_BUILD_PLATFORM_OPTIONS = --platform=linux/amd64 endif diff --git a/scripts/precompiled.sh b/scripts/precompiled.sh index efebbcac0..9c6d4382f 100755 --- a/scripts/precompiled.sh +++ b/scripts/precompiled.sh @@ -37,15 +37,22 @@ function sourceVersions(){ } function buildBaseImage(){ - # Build the base image + # nvidia-64k is arm64-only; its base image must be built for arm64 to find arm64-only kernel packages + if [[ "${KERNEL_FLAVOR}" == "nvidia-64k" ]]; then + export DOCKER_BUILD_PLATFORM_OPTIONS="--platform=linux/arm64" + fi make DRIVER_BRANCH=${DRIVER_BRANCH} KERNEL_FLAVOR=${KERNEL_FLAVOR} build-base-${BASE_TARGET} } function buildImage(){ - # Build the image. Build multi-arch (amd64+arm64) for ubuntu24.04 except azure-fde - # (linux-objects-nvidia-*-azure-fde is not available for arm64). - if [[ "$DIST" == "signed_ubuntu24.04" ]] && [[ "$KERNEL_FLAVOR" != "azure-fde" ]]; then - export DOCKER_BUILD_PLATFORM_OPTIONS="--platform=linux/amd64,linux/arm64" + # Build multi-arch (amd64+arm64) for ubuntu24.04 except azure-fde and nvidia-64k. + # nvidia-64k is arm64-only; azure-fde is not available for arm64. + if [[ "$DIST" == "signed_ubuntu24.04" ]]; then + if [[ "$KERNEL_FLAVOR" == "nvidia-64k" ]]; then + export DOCKER_BUILD_PLATFORM_OPTIONS="--platform=linux/arm64" + elif [[ "$KERNEL_FLAVOR" != "azure-fde" ]]; then + export DOCKER_BUILD_PLATFORM_OPTIONS="--platform=linux/amd64,linux/arm64" + fi fi make DRIVER_VERSIONS=${DRIVER_VERSIONS} DRIVER_BRANCH=${DRIVER_BRANCH} build-${DIST}-${DRIVER_VERSION} } @@ -76,12 +83,20 @@ function pushImage(){ } function pullImage(){ - # pull the image + # nvidia-64k is arm64-only; skip if scanning for amd64 + if [[ "${KERNEL_FLAVOR}" == "nvidia-64k" ]] && [[ "${PLATFORM}" == "linux/amd64" ]]; then + echo "nvidia-64k is arm64-only, skipping amd64 pull" + return 0 + fi make DRIVER_VERSIONS=${DRIVER_VERSIONS} DRIVER_BRANCH=${DRIVER_BRANCH} pull-${DIST}-${DRIVER_VERSION} } function archiveImage(){ - # archive the image + # nvidia-64k is arm64-only; skip if scanning for amd64 + if [[ "${KERNEL_FLAVOR}" == "nvidia-64k" ]] && [[ "${PLATFORM}" == "linux/amd64" ]]; then + echo "nvidia-64k is arm64-only, skipping amd64 archive" + return 0 + fi make DRIVER_VERSIONS=${DRIVER_VERSIONS} DRIVER_BRANCH=${DRIVER_BRANCH} archive-${DIST}-${DRIVER_VERSION} } diff --git a/tests/scripts/build-kernel-matrix.sh b/tests/scripts/build-kernel-matrix.sh index 1e6828ae6..3dc57818b 100755 --- a/tests/scripts/build-kernel-matrix.sh +++ b/tests/scripts/build-kernel-matrix.sh @@ -38,7 +38,13 @@ for PLATFORM in "${PLATFORMS[@]}"; do done else PLATFORM_SUFFIX="" - FLAVORS_FOR_PLATFORM=("${KERNEL_FLAVORS[@]}") + # nvidia-64k is arm64-only + FLAVORS_FOR_PLATFORM=() + for flavor in "${KERNEL_FLAVORS[@]}"; do + if [[ "$flavor" != "nvidia-64k" ]]; then + FLAVORS_FOR_PLATFORM+=("$flavor") + fi + done fi KERNEL_VERSIONS=($(get_kernel_versions_to_test FLAVORS_FOR_PLATFORM[@] DRIVER_BRANCHES[@] "$DIST" "$LTS_KERNEL" "$PLATFORM_SUFFIX")) if [[ ${#KERNEL_VERSIONS[@]} -gt 0 ]]; then