Skip to content

Commit

Permalink
Merge pull request #339 from bottlerocket-os/main
Browse files Browse the repository at this point in the history
Move to prod: nvidia drivers per version
  • Loading branch information
stockholmux authored Oct 26, 2023
2 parents 7828133 + e798192 commit f6efe8c
Show file tree
Hide file tree
Showing 10 changed files with 206 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
+++
title = "1.15.1"
description = "Drivers included in each GPU-enabled variant"
type = "docs"
+++

{{< nvidia-versions >}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
+++
title = "GPU Driver Versions"
description = "Versions of GPU drivers included in each patch release of Bottlerocket"
type = "docs"
+++
28 changes: 28 additions & 0 deletions data/nvidia/1.15.1/kmod-5.10-nvidia.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Extracted from https://github.com/bottlerocket-os/bottlerocket/tree/develop/packages/kmod-5.10-nvidia/Cargo.toml
[package]
name = "kmod-5_10-nvidia"
version = "0.1.0"
edition = "2021"
publish = false
build = "../build.rs"

[lib]
path = "../packages.rs"

[package.metadata.build-package]
package-name = "kmod-5.10-nvidia"
releases-url = "https://docs.nvidia.com/datacenter/tesla/"

[[package.metadata.build-package.external-files]]
url = "https://us.download.nvidia.com/tesla/470.161.03/NVIDIA-Linux-x86_64-470.161.03.run"
sha512 = "26b1640f9427847b68233ffacf5c4a07e75ed9923429dfc9e5de3d7e5c1f109dfaf0fe0a0639cbd47f056784ed3e00e2e741d5c84532df79590a0c9ffa5ba625"
force-upstream = true

[[package.metadata.build-package.external-files]]
url = "https://us.download.nvidia.com/tesla/470.161.03/NVIDIA-Linux-aarch64-470.161.03.run"
sha512 = "16e83c4d3ea66b2da07c43fca912c839e5feb9d42bee279b9de3476ffbd5e2314fddc83c1a38c198adb2d5ea6b4f2b00bb4a4c32d6fd0bfcdbccc392043f99ce"
force-upstream = true

[build-dependencies]
glibc = { path = "../glibc" }
kernel-5_10 = { path = "../kernel-5.10" }
28 changes: 28 additions & 0 deletions data/nvidia/1.15.1/kmod-5.15-nvidia.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Extracted from https://github.com/bottlerocket-os/bottlerocket/tree/develop/packages/kmod-5.15-nvidia/Cargo.toml
[package]
name = "kmod-5_15-nvidia"
version = "0.1.0"
edition = "2021"
publish = false
build = "../build.rs"

[lib]
path = "../packages.rs"

[package.metadata.build-package]
package-name = "kmod-5.15-nvidia"
releases-url = "https://docs.nvidia.com/datacenter/tesla/"

[[package.metadata.build-package.external-files]]
url = "https://us.download.nvidia.com/tesla/515.86.01/NVIDIA-Linux-x86_64-515.86.01.run"
sha512 = "9a31e14afc017e847f1208577f597c490adb63c256d6dff1a9eae56b65cf85374a604516b0be9da7a43e9af93b3c5aec47b2ffefd6b4050a4b7e55f348cf4e7b"
force-upstream = true

[[package.metadata.build-package.external-files]]
url = "https://us.download.nvidia.com/tesla/515.86.01/NVIDIA-Linux-aarch64-515.86.01.run"
sha512 = "43161f86143b1558d1f558acf4a060f53f538ea20e6235f76be24916fe4a9c374869645c7abf39eba66f1c2ca35f5d2b04f199bd1341b7ee6c1fdc879cb3ef96"
force-upstream = true

[build-dependencies]
glibc = { path = "../glibc" }
kernel-5_15 = { path = "../kernel-5.15" }
28 changes: 28 additions & 0 deletions data/nvidia/1.15.1/kmod-6.1-nvidia.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Extracted from https://github.com/bottlerocket-os/bottlerocket/tree/develop/packages/kmod-6.1-nvidia/Cargo.toml
[package]
name = "kmod-6_1-nvidia"
version = "0.1.0"
edition = "2021"
publish = false
build = "../build.rs"

[lib]
path = "../packages.rs"

[package.metadata.build-package]
package-name = "kmod-6.1-nvidia"
releases-url = "https://docs.nvidia.com/datacenter/tesla/"

[[package.metadata.build-package.external-files]]
url = "https://us.download.nvidia.com/tesla/535.54.03/NVIDIA-Linux-x86_64-535.54.03.run"
sha512 = "45b72b34272d3df14b56136bb61537d00145d55734b72d58390af4694d96f03b2b49433beb4a5bede4d978442b707b08e05f2f31b2fcfd9453091e7f0b945cff"
force-upstream = true

[[package.metadata.build-package.external-files]]
url = "https://us.download.nvidia.com/tesla/535.54.03/NVIDIA-Linux-aarch64-535.54.03.run"
sha512 = "57b06a6fa16838176866c364a8722c546084529ad91c57e979aca7750692127cab1485b5a44aee398c5494782ed987e82f66061aa39e802bc6eefa2b40a33bc3"
force-upstream = true

[build-dependencies]
glibc = { path = "../glibc" }
kernel-6_1 = { path = "../kernel-6.1" }
48 changes: 48 additions & 0 deletions layouts/shortcodes/nvidia-versions.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<table>
<thead>
<tr>
<th scope="col">Variant</th>
<th scope="col">Kernel Version</th>
<th scope="col">NVIDIA Driver Version</th>
</tr>
</thead>
<tbody>


{{- $full_bottlerocket_version := .Page.Params.title -}}
{{- $minor_bottlerocket_version_parts := split $full_bottlerocket_version "." -}}
{{- $minor_bottlerocket_release_line := print (index $minor_bottlerocket_version_parts 0) "." (index $minor_bottlerocket_version_parts 1) ".x" -}}
{{- $kmod_data := index $.Site.Data.nvidia $full_bottlerocket_version -}}
{{- $kernel_to_nvidia := dict -}}

{{- range $kmod_fname, $kmod_data := $kmod_data -}}
{{- $k_version := index (split $kmod_fname "-") 1 -}}
{{- $external_files := index (index (index (index $kmod_data "package") "metadata") "build-package") "external-files" -}}
{{- $url := index (index $external_files 0) "url" -}}
{{- $version := (path.Split (path.Dir $url)).File -}}
{{- $kernel_to_nvidia = merge $kernel_to_nvidia (dict $k_version $version) -}}
{{- end -}}


{{- with $.Site.Data.variants -}}
{{- $release_variants := index $.Site.Data.variants $minor_bottlerocket_release_line -}}
{{ range $variant_name, $variant_info := $release_variants }}
{{- if (strings.Contains $variant_name "nvidia") -}}
<tr>
<td><code>{{ $variant_name }}</code></td>
{{- $packages := (index (index (index (index $variant_info "package" ) "metadata") "build-variant") "included-packages") -}}
{{- $kernel := "" -}}
{{- range $packages -}}
{{- if (strings.Contains . "kernel-") -}}
{{- $kernel = index (split . "-") 1 -}}
{{- end -}}
{{- end -}}
<td>{{ $kernel }}</td>
<td>{{ index $kernel_to_nvidia $kernel }}</td>
</tr>
{{- end -}}
{{- end -}}
{{- end -}}

</tbody>
</table>
39 changes: 39 additions & 0 deletions scripts/nvidia-driver-versions/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Script: NVIDIA version information

This script is used to generate the file and data for `[lang]/os/[version line]/version-information/gpu-drivers/[full version]`. You will need to run it on every minor version.

## Prerequisites

This script works on Linux or MacOS and is unlikely to work in Windows. The directory structure used in the script specifically ties to bottlerocket-os/bottlerocket; it's unlikely to work in any other context.

Before you begin, clone bottlerocket-os/bottlerocket outside the project-website directory.

## Running the scripts

There are three scripts in this directory:

- `get_cargos.sh`: find all the variant's NVIDIA `Cargo.toml` files inside the [bottlerocket repo](https://github.com/bottlerocket-os/bottlerocket/tree/develop/packages/) and run `create_data_file_from_cargo.sh` on each.
- `create_data_file_from_cargo.sh`: Read a single `Cargo.toml` file and copy/transform it into a hugo data file.
- `create_markdown.sh`: Creates the markdown file for `[lang]/os/[version line]/version-information/gpu-drivers/[full version]`

### Copy/transform all `Cargo.toml` files into a hugo data files

This script will find all the `Cargo.toml` files in the specified path and run `create_data_file_from_cargo.sh` for each.

Make the sure the directory in the second argument exists already.

```bash
./get_cargos.sh /path/to/bottlerocket-repo /path/to/website/data/nvidia/1.15.1/
```

(Note the lack of a trailing slash on the first argument and the inclusion of a trailing slash on the second. This is important.)

This will create a new data file for each package in `/path/to/bottlerocket-repo/packages/` that matches the pattern `kmod-<version number>-nvidia`.

### Create the page

Create the markdown page which will make the data visible.

```bash
./create_markdown.sh /path/to/site/content/en/os/1.15.x/version-information/gpu-drivers 1.15.2
```
6 changes: 6 additions & 0 deletions scripts/nvidia-driver-versions/create_data_file_from_cargo.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

FNAME="$(echo $1 | awk -F/ '{print $(NF-1)}')"
EXTRACTED="# Extracted from https://github.com/bottlerocket-os/bottlerocket/tree/develop/packages/$FNAME/Cargo.toml"
echo $EXTRACTED > $2$FNAME.toml
cat $1 >> $2$FNAME.toml
13 changes: 13 additions & 0 deletions scripts/nvidia-driver-versions/create_markdown.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

mkdir $1/$2

cat << EOF > $1/$2/index.markdown
+++
title = "${2}"
description = "Drivers included in each GPU-enabled variant"
type = "docs"
+++
{{< nvidia-versions >}}
EOF
4 changes: 4 additions & 0 deletions scripts/nvidia-driver-versions/get_cargos.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

# find $1/* -name "Cargo.toml" -exec bash create_data_file_from_cargo.sh {} $2 \;
find $1/packages/kmod-* -name "Cargo.toml" -exec bash create_data_file_from_cargo.sh {} $2 \;

0 comments on commit f6efe8c

Please sign in to comment.