summaryrefslogtreecommitdiff
path: root/x11-drivers
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2017-07-01 06:25:42 +0100
committerV3n3RiX <venerix@redcorelinux.org>2017-07-01 06:25:42 +0100
commitb6cfe8d79d9d9b75fef613e47e7ebfbeb3ea0575 (patch)
tree454f2e9b21490dccabcc2079df4faf64fe440a9d /x11-drivers
parent9cde11187ee3ce44b76343c2d95c018431012d34 (diff)
x11-drivers/nvidia-drivers : insert modprobe && udev rules when using dkms
Diffstat (limited to 'x11-drivers')
-rw-r--r--x11-drivers/nvidia-drivers/files/nvidia-169.0714
-rw-r--r--x11-drivers/nvidia-drivers/files/nvidia-rmmod.conf3
-rw-r--r--x11-drivers/nvidia-drivers/files/nvidia-udev.sh-r120
-rw-r--r--x11-drivers/nvidia-drivers/files/nvidia.udev-rule6
-rw-r--r--x11-drivers/nvidia-drivers/nvidia-drivers-381.22-r2.ebuild (renamed from x11-drivers/nvidia-drivers/nvidia-drivers-381.22-r1.ebuild)9
5 files changed, 52 insertions, 0 deletions
diff --git a/x11-drivers/nvidia-drivers/files/nvidia-169.07 b/x11-drivers/nvidia-drivers/files/nvidia-169.07
new file mode 100644
index 00000000..a96b0cd1
--- /dev/null
+++ b/x11-drivers/nvidia-drivers/files/nvidia-169.07
@@ -0,0 +1,14 @@
+# Nvidia drivers support
+alias char-major-195 nvidia
+alias /dev/nvidiactl char-major-195
+
+# To tweak the driver the following options can be used, note that
+# you should be careful, as it could cause instability!! For more
+# options see /usr/share/doc/PACKAGE/README
+#
+# !!! SECURITY WARNING !!!
+# DO NOT MODIFY OR REMOVE THE DEVICE FILE RELATED OPTIONS UNLESS YOU KNOW
+# WHAT YOU ARE DOING.
+# ONLY ADD TRUSTED USERS TO THE VIDEO GROUP, THESE USERS MAY BE ABLE TO CRASH,
+# COMPROMISE, OR IRREPARABLY DAMAGE THE MACHINE.
+options nvidia NVreg_DeviceFileMode=432 NVreg_DeviceFileUID=0 NVreg_DeviceFileGID=VIDEOGID NVreg_ModifyDeviceFiles=1
diff --git a/x11-drivers/nvidia-drivers/files/nvidia-rmmod.conf b/x11-drivers/nvidia-drivers/files/nvidia-rmmod.conf
new file mode 100644
index 00000000..618b9b30
--- /dev/null
+++ b/x11-drivers/nvidia-drivers/files/nvidia-rmmod.conf
@@ -0,0 +1,3 @@
+# Nvidia UVM support
+
+remove nvidia modprobe -r --ignore-remove nvidia-drm nvidia-modeset nvidia-uvm nvidia
diff --git a/x11-drivers/nvidia-drivers/files/nvidia-udev.sh-r1 b/x11-drivers/nvidia-drivers/files/nvidia-udev.sh-r1
new file mode 100644
index 00000000..6579bf74
--- /dev/null
+++ b/x11-drivers/nvidia-drivers/files/nvidia-udev.sh-r1
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+if [ $# -ne 1 ]; then
+ echo "Invalid args" >&2
+ exit 1
+fi
+
+case $1 in
+ add|ADD)
+ #hopefully this prevents infinite loops like bug #454740
+ if lsmod | grep -iq nvidia; then
+ /opt/bin/nvidia-smi > /dev/null
+ fi
+ ;;
+ remove|REMOVE)
+ rm -f /dev/nvidia*
+ ;;
+esac
+
+exit 0
diff --git a/x11-drivers/nvidia-drivers/files/nvidia.udev-rule b/x11-drivers/nvidia-drivers/files/nvidia.udev-rule
new file mode 100644
index 00000000..2eb30bb0
--- /dev/null
+++ b/x11-drivers/nvidia-drivers/files/nvidia.udev-rule
@@ -0,0 +1,6 @@
+ACTION=="add", DEVPATH=="/module/nvidia", SUBSYSTEM=="module", RUN+="nvidia-udev.sh $env{ACTION}"
+# Previously the ACTION was "add|remove" but one user on bug #376527 had a
+# problem until he recompiled udev-171-r5, which is one of the versions I
+# tested with and it was fine. I'm breaking the rules out just to be safe
+# so someone else doesn't have an issue
+ACTION=="remove", DEVPATH=="/module/nvidia", SUBSYSTEM=="module", RUN+="nvidia-udev.sh $env{ACTION}"
diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-381.22-r1.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-381.22-r2.ebuild
index 1d066de2..072db58d 100644
--- a/x11-drivers/nvidia-drivers/nvidia-drivers-381.22-r1.ebuild
+++ b/x11-drivers/nvidia-drivers/nvidia-drivers-381.22-r2.ebuild
@@ -284,6 +284,15 @@ src_install() {
exeinto "$(get_udevdir)"
newexe "${FILESDIR}"/nvidia-udev.sh-r1 nvidia-udev.sh
udev_newrules "${FILESDIR}"/nvidia.udev-rule 99-nvidia.rules
+ # Redcore Tweak : insert above modprobe && udev rules when using DKMS
+ elif use dkms && use kernel_linux; then
+ insinto /etc/modprobe.d
+ newins "${FILESDIR}"/nvidia-169.07 nvidia.conf
+ doins "${FILESDIR}"/nvidia-rmmod.conf
+
+ exeinto "$(get_udevdir)"
+ newexe "${FILESDIR}"/nvidia-udev.sh-r1 nvidia-udev.sh
+ udev_newrules "${FILESDIR}"/nvidia.udev-rule 99-nvidia.rules
elif use kernel_FreeBSD; then
if use x86-fbsd; then
insinto /boot/modules