From 75adbde1afac432b3674522bfdb88e75364bf7ce Mon Sep 17 00:00:00 2001 From: Noel Georgi Date: Fri, 2 Aug 2024 18:26:49 +0530 Subject: [PATCH] feat: support lts and production nvidia modules Support LTS and production versions of NVIDIA kernel modules as per https://docs.nvidia.com/datacenter/tesla/drivers/index.html#lifecycle Part of: https://github.com/siderolabs/talos/issues/9086 Signed-off-by: Noel Georgi --- .github/workflows/ci.yaml | 7 +-- .github/workflows/weekly.yaml | 4 +- .kres.yaml | 6 ++- Makefile | 8 ++-- Pkgfile | 11 +++-- nonfree/kmod-nvidia/{ => lts}/pkg.yaml | 30 +++++-------- nonfree/kmod-nvidia/production/pkg.yaml | 41 +++++++++++++++++ nvidia-open-gpu-kernel-modules/lts/pkg.yaml | 45 +++++++++++++++++++ nvidia-open-gpu-kernel-modules/pkg.yaml | 40 ----------------- .../production/pkg.yaml | 45 +++++++++++++++++++ 10 files changed, 165 insertions(+), 72 deletions(-) rename nonfree/kmod-nvidia/{ => lts}/pkg.yaml (50%) create mode 100644 nonfree/kmod-nvidia/production/pkg.yaml create mode 100644 nvidia-open-gpu-kernel-modules/lts/pkg.yaml delete mode 100644 nvidia-open-gpu-kernel-modules/pkg.yaml create mode 100644 nvidia-open-gpu-kernel-modules/production/pkg.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 14c6233e1..3e4aea1cf 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,6 +1,6 @@ # THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT. # -# Generated on 2024-07-03T10:20:21Z by kres 2c4ff8a. +# Generated on 2024-07-31T18:33:29Z by kres faf91e3. name: default concurrency: @@ -33,7 +33,7 @@ jobs: labels: ${{ steps.retrieve-pr-labels.outputs.result }} services: buildkitd: - image: moby/buildkit:v0.14.1 + image: moby/buildkit:v0.15.0 options: --privileged ports: - 1234:1234 @@ -85,6 +85,7 @@ jobs: run: | make - name: Build nonfree + if: github.event_name == 'pull_request' run: | make nonfree - name: Login to registry @@ -136,7 +137,7 @@ jobs: - default services: buildkitd: - image: moby/buildkit:v0.14.1 + image: moby/buildkit:v0.15.0 options: --privileged ports: - 1234:1234 diff --git a/.github/workflows/weekly.yaml b/.github/workflows/weekly.yaml index fab26c841..aad7a4a16 100644 --- a/.github/workflows/weekly.yaml +++ b/.github/workflows/weekly.yaml @@ -1,6 +1,6 @@ # THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT. # -# Generated on 2024-07-02T13:34:14Z by kres 582671e. +# Generated on 2024-07-31T18:33:29Z by kres faf91e3. name: weekly concurrency: @@ -16,7 +16,7 @@ jobs: - pkgs services: buildkitd: - image: moby/buildkit:v0.14.1 + image: moby/buildkit:v0.15.0 options: --privileged ports: - 1234:1234 diff --git a/.kres.yaml b/.kres.yaml index d2ef3624c..2fe5ed1b4 100644 --- a/.kres.yaml +++ b/.kres.yaml @@ -40,11 +40,13 @@ spec: - kernel - drbd-pkg - gasket-driver-pkg - - nvidia-open-gpu-kernel-modules-pkg + - nvidia-open-gpu-kernel-modules-lts-pkg + - nvidia-open-gpu-kernel-modules-production-pkg - zfs-pkg additionalTargets: nonfree: - - nonfree-kmod-nvidia-pkg + - nonfree-kmod-nvidia-lts-pkg + - nonfree-kmod-nvidia-production-pkg reproducibleTargetName: reproducibility --- kind: auto.CustomSteps diff --git a/Makefile b/Makefile index 1902ca996..2e7ea149f 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ # THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT. # -# Generated on 2024-06-25T05:52:46Z by kres 4c9f215. +# Generated on 2024-08-02T11:55:34Z by kres faf91e3. # common variables @@ -79,9 +79,11 @@ TARGETS += xfsprogs TARGETS += kernel TARGETS += drbd-pkg TARGETS += gasket-driver-pkg -TARGETS += nvidia-open-gpu-kernel-modules-pkg +TARGETS += nvidia-open-gpu-kernel-modules-lts-pkg +TARGETS += nvidia-open-gpu-kernel-modules-production-pkg TARGETS += zfs-pkg -NONFREE_TARGETS = nonfree-kmod-nvidia-pkg +NONFREE_TARGETS = nonfree-kmod-nvidia-lts-pkg +NONFREE_TARGETS += nonfree-kmod-nvidia-production-pkg # help menu diff --git a/Pkgfile b/Pkgfile index 6d2b090e3..a3000b0de 100644 --- a/Pkgfile +++ b/Pkgfile @@ -132,10 +132,13 @@ vars: musl_sha256: a9a118bbe84d8764da0ea0d28b3ab3fae8477fc7e4085d90102b8596fc7c75e4 musl_sha512: 7bb7f7833923cd69c7a1a9b8a5f1784bfd5289663eb6061dcd43d583e45987df8a68a1be05d75cc1c88a3f5b610653d1a70f4a9cff4d8f7fd41ae73ee058c17c - # renovate: datasource=github-releases depName=nvidia/open-gpu-kernel-modules - nvidia_driver_version: 535.129.03 - nvidia_driver_sha256: 170ee91b6cd6c801bba0de91e0d62af8e574adde38120bc762784755b5a9821d - nvidia_driver_sha512: c8104103f34365b7a20dcebb64e1eb2e64a7b056b44329fa305f81e267759f2b1bb1c09923e617d4f5f4af3be01c3b8e2e6d739f03d4d0f129b31331fec3a4d8 + # renovate: datasource=github-releases extractVersion=^\d+\.(?\d+\.\d+)$ depName=nvidia/open-gpu-kernel-modules + # NOTE: Use the version that's also available under fabricmanager at https://developer.download.nvidia.com/compute/cuda/redist/fabricmanager/linux-x86_64/ + nvidia_driver_version_lts: 535.104.05 + + # renovate: datasource=github-releases extractVersion=^\d+\.(?\d+\.\d+)$ depName=nvidia/open-gpu-kernel-modules + # NOTE: Use the version that's also available under fabricmanager at https://developer.download.nvidia.com/compute/cuda/redist/fabricmanager/linux-x86_64/ + nvidia_driver_version_production: 550.54.15 # renovate: datasource=git-tags extractVersion=^openssl-(?.*)$ depName=git://git.openssl.org/openssl.git openssl_version: 3.3.0 diff --git a/nonfree/kmod-nvidia/pkg.yaml b/nonfree/kmod-nvidia/lts/pkg.yaml similarity index 50% rename from nonfree/kmod-nvidia/pkg.yaml rename to nonfree/kmod-nvidia/lts/pkg.yaml index efd4e5f92..99b8705e9 100644 --- a/nonfree/kmod-nvidia/pkg.yaml +++ b/nonfree/kmod-nvidia/lts/pkg.yaml @@ -1,4 +1,4 @@ -name: nonfree-kmod-nvidia-pkg +name: nonfree-kmod-nvidia-lts-pkg variant: scratch shell: /toolchain/bin/bash dependencies: @@ -6,35 +6,29 @@ dependencies: steps: - sources: # {{ if eq .ARCH "aarch64" }} This in fact is YAML comment, but Go templating instruction is evaluated by bldr - - url: https://download.nvidia.com/XFree86/Linux-aarch64/{{ .nvidia_driver_version }}/NVIDIA-Linux-aarch64-{{ .nvidia_driver_version }}.run - destination: nvidia.run - sha256: 8ba8d961457a241bcdf91b76d6fe2f36cb473c8bbdb02fb6650a622ce2e85b33 - sha512: 706de7e53b81f909d8bc6a12a39c594754a164c49f5d23c7939dc3abcfc04f5d5b12b7d65762ae574582149a098f06ee5fe95be4f8ad1056a3307a6ce93f3c00 + - url: https://developer.download.nvidia.com/compute/cuda/redist/nvidia_driver/linux-sbsa/nvidia_driver-linux-sbsa-{{ .nvidia_driver_version_lts }}-archive.tar.xz + destination: nvidia.tar.xz + sha256: eb089f52ddda09f4b2bcf0eb661d0bb7881a3d63cbca558c9530ab50b4ef84ee + sha512: cbc575b8f72211c54b962c3c12a671d4b993436f5c292181c5db098a5b5fe909ca3e001e679430dfa393cd63a626d4c2cee1c2dd3e2b79464eea4d72fc06a3ff # {{ else }} This in fact is YAML comment, but Go templating instruction is evaluated by bldr - - url: https://download.nvidia.com/XFree86/Linux-x86_64/{{ .nvidia_driver_version }}/NVIDIA-Linux-x86_64-{{ .nvidia_driver_version }}.run - destination: nvidia.run - sha256: e6dca5626a2608c6bb2a046cfcb7c1af338b9e961a7dd90ac09bb8a126ff002e - sha512: 3d7142658fe836e1debf7786857bdb293490ef33351e9b7d39face245fe8596b0f46052b86fae08350fcda1e2a9fd68d7309b94e107d1b016bd529d8fc37e31f + - url: https://developer.download.nvidia.com/compute/cuda/redist/nvidia_driver/linux-x86_64/nvidia_driver-linux-x86_64-{{ .nvidia_driver_version_lts }}-archive.tar.xz + destination: nvidia.tar.xz + sha256: f19c11dfda9e1e5c3e0a2ca775cdaa851431648540f4e8e2916c53735debd450 + sha512: 7505eda598719325b757375e25a98b17fb0e31d355e42277c32897648f63769222ac32a50f7ae89998fea52bd858160c83114e473e36cd36cfef17d57f8fdde6 # {{ end }} This in fact is YAML comment, but Go templating instruction is evaluated by bldr env: ARCH: {{ if eq .ARCH "aarch64"}}arm64{{ else if eq .ARCH "x86_64" }}x86_64{{ else }}unsupported{{ end }} prepare: - | - export PATH=/toolchain/bin:$PATH - export GUESS_MD5_PATH=/toolchain/bin - - rm -f /dev/tty && ln -s /dev/stdout /dev/tty - ln -s /toolchain/bin/echo /toolchain/bin/which - - /toolchain/bin/bash nvidia.run --extract-only + tar xf nvidia.tar.xz --strip-components=1 build: - | - cd NVIDIA-Linux-*/kernel + cd kernel make -j $(nproc) SYSSRC=/src install: - | - cd NVIDIA-Linux-*/kernel + cd kernel mkdir -p /rootfs/lib/modules/$(cat /src/include/config/kernel.release)/ cp /src/modules.order /rootfs/lib/modules/$(cat /src/include/config/kernel.release)/ diff --git a/nonfree/kmod-nvidia/production/pkg.yaml b/nonfree/kmod-nvidia/production/pkg.yaml new file mode 100644 index 000000000..97c7cc1ca --- /dev/null +++ b/nonfree/kmod-nvidia/production/pkg.yaml @@ -0,0 +1,41 @@ +name: nonfree-kmod-nvidia-production-pkg +variant: scratch +shell: /toolchain/bin/bash +dependencies: + - stage: kernel-build +steps: + - sources: + # {{ if eq .ARCH "aarch64" }} This in fact is YAML comment, but Go templating instruction is evaluated by bldr + - url: https://developer.download.nvidia.com/compute/cuda/redist/nvidia_driver/linux-sbsa/nvidia_driver-linux-sbsa-{{ .nvidia_driver_version_production }}-archive.tar.xz + destination: nvidia.tar.xz + sha256: b39a8cb837fe3846284d89ab2202e93b14804349d3fc9aa8a8384fd2759ec2f5 + sha512: 164636addea50d4d28c4630bf7eaf6060c6392b4aac670c0f5e43996fb309203efc1fa95d464eed8a9d3a22fa2aa5f446195c0f3e4dafa9e32a532447810a2d7 + # {{ else }} This in fact is YAML comment, but Go templating instruction is evaluated by bldr + - url: https://developer.download.nvidia.com/compute/cuda/redist/nvidia_driver/linux-x86_64/nvidia_driver-linux-x86_64-{{ .nvidia_driver_version_production }}-archive.tar.xz + destination: nvidia.tar.xz + sha256: e1416ebc1e7b4a14d393ca584e3f9c5e22f9750f4ba502a8ba2c5c5ad943bbb5 + sha512: 188e742796ace5a48b6cdbedae0943c2be593f9e48fb3107ac9f844ed443369cbe977aa084abf17604dd789f475633cd419ad80d63c27429d2760a4018c57586 + # {{ end }} This in fact is YAML comment, but Go templating instruction is evaluated by bldr + env: + ARCH: {{ if eq .ARCH "aarch64"}}arm64{{ else if eq .ARCH "x86_64" }}x86_64{{ else }}unsupported{{ end }} + prepare: + - | + tar xf nvidia.tar.xz --strip-components=1 + build: + - | + cd kernel + + make -j $(nproc) SYSSRC=/src + install: + - | + cd kernel + + mkdir -p /rootfs/lib/modules/$(cat /src/include/config/kernel.release)/ + cp /src/modules.order /rootfs/lib/modules/$(cat /src/include/config/kernel.release)/ + cp /src/modules.builtin /rootfs/lib/modules/$(cat /src/include/config/kernel.release)/ + cp /src/modules.builtin.modinfo /rootfs/lib/modules/$(cat /src/include/config/kernel.release)/ + + make -j $(nproc) modules_install SYSSRC=/src DEPMOD=/toolchain/bin/depmod INSTALL_MOD_PATH=/rootfs INSTALL_MOD_DIR=extras INSTALL_MOD_STRIP=1 +finalize: + - from: /rootfs + to: / diff --git a/nvidia-open-gpu-kernel-modules/lts/pkg.yaml b/nvidia-open-gpu-kernel-modules/lts/pkg.yaml new file mode 100644 index 000000000..b19651973 --- /dev/null +++ b/nvidia-open-gpu-kernel-modules/lts/pkg.yaml @@ -0,0 +1,45 @@ +name: nvidia-open-gpu-kernel-modules-lts-pkg +variant: scratch +shell: /toolchain/bin/bash +dependencies: + - stage: kernel-build +steps: + - sources: + # {{ if eq .ARCH "aarch64" }} This in fact is YAML comment, but Go templating instruction is evaluated by bldr + - url: https://developer.download.nvidia.com/compute/cuda/redist/nvidia_driver/linux-sbsa/nvidia_driver-linux-sbsa-{{ .nvidia_driver_version_lts }}-archive.tar.xz + destination: nvidia.tar.xz + sha256: eb089f52ddda09f4b2bcf0eb661d0bb7881a3d63cbca558c9530ab50b4ef84ee + sha512: cbc575b8f72211c54b962c3c12a671d4b993436f5c292181c5db098a5b5fe909ca3e001e679430dfa393cd63a626d4c2cee1c2dd3e2b79464eea4d72fc06a3ff + # {{ else }} This in fact is YAML comment, but Go templating instruction is evaluated by bldr + - url: https://developer.download.nvidia.com/compute/cuda/redist/nvidia_driver/linux-x86_64/nvidia_driver-linux-x86_64-{{ .nvidia_driver_version_lts }}-archive.tar.xz + destination: nvidia.tar.xz + sha256: f19c11dfda9e1e5c3e0a2ca775cdaa851431648540f4e8e2916c53735debd450 + sha512: 7505eda598719325b757375e25a98b17fb0e31d355e42277c32897648f63769222ac32a50f7ae89998fea52bd858160c83114e473e36cd36cfef17d57f8fdde6 + # {{ end }} This in fact is YAML comment, but Go templating instruction is evaluated by bldr + env: + ARCH: {{ if eq .ARCH "aarch64"}}arm64{{ else if eq .ARCH "x86_64" }}x86_64{{ else }}unsupported{{ end }} + prepare: + - | + tar xf nvidia.tar.xz --strip-components=1 + build: + - | + cd kernel-open + + make -j $(nproc) SYSSRC=/src + install: + - | + cd kernel-open + + mkdir -p /rootfs/lib/modules/$(cat /src/include/config/kernel.release)/ + cp /src/modules.order /rootfs/lib/modules/$(cat /src/include/config/kernel.release)/ + cp /src/modules.builtin /rootfs/lib/modules/$(cat /src/include/config/kernel.release)/ + cp /src/modules.builtin.modinfo /rootfs/lib/modules/$(cat /src/include/config/kernel.release)/ + + make -j $(nproc) modules_install SYSSRC=/src DEPMOD=/toolchain/bin/depmod INSTALL_MOD_PATH=/rootfs INSTALL_MOD_STRIP=1 + test: + - | + # https://www.kernel.org/doc/html/v4.15/admin-guide/module-signing.html#signed-modules-and-stripping + find /rootfs/lib/modules -name '*.ko' -exec grep -FL '~Module signature appended~' {} \+ +finalize: + - from: /rootfs + to: / diff --git a/nvidia-open-gpu-kernel-modules/pkg.yaml b/nvidia-open-gpu-kernel-modules/pkg.yaml deleted file mode 100644 index 58edb9bdf..000000000 --- a/nvidia-open-gpu-kernel-modules/pkg.yaml +++ /dev/null @@ -1,40 +0,0 @@ -name: nvidia-open-gpu-kernel-modules-pkg -variant: scratch -shell: /toolchain/bin/bash -dependencies: - - stage: kernel-build -steps: - - sources: - - url: https://github.com/NVIDIA/open-gpu-kernel-modules/archive/refs/tags/{{ .nvidia_driver_version }}.tar.gz - destination: open-gpu-kernel-modules.tar.gz - sha256: "{{ .nvidia_driver_sha256 }}" - sha512: "{{ .nvidia_driver_sha512 }}" - env: - ARCH: {{ if eq .ARCH "aarch64"}}arm64{{ else if eq .ARCH "x86_64" }}x86_64{{ else }}unsupported{{ end }} - prepare: - - | - export PATH=/toolchain/bin:$PATH - export GUESS_MD5_PATH=/toolchain/bin - - rm -f /dev/tty && ln -s /dev/stdout /dev/tty - ln -s /toolchain/bin/echo /toolchain/bin/which - - tar xf open-gpu-kernel-modules.tar.gz --strip-components=1 - build: - - | - make -j $(nproc) SYSSRC=/src - install: - - | - mkdir -p /rootfs/lib/modules/$(cat /src/include/config/kernel.release)/ - cp /src/modules.order /rootfs/lib/modules/$(cat /src/include/config/kernel.release)/ - cp /src/modules.builtin /rootfs/lib/modules/$(cat /src/include/config/kernel.release)/ - cp /src/modules.builtin.modinfo /rootfs/lib/modules/$(cat /src/include/config/kernel.release)/ - - make -j $(nproc) modules_install SYSSRC=/src DEPMOD=/toolchain/bin/depmod INSTALL_MOD_PATH=/rootfs INSTALL_MOD_STRIP=1 - test: - - | - # https://www.kernel.org/doc/html/v4.15/admin-guide/module-signing.html#signed-modules-and-stripping - find /rootfs/lib/modules -name '*.ko' -exec grep -FL '~Module signature appended~' {} \+ -finalize: - - from: /rootfs - to: / diff --git a/nvidia-open-gpu-kernel-modules/production/pkg.yaml b/nvidia-open-gpu-kernel-modules/production/pkg.yaml new file mode 100644 index 000000000..2c73abcf3 --- /dev/null +++ b/nvidia-open-gpu-kernel-modules/production/pkg.yaml @@ -0,0 +1,45 @@ +name: nvidia-open-gpu-kernel-modules-production-pkg +variant: scratch +shell: /toolchain/bin/bash +dependencies: + - stage: kernel-build +steps: + - sources: + # {{ if eq .ARCH "aarch64" }} This in fact is YAML comment, but Go templating instruction is evaluated by bldr + - url: https://developer.download.nvidia.com/compute/cuda/redist/nvidia_driver/linux-sbsa/nvidia_driver-linux-sbsa-{{ .nvidia_driver_version_production }}-archive.tar.xz + destination: nvidia.tar.xz + sha256: b39a8cb837fe3846284d89ab2202e93b14804349d3fc9aa8a8384fd2759ec2f5 + sha512: 164636addea50d4d28c4630bf7eaf6060c6392b4aac670c0f5e43996fb309203efc1fa95d464eed8a9d3a22fa2aa5f446195c0f3e4dafa9e32a532447810a2d7 + # {{ else }} This in fact is YAML comment, but Go templating instruction is evaluated by bldr + - url: https://developer.download.nvidia.com/compute/cuda/redist/nvidia_driver/linux-x86_64/nvidia_driver-linux-x86_64-{{ .nvidia_driver_version_production }}-archive.tar.xz + destination: nvidia.tar.xz + sha256: e1416ebc1e7b4a14d393ca584e3f9c5e22f9750f4ba502a8ba2c5c5ad943bbb5 + sha512: 188e742796ace5a48b6cdbedae0943c2be593f9e48fb3107ac9f844ed443369cbe977aa084abf17604dd789f475633cd419ad80d63c27429d2760a4018c57586 + # {{ end }} This in fact is YAML comment, but Go templating instruction is evaluated by bldr + env: + ARCH: {{ if eq .ARCH "aarch64"}}arm64{{ else if eq .ARCH "x86_64" }}x86_64{{ else }}unsupported{{ end }} + prepare: + - | + tar xf nvidia.tar.xz --strip-components=1 + build: + - | + cd kernel-open + + make -j $(nproc) SYSSRC=/src + install: + - | + cd kernel-open + + mkdir -p /rootfs/lib/modules/$(cat /src/include/config/kernel.release)/ + cp /src/modules.order /rootfs/lib/modules/$(cat /src/include/config/kernel.release)/ + cp /src/modules.builtin /rootfs/lib/modules/$(cat /src/include/config/kernel.release)/ + cp /src/modules.builtin.modinfo /rootfs/lib/modules/$(cat /src/include/config/kernel.release)/ + + make -j $(nproc) modules_install SYSSRC=/src DEPMOD=/toolchain/bin/depmod INSTALL_MOD_PATH=/rootfs INSTALL_MOD_STRIP=1 + test: + - | + # https://www.kernel.org/doc/html/v4.15/admin-guide/module-signing.html#signed-modules-and-stripping + find /rootfs/lib/modules -name '*.ko' -exec grep -FL '~Module signature appended~' {} \+ +finalize: + - from: /rootfs + to: /