From ab1a0f9316f771394f0f9738a6f6fac544683a19 Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Mon, 16 Dec 2019 10:07:24 +0100 Subject: [PATCH 1/2] nvidiactl: Refactor Refactor fallback to nouveau driver into function. --- nvidiactl/nvidiactl | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/nvidiactl/nvidiactl b/nvidiactl/nvidiactl index 71845fa..fb91818 100755 --- a/nvidiactl/nvidiactl +++ b/nvidiactl/nvidiactl @@ -5,6 +5,16 @@ set_generic_mxgfx_link () { ln -sf /usr/share/mxgfx-generic /node/usr_share_mxgfx } +use_nouveau () { + set_generic_mxgfx_link + test -e /lib/modules/${kver}/kernel/drivers/gpu/drm/nouveau/nouveau.ko && \ + echo >&2 "NOTE: using nouveau.." && \ + modprobe nouveau && \ + exit 0 + + echo >&2 "ERROR: nouveau module not available." + exit 1 +} if [ -d /sys/module/nouveau ] ; then echo >&2 "NOTE: nouveau driver loaded already, using 'mxgfx-generic'." @@ -30,14 +40,8 @@ pciids="${PCIIDHINT_DIR}/${kver}-${nvver} ${PCIIDHINT_DIR}/${nvver}" for leglvlhint in ${pciids} ; do if [ -h "${leglvlhint}" ] ; then - set_generic_mxgfx_link - test -e /lib/modules/${kver}/kernel/drivers/gpu/drm/nouveau/nouveau.ko && \ - echo >&2 "NOTE: legacy nvidia card found, loading nouveau .." && \ - modprobe nouveau && \ - exit 0 - - echo >&2 "ERROR: nouveau module not available, choose a newer kernel!" - exit 1 + echo >&2 "NOTE: legacy nvidia card found.." + use_nouveau fi done From cf4cd8bf52a95c17158bf39ee592f91a0a5261bc Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Mon, 16 Dec 2019 10:09:56 +0100 Subject: [PATCH 2/2] nvidiactl: Use nouveau driver if nvidia not installed Kernels for early testing or for servers don't necessaily have the nvidia driver installed. If we are on such a kernel and have an nvidia card installed, fall back to nouveau driver. --- nvidiactl/nvidiactl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nvidiactl/nvidiactl b/nvidiactl/nvidiactl index fb91818..03688d9 100755 --- a/nvidiactl/nvidiactl +++ b/nvidiactl/nvidiactl @@ -48,8 +48,8 @@ done nvlink=/usr/share/nvidia/kernel/${kver}/current if [ ! -h ${nvlink} ] ; then - echo >&2 "WARNING: ${nvlink} is not a link (to nvversion) .." - exit 1 + echo >&2 "WARNING: NVIDIA driver not installed for kernel version ${kver}.." + use_nouveau fi nvver=$(readlink ${nvlink})