346.47 on fedora 22 kernel 4.0.0-0.rc5.git4.1.fc22.x86_64

Hi. Am unable to compile nvidia drivers on latest fedora 22 kernel. Anyone else having similar issues? At any rate I guess I would like to report this problem.

The kernel version is 4.0.0-0.rc5.git4.1.fc22.x86_64 and I have the kernel-devel packages installed.

There is no /usr/bin/nvidia-bug-report.sh because it never finishes the install.

from the end of /var/log/nvidia-installer.log

 if [ "-pg" = "-pg" ]; then if [ /tmp/NVIDIA-Linux-x86_64-346.47/kernel/os-registry.o != "scripts/mod/empty.o" ]; then ./scripts/recordmcount  "/tmp/NVIDIA-Linux-x86_64-346.47/kernel/os-registry.o"; fi; fi;
 if [ "-pg" = "-pg" ]; then if [ /tmp/NVIDIA-Linux-x86_64-346.47/kernel/os-interface.o != "scripts/mod/empty.o" ]; then ./scripts/recordmcount  "/tmp/NVIDIA-Linux-x86_64-346.47/kernel/os-interface.o"; fi; fi;

/usr/src/kernels/4.0.0-0.rc5.git4.1.fc22.x86_64/Makefile:1394: recipe for target ‘module/tmp/NVIDIA-Linux-x86_64-346.47/kernel’ failed
make[2]: *** [module/tmp/NVIDIA-Linux-x86_64-346.47/kernel] Error 2
make[2]: Leaving directory ‘/usr/src/kernels/4.0.0-0.rc5.git4.1.fc22.x86_64’
Makefile:145: recipe for target ‘sub-make’ failed
make[1]: *** [sub-make] Error 2
make[1]: Leaving directory ‘/usr/src/kernels/4.0.0-0.rc5.git4.1.fc22.x86_64’
NVIDIA: left KBUILD.
nvidia.ko failed to build!
nvidia-modules-common.mk:248: recipe for target ‘module’ failed
make: *** [module] Error 1
-> Error.
ERROR: Unable to build the NVIDIA kernel module.
ERROR: Installation has failed. Please see the file ‘/var/log/nvidia-installer.log’ for details. You may find suggestions on fixing installation problems in the README available on the Linux driver download page at www.nvidia.com.

Thanks for any ideas anyone has. This is for the “bumblebee-nvidia” rpm package some fedora users (myself included) are using for optimus support on fedora. But I think it will also affect desktops.

346.47 does not support kernel 4.0-rc.
You need a patch for that

--- a/nv-pat.c.orig<--->2015-02-20 02:49:40.000000000 +0100
+++ b/nv-pat.c<>2015-02-25 07:56:40.000000000 +0100
@@ -35,8 +35,13 @@
     unsigned long cr0 = read_cr0();
     write_cr0(((cr0 & (0xdfffffff)) | 0x40000000));
     wbinvd();
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 20, 0)
     *cr4 = read_cr4();
     if (*cr4 & 0x80) write_cr4(*cr4 & ~0x80);
+#else
+    *cr4 = __read_cr4();
+    if (*cr4 & 0x80) __write_cr4(*cr4 & ~0x80);
+#endif
     __flush_tlb();
 }
.
@@ -46,7 +51,11 @@
     wbinvd();
     __flush_tlb();
     write_cr0((cr0 & 0x9fffffff));
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 20, 0)
     if (cr4 & 0x80) write_cr4(cr4);
+#else
+    if (cr4 & 0x80) __write_cr4(cr4);
+#endif
 }
.
 static int nv_determine_pat_mode(void)

Thanks so much. It worked.