After updating my linux machine ( Opensuse Tumbleweed ) to the latest kernel 4.6.2 ( from 4.5 ) my Nvidia driver refused to build. Apparently some interface changes in the new kernel broke the driver.
Managed to create a small patch to fix the issues.
- The following websites helped in building the patch below that works for me:
- get_user_pages() problem
- page_cache_release() problem
- VM_FAULT_MINOR problem
First download the nvidia.patch file from this repo. Then run: ( There are other patches out there like https://lists.opensuse.org/opensuse-factory/2016-06/msg00072.html , https://git.archlinux.org/svntogit/packages.git/plain/trunk/linux-4.6.patch?h=packages/nvidia-340xx but I couldn't get them to work for now )
./NVIDIA-Linux-x86_64-340.96.run --apply-patch nvidia.patch
This will create another archived executable with the name ending in _custom.run. Running this executable should successfully build and install the nvidia driver.
The nvidia driver was downloaded from the official nvidia website
If you need to play more with the sources of the driver you can unpack them with:
./NVIDIA-Linux-x86_64-340.96.run -x