Saturday, May 6, 2017

Compiling Nvidia 340.102 driver for Linux 4.10.x kernel

Upgraded my Tumbleweed to kernel 4.10.x and Nvidia 340 driver won't build.  Until Nvidia fix it, here are steps to patch the 340.102 driver to make it works.

Download the 340.102 driver from Nvidia:
http://www.nvidia.ca/object/unix.html

Unpack the driver:
./NVIDIA-Linux-x86_64-340.102.run -x

Apply patch for kernel 4.9.x:
https://pkgs.rpmfusion.org/cgit/nonfree/nvidia-340xx-kmod.git/tree/4.9.0_kernel.patch

Apply patch for kernel 4.10.x:
https://raw.githubusercontent.com/MilhouseVH/LibreELEC.tv/8d3956f72d79ea3648b19f4c705a38307bb03efb/packages/x11/driver/xf86-video-nvidia-legacy/patches/xf86-video-nvidia-legacy-kernel-4.10.patch

Proceed to install. Note that the unified memory module can't be built with this patch, so we are disabling it:
sudo ./nvidia-installer --no-unified-memory