Skip to content

Commit

Permalink
nvidiactl: Rename leglink to nvlink
Browse files Browse the repository at this point in the history
Rationale:
- code is better to read (esp. at the end)
- we want to get rid of the legacy drivers
  • Loading branch information
thomas committed Feb 21, 2018
1 parent f3644eb commit 11a4b92
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions nvidiactl/nvidiactl
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,19 @@ for leglvlhint in ${pciids} ; do
fi
done

leglink=/usr/share/nvidia/kernel/${kver}/${leglvl}
nvlink=/usr/share/nvidia/kernel/${kver}/${leglvl}

if [ ! -h ${leglink} ] ; then
echo >&2 "WARNING: ${leglink} is not a link (to nvversion) trying current.."
leglink=/usr/share/nvidia/kernel/${kver}/current
if [ ! -h ${nvlink} ] ; then
echo >&2 "WARNING: ${nvlink} is not a link (to nvversion) trying current.."
nvlink=/usr/share/nvidia/kernel/${kver}/current
fi

if [ ! -h ${leglink} ] ; then
echo >&2 "WARNING: ${leglink} is not a link (to nvversion) .."
if [ ! -h ${nvlink} ] ; then
echo >&2 "WARNING: ${nvlink} is not a link (to nvversion) .."
exit 1
fi

nvver=$(readlink ${leglink})
nvver=$(readlink ${nvlink})

#echo "kver=${kver} leglvl=${leglvl} nvver=${nvver}"

Expand All @@ -52,7 +52,7 @@ ln -sf /usr/share/nvidia/${nvver} /node/usr_share_mxgfx
test -e /lib/modules/$kver/kernel/drivers/gpu/drm/drm.ko && modprobe drm
test -e /lib/modules/$kver/kernel/drivers/gpu/drm/drm_kms_helper.ko && modprobe drm_kms_helper

insmod ${leglink}/nvidia.ko
insmod ${nvlink}/nvidia.ko

# Count the number of NVIDIA controllers found.
NVDEVS=$(lspci | grep -i NVIDIA)
Expand All @@ -67,14 +67,14 @@ if [ ! -z $N ]; then
mknod -m 666 /dev/nvidiactl c 195 255

# CUDA
if [ -e ${leglink}/nvidia-uvm.ko ]; then
insmod ${leglink}/nvidia-uvm.ko
if [ -e ${nvlink}/nvidia-uvm.ko ]; then
insmod ${nvlink}/nvidia-uvm.ko
D=$(grep nvidia-uvm /proc/devices | awk '{print $1}')
if [ ! -z $D ]; then
mknod -m 666 /dev/nvidia-uvm c $D 0
fi
fi
test -e ${leglink}/nvidia-modeset.ko && insmod ${leglink}/nvidia-modeset.ko
test -e ${leglink}/nvidia-drm.ko && insmod ${leglink}/nvidia-drm.ko
test -e ${nvlink}/nvidia-modeset.ko && insmod ${nvlink}/nvidia-modeset.ko
test -e ${nvlink}/nvidia-drm.ko && insmod ${nvlink}/nvidia-drm.ko
fi
exit 0

0 comments on commit 11a4b92

Please sign in to comment.