Skip to content

Commit

Permalink
feat: add bluefin GDX edition for nvidia graphics card development (#247
Browse files Browse the repository at this point in the history
)
  • Loading branch information
tulilirockz authored Feb 3, 2025
1 parent 33b2562 commit cd35272
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 15 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/build-gdx.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Build Bluefin LTS GDX

on:
pull_request:
branches:
- main
schedule:
- cron: "0 1 * * TUE" # Every Tuesday at 1am UTC
merge_group:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
cancel-in-progress: true

jobs:
build:
uses: ./.github/workflows/reusable-build-image.yml
secrets: inherit
with:
image-name: bluefin-gdx
flavor: gdx
17 changes: 13 additions & 4 deletions .github/workflows/reusable-build-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,14 @@ jobs:
IFS=',' read -r -a platforms <<< "${{ inputs.platforms }}"
MATRIX="{\"include\":[]}"
for platform in "${platforms[@]}"; do
MATRIX=$(echo $MATRIX | jq ".include += [{\"platform\": \"$platform\"}]")
done
if [ "${{ inputs.flavor }}" == "gdx" ] ; then
# We explicitly only support Nvidia on x86 for now.
MATRIX=$(echo $MATRIX | jq ".include += [{\"platform\": \"amd64\"}]")
else
for platform in "${platforms[@]}"; do
MATRIX=$(echo $MATRIX | jq ".include += [{\"platform\": \"$platform\"}]")
done
fi
echo "matrix=$(echo $MATRIX | jq -c '.')" >> $GITHUB_OUTPUT
build_push:
Expand Down Expand Up @@ -106,16 +111,20 @@ jobs:
set -x
just=$(which just)
ENABLE_GDX=0
ENABLE_DX=0
ENABLE_HWE=0
if [[ "$FLAVOR" =~ "gdx" ]] ; then
ENABLE_GDX=1
fi
if [[ "$FLAVOR" =~ "dx" ]] ; then
ENABLE_DX=1
fi
if [[ "$FLAVOR" =~ "hwe" ]] ; then
ENABLE_HWE=1
fi
sudo $just build "${IMAGE_NAME}" "${DEFAULT_TAG}" "$ENABLE_DX" "$ENABLE_HWE"
sudo $just build "${IMAGE_NAME}" "${DEFAULT_TAG}" "$ENABLE_DX" "$ENABLE_HWE" "$ENABLE_GDX"
- name: Run Rechunker
if: github.event_name != 'pull_request'
Expand Down
1 change: 1 addition & 0 deletions Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ FROM quay.io/centos-bootc/centos-bootc:$MAJOR_VERSION
# ARM should be handled by $(arch)
ARG ENABLE_DX="${ENABLE_DX:-0}"
ARG ENABLE_HWE="${ENABLE_HWE:-0}"
ARG ENABLE_GDX="${ENABLE_GDX:-0}"
ARG IMAGE_NAME="${IMAGE_NAME:-bluefin}"
ARG IMAGE_VENDOR="${IMAGE_VENDOR:-ublue-os}"
ARG MAJOR_VERSION="${MAJOR_VERSION:-lts}"
Expand Down
3 changes: 2 additions & 1 deletion Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ sudoif command *args:
}
sudoif {{ command }} {{ args }}

build $target_image=image_name $tag=default_tag $dx="0" $hwe="0":
build $target_image=image_name $tag=default_tag $dx="0" $hwe="0" $gdx="0":
#!/usr/bin/env bash
# Get Version
Expand All @@ -81,6 +81,7 @@ build $target_image=image_name $tag=default_tag $dx="0" $hwe="0":
BUILD_ARGS+=("--build-arg" "IMAGE_VENDOR=${repo_organization}")
BUILD_ARGS+=("--build-arg" "ENABLE_DX=${dx}")
BUILD_ARGS+=("--build-arg" "ENABLE_HWE=${hwe}")
BUILD_ARGS+=("--build-arg" "ENABLE_GDX=${gdx}")
if [[ -z "$(git status -s)" ]]; then
BUILD_ARGS+=("--build-arg" "SHA_HEAD_SHORT=$(git rev-parse --short HEAD)")
fi
Expand Down
6 changes: 6 additions & 0 deletions build_scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ if [ "$ENABLE_DX" == "1" ]; then
run_buildscripts_for "$(arch)/dx"
fi

if [ "$ENABLE_GDX" == "1" ] ; then
# We explicitly only support x86 on nvidia (unless they update it?)
copy_systemfiles_for "x86_64-gdx"
run_buildscripts_for "x86_64/gdx"
fi

if [ "$ENABLE_HWE" == "1" ]; then
copy_systemfiles_for hwe
run_buildscripts_for hwe
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,16 @@

set -euox pipefail

# FIXME: add renovate rules for this
NVIDIA_VERSION="570"
# FIXME: add renovate rules for this (somehow?)
NVIDIA_DISTRO="rhel9"

# kernel-devel, kernel-devel-matched and kernel-headers are necessary for nvidia drivers
dnf --enablerepo="centos-hyperscale" --enablerepo="centos-hyperscale-kernel" -y install kernel-devel kernel-devel-matched kernel-headers
dnf -y install kernel-devel kernel-devel-matched kernel-headers

dnf config-manager --add-repo "https://developer.download.nvidia.com/compute/cuda/repos/${NVIDIA_DISTRO}/$(arch)/cuda-${NVIDIA_DISTRO}.repo"
dnf clean expire-cache
NVIDIA_DRIVER_DIRECTORY=$(mktemp -d)

# Make sure hyperscale repos are enabled for kernel dependencies
dnf config-manager --set-enabled "centos-hyperscale"
dnf config-manager --set-enabled "centos-hyperscale-kernel"

# EGL-gbm and EGL-wayland fail to install because of conflicts with each other
dnf download egl-gbm egl-wayland --destdir=$NVIDIA_DRIVER_DIRECTORY
rpm -ivh $NVIDIA_DRIVER_DIRECTORY/*.rpm --nodeps --force
Expand All @@ -27,9 +22,6 @@ dnf -y install --nogpgcheck \
echo "blacklist nouveau" | tee /etc/modprobe.d/nouveau-blacklist.conf
echo "options nouveau modeset=0" | tee -a /etc/modprobe.d/nouveau-blacklist.conf

dnf config-manager --set-disabled "centos-hyperscale"
dnf config-manager --set-disabled "centos-hyperscale-kernel"

# Make sure initramfs is rebuilt after nvidia drivers or kernel replacement
KERNEL_SUFFIX=""
QUALIFIED_KERNEL="$(rpm -qa | grep -P 'kernel-(|'"$KERNEL_SUFFIX"'-)(\d+\.\d+\.\d+)' | sed -E 's/kernel-(|'"$KERNEL_SUFFIX"'-)//')"
Expand Down

0 comments on commit cd35272

Please sign in to comment.