Skip to content

Commit 33e9429

Browse files
committed
sync the rhel9 driver container with the latest changes in rhel8
Signed-off-by: Tariq Ibrahim <[email protected]>
1 parent e736f19 commit 33e9429

File tree

1 file changed

+22
-9
lines changed

1 file changed

+22
-9
lines changed

rhel9/nvidia-driver

+22-9
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,17 @@ _install_prerequisites() (
116116
dnf config-manager --set-disabled rhel-9-for-$DRIVER_ARCH-baseos-eus-rpms || true
117117
fi
118118

119+
# try with EUS disabled, if it does not work, then try just major version
120+
if ! dnf makecache --releasever=${DNF_RELEASEVER}; then
121+
# If pointing to DNF_RELEASEVER does not work, we point to the RHEL_MAJOR_VERSION as a last resort
122+
if ! dnf makecache --releasever=${RHEL_MAJOR_VERSION}; then
123+
echo "FATAL: failed to update the dnf metadata cache after multiple attempts with releasevers ${DNF_RELEASEVER}, ${RHEL_MAJOR_VERSION}"
124+
exit 1
125+
else
126+
DNF_RELEASEVER=${RHEL_MAJOR_VERSION}
127+
fi
128+
fi
129+
119130
echo "Installing Linux kernel headers..."
120131
dnf -q -y --releasever=${DNF_RELEASEVER} install kernel-headers-${KERNEL_VERSION} kernel-devel-${KERNEL_VERSION} > /dev/null
121132
ln -s /usr/src/kernels/${KERNEL_VERSION} /lib/modules/${KERNEL_VERSION}/build
@@ -189,7 +200,7 @@ _create_driver_package() (
189200
local nvidia_modeset_sign_args=""
190201
local nvidia_uvm_sign_args=""
191202

192-
trap "make -s -j SYSSRC=/lib/modules/${KERNEL_VERSION}/build clean > /dev/null" EXIT
203+
trap "make -s -j ${MAX_THREADS} SYSSRC=/lib/modules/${KERNEL_VERSION}/build clean > /dev/null" EXIT
193204

194205
echo "Compiling NVIDIA driver kernel modules..."
195206
cd /usr/src/nvidia-${DRIVER_VERSION}/${KERNEL_TYPE}
@@ -209,7 +220,7 @@ _create_driver_package() (
209220
fi
210221
fi
211222

212-
make -s -j SYSSRC=/lib/modules/${KERNEL_VERSION}/build nv-linux.o nv-modeset-linux.o > /dev/null
223+
make -s -j ${MAX_THREADS} SYSSRC=/lib/modules/${KERNEL_VERSION}/build nv-linux.o nv-modeset-linux.o > /dev/null
213224

214225
echo "Relinking NVIDIA driver kernel modules..."
215226
rm -f nvidia.ko nvidia-modeset.ko
@@ -660,7 +671,7 @@ update() {
660671
fi
661672
exec 3>&-
662673

663-
# vgpu driver version is choosen dynamically during runtime, so pre-compile modules for
674+
# vgpu driver version is chosen dynamically during runtime, so pre-compile modules for
664675
# only non-vgpu driver types
665676
if [ "${DRIVER_TYPE}" != "vgpu" ]; then
666677
# Install the userspace components and copy the kernel module sources.
@@ -739,10 +750,10 @@ usage() {
739750
Usage: $0 COMMAND [ARG...]
740751
741752
Commands:
742-
init [-a | --accept-license]
743-
build [-a | --accept-license]
753+
init [-a | --accept-license] [-m | --max-threads MAX_THREADS]
754+
build [-a | --accept-license] [-m | --max-threads MAX_THREADS]
744755
load
745-
update [-k | --kernel VERSION] [-s | --sign KEYID] [-t | --tag TAG]
756+
update [-k | --kernel VERSION] [-s | --sign KEYID] [-t | --tag TAG] [-m | --max-threads MAX_THREADS]
746757
EOF
747758
exit 1
748759
}
@@ -752,10 +763,10 @@ if [ $# -eq 0 ]; then
752763
fi
753764
command=$1; shift
754765
case "${command}" in
755-
init) options=$(getopt -l accept-license -o a -- "$@") ;;
756-
build) options=$(getopt -l accept-license,tag: -o a:t -- "$@") ;;
766+
init) options=$(getopt -l accept-license,max-threads: -o am: -- "$@") ;;
767+
build) options=$(getopt -l accept-license,tag:,max-threads: -o a:t:m: -- "$@") ;;
757768
load) options="" ;;
758-
update) options=$(getopt -l kernel:,sign:,tag: -o k:s:t: -- "$@") ;;
769+
update) options=$(getopt -l kernel:,sign:,tag:,max-threads: -o k:s:t:m: -- "$@") ;;
759770
reload_nvidia_peermem) options="" ;;
760771
probe_nvidia_peermem) options="" ;;
761772
*) usage ;;
@@ -766,6 +777,7 @@ fi
766777
eval set -- "${options}"
767778

768779
ACCEPT_LICENSE=""
780+
MAX_THREADS=""
769781
KERNEL_VERSION=$(uname -r)
770782
PRIVATE_KEY=""
771783
PACKAGE_TAG=""
@@ -774,6 +786,7 @@ for opt in ${options}; do
774786
case "$opt" in
775787
-a | --accept-license) ACCEPT_LICENSE="yes"; shift 1 ;;
776788
-k | --kernel) KERNEL_VERSION=$2; shift 2 ;;
789+
-m | --max-threads) MAX_THREADS=$2; shift 2 ;;
777790
-s | --sign) PRIVATE_KEY=$2; shift 2 ;;
778791
-t | --tag) PACKAGE_TAG=$2; shift 2 ;;
779792
--) shift; break ;;

0 commit comments

Comments
 (0)