Skip to content

Commit

Permalink
feat: add nvidia-open images (#2092)
Browse files Browse the repository at this point in the history
Signed-off-by: m2 <[email protected]>
  • Loading branch information
m2Giles authored Jan 2, 2025
1 parent 7fb823c commit d03a310
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 39 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-image-latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
matrix:
brand_name: ["bluefin"]
with:
image_flavors: '["main", "nvidia", "hwe", "hwe-nvidia"]'
image_flavors: '["main", "nvidia", "nvidia-open", "hwe", "hwe-nvidia", "hwe-nvidia-open"]'
brand_name: ${{ matrix.brand_name }}
stream_name: latest
# This needs splitting, right now a kernel pin will not work due to hwe kernel
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-iso-latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ jobs:
matrix:
brand_name: ${{ fromJson(inputs.brand_name || '["bluefin"]') }}
with:
image_flavors: '["main", "nvidia", "hwe", "hwe-nvidia"]'
image_flavors: '["main", "nvidia", "nvidia-open", "hwe", "hwe-nvidia", "hwe-nvidia-open"]'
brand_name: ${{ matrix.brand_name }}
stream_name: latest
2 changes: 1 addition & 1 deletion .github/workflows/reusable-build-iso.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
inputs:
image_flavors:
description: "JSON string of flavors to build, '[main, nvidia, hwe, hwe-nvidia]'"
default: "['main', 'nvidia']"
default: "['main', 'nvidia', 'nvidia-open']"
type: string
brand_name:
description: "The Brand Name: bluefin"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/reusable-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
inputs:
image_flavors:
description: "JSON string of flavors to build, '[main, nvidia, hwe, hwe-nvidia]'"
default: "['main', 'nvidia']"
default: "['main', 'nvidia', 'nvidia-open']"
type: string
brand_name:
description: "The Brand Name: bluefin"
Expand Down
46 changes: 14 additions & 32 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,16 @@ images := '(
flavors := '(
[main]=main
[nvidia]=nvidia
[nvidia-open]=nvidia-open
[hwe]=hwe
[hwe-nvidia]=hwe-nvidia
[hwe-nvidia-open]=hwe-nvidia-open
[asus]=asus
[asus-nvidia]=asus-nvidia
[asus-nvidia-open]=asus-nvidia-open
[surface]=surface
[surface-nvidia]=surface-nvidia
[surface-nvidia-open]=surface-nvidia-open
)'
tags := '(
[gts]=gts
Expand Down Expand Up @@ -68,17 +72,13 @@ sudo-clean:
# Check if valid combo
[group('Utility')]
[private]
validate image="" tag="" flavor="":
validate $image $tag $flavor:
#!/usr/bin/bash
set -eou pipefail
declare -A images={{ images }}
declare -A tags={{ tags }}
declare -A flavors={{ flavors }}

image={{ image }}
tag={{ tag }}
flavor={{ flavor }}

# Handle Stable Daily
if [[ "${tag}" == "stable-daily" ]]; then
tag="stable"
Expand Down Expand Up @@ -126,12 +126,9 @@ sudoif command *args:

# Build Image
[group('Image')]
build image="bluefin" tag="latest" flavor="main" rechunk="0" ghcr="0" pipeline="0" kernel_pin="":
build $image="bluefin" $tag="latest" $flavor="main" rechunk="0" ghcr="0" pipeline="0" $kernel_pin="":
#!/usr/bin/bash
set -eoux pipefail
image={{ image }}
tag={{ tag }}
flavor={{ flavor }}

# Validate
just validate "${image}" "${tag}" "${flavor}"
Expand Down Expand Up @@ -170,7 +167,6 @@ build image="bluefin" tag="latest" flavor="main" rechunk="0" ghcr="0" pipeline="
just verify-container "${base_image_name}-main:${fedora_version}"

# Kernel Release/Pin
kernel_pin="{{ kernel_pin }}"
if [[ -z "${kernel_pin:-}" ]]; then
kernel_release=$(skopeo inspect --retry-times 3 docker://ghcr.io/ublue-os/${akmods_flavor}-kernel:"${fedora_version}" | jq -r '.Labels["ostree.linux"]')
else
Expand All @@ -183,7 +179,9 @@ build image="bluefin" tag="latest" flavor="main" rechunk="0" ghcr="0" pipeline="
if [[ "${akmods_flavor}" =~ coreos ]]; then
just verify-container "akmods-zfs:${akmods_flavor}-${fedora_version}-${kernel_release}"
fi
if [[ "${flavor}" =~ nvidia ]]; then
if [[ "${flavor}" =~ nvidia-open ]]; then
just verify-container "akmods-nvidia-open:${akmods_flavor}-${fedora_version}-${kernel_release}"
elif [[ "${flavor}" =~ nvidia ]]; then
just verify-container "akmods-nvidia:${akmods_flavor}-${fedora_version}-${kernel_release}"
fi

Expand Down Expand Up @@ -261,14 +259,10 @@ build-pipeline image="bluefin" tag="latest" flavor="main" kernel_pin="":
# Rechunk Image
[group('Image')]
[private]
rechunk image="bluefin" tag="latest" flavor="main" ghcr="0" pipeline="0":
rechunk $image="bluefin" $tag="latest" $flavor="main" ghcr="0" pipeline="0":
#!/usr/bin/bash
set -eoux pipefail

image={{ image }}
tag={{ tag }}
flavor={{ flavor }}

# Validate
just validate "${image}" "${tag}" "${flavor}"

Expand Down Expand Up @@ -414,12 +408,9 @@ load-rechunk image="bluefin" tag="latest" flavor="main":

# Run Container
[group('Image')]
run image="bluefin" tag="latest" flavor="main":
run $image="bluefin" $tag="latest" $flavor="main":
#!/usr/bin/bash
set -eoux pipefail
image={{ image }}
tag={{ tag }}
flavor={{ flavor }}

# Validate
just validate "${image}" "${tag}" "${flavor}"
Expand All @@ -438,12 +429,9 @@ run image="bluefin" tag="latest" flavor="main":

# Build ISO
[group('ISO')]
build-iso image="bluefin" tag="latest" flavor="main" ghcr="0" pipeline="0":
build-iso $image="bluefin" $tag="latest" $flavor="main" ghcr="0" pipeline="0":
#!/usr/bin/bash
set -eoux pipefail
image={{ image }}
tag={{ tag }}
flavor={{ flavor }}

# Validate
just validate "${image}" "${tag}" "${flavor}"
Expand Down Expand Up @@ -574,12 +562,9 @@ build-iso-ghcr image="bluefin" tag="latest" flavor="main":

# Run ISO
[group('ISO')]
run-iso image="bluefin" tag="latest" flavor="main":
run-iso $image="bluefin" $tag="latest" $flavor="main":
#!/usr/bin/bash
set -eoux pipefail
image={{ image }}
tag={{ tag }}
flavor={{ flavor }}

# Validate
just validate "${image}" "${tag}" "${flavor}"
Expand Down Expand Up @@ -658,12 +643,9 @@ verify-container container="" registry="ghcr.io/ublue-os" key="":

# Secureboot Check
[group('Utility')]
secureboot image="bluefin" tag="latest" flavor="main":
secureboot $image="bluefin" $tag="latest" $flavor="main":
#!/usr/bin/bash
set -eoux pipefail
image={{ image }}
tag={{ tag }}
flavor={{ flavor }}

# Validate
just validate "${image}" "${tag}" "${flavor}"
Expand Down
11 changes: 8 additions & 3 deletions build_files/base/03-install-kernel-akmods.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,20 @@ rpm-ostree install \

# RPMFUSION Dependent AKMODS
rpm-ostree install \
https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm \
https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm
https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-"$(rpm -E %fedora)".noarch.rpm \
https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-"$(rpm -E %fedora)".noarch.rpm
rpm-ostree install \
v4l2loopback /tmp/akmods/kmods/*v4l2loopback*.rpm
rpm-ostree uninstall rpmfusion-free-release rpmfusion-nonfree-release

# Nvidia AKMODS
if [[ "${IMAGE_NAME}" =~ nvidia ]]; then
# Fetch Nvidia RPMs
skopeo copy --retry-times 3 docker://ghcr.io/ublue-os/akmods-nvidia:"${AKMODS_FLAVOR}"-"$(rpm -E %fedora)"-"${KERNEL}" dir:/tmp/akmods-rpms
if [[ "${IMAGE_NAME}" =~ open ]]; then
skopeo copy --retry-times 3 docker://ghcr.io/ublue-os/akmods-nvidia-open:"${AKMODS_FLAVOR}"-"$(rpm -E %fedora)"-"${KERNEL}" dir:/tmp/akmods-rpms
else
skopeo copy --retry-times 3 docker://ghcr.io/ublue-os/akmods-nvidia:"${AKMODS_FLAVOR}"-"$(rpm -E %fedora)"-"${KERNEL}" dir:/tmp/akmods-rpms
fi
NVIDIA_TARGZ=$(jq -r '.layers[].digest' < /tmp/akmods-rpms/manifest.json | cut -d : -f 2)
tar -xvzf /tmp/akmods-rpms/"$NVIDIA_TARGZ" -C /tmp/
mv /tmp/rpms/* /tmp/akmods-rpms/
Expand All @@ -55,6 +59,7 @@ if [[ "${IMAGE_NAME}" =~ nvidia ]]; then
chmod +x /tmp/nvidia-install.sh
IMAGE_NAME="${BASE_IMAGE_NAME}" RPMFUSION_MIRROR="" /tmp/nvidia-install.sh
rm -f /usr/share/vulkan/icd.d/nouveau_icd.*.json
ln -sf libnvidia-ml.so.1 /usr/lib64/libnvidia-ml.so
fi

# ZFS for gts/stable
Expand Down

0 comments on commit d03a310

Please sign in to comment.