Building nvidia driver on kernel 3.9.0


Having trouble with installing the nvidia driver on a 3.9.0. kernel. I get following error message :

from /usr/src/NVIDIA-Linux-x86_64-319.17/kernel/nv-linux.h:115,
from /usr/src/NVIDIA-Linux-x86_64-319.17/kernel/nv-i2c.c:15:
/usr/src/linux-3.9.0/arch/x86/include/asm/uaccess_64.h: In function ‘copy_from_user’:
/usr/src/linux-3.9.0/arch/x86/include/asm/uaccess_64.h:62:6: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
/usr/src/NVIDIA-Linux-x86_64-319.17/kernel/nv-i2c.c: In function ‘nv_i2c_del_adapter’:
/usr/src/NVIDIA-Linux-x86_64-319.17/kernel/nv-i2c.c:316:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
/usr/src/NVIDIA-Linux-x86_64-319.17/kernel/nv-i2c.c:328:13: error: void value not ignored as it ought to be
make[4]: *** [/usr/src/NVIDIA-Linux-x86_64-319.17/kernel/nv-i2c.o] Error 1
make[3]: *** [module/usr/src/NVIDIA-Linux-x86_64-319.17/kernel] Error 2
make[2]: *** [sub-make] Error 2
nvidia.ko failed to build!
make[1]: *** [module] Error 1
make: *** [install] Error 2

I did a fair bit of googling around, but I have no clue how to solve this … I also tried with former versions of the driver .


I have this error too, but it is on 3.10-rc1 kernel. On 3.9.0 and 3.9.1 it was working ok.
Here is the DKMS make log for 319.17 on 3.10-rc1:

this should work:

@@ -311,8 +311,6 @@
 BOOL NV_API_CALL nv_i2c_del_adapter(nv_state_t *nv, void *data)
     struct i2c_adapter *pI2cAdapter = (struct i2c_adapter *)data;
-    int osstatus = 0;
-    BOOL wasReleased = FALSE;
 #if defined(KERNEL_2_4)
     if (!NV_WEAK_SYMBOL_PRESENT(i2c_add_adapter))
@@ -324,15 +322,10 @@
     if (!pI2cAdapter) return FALSE;
     // attempt release with the OS
-    osstatus = i2c_del_adapter(pI2cAdapter);
+    i2c_del_adapter(pI2cAdapter);
+    os_free_mem(pI2cAdapter);
-    if (!osstatus)
-    {
-        os_free_mem(pI2cAdapter);
-        wasReleased = TRUE;
-    }
-    return wasReleased;
+    return TRUE;
 #else // (defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE))

but there is a worse problem with this:

Does anyone have any patch for nv-procfs.c file errors? :) I tried to exclude it from driver compile (deleted it from “make files”, but then I get this: " FATAL: modpost: GPL-incompatible module nvidia.ko uses GPL-only symbol ‘system_wq’ "

install today linux-3.9.2 in archlinux and build nvidia 319.17 without problem (through DKMS, with my own package, not from the repos)

essentially: me too.

304.88-1 and 304.88-2 are suddenly broken via “nv-i2c.c function ‘nv_i2c_del_adapter’ : error: void value not ignored as it ought to be”

then any kernel >= 3.10.0-rc1 breaks nv-procfs.c due to the create_proc_entry() to proc_create() transition.

in short, beware of doing update/dist-upgrade on a debian-oid box after today if you own an nvidia card (if for no other reason dkms will be directed to remove a working module and replace with one that will not compile)

thank you folks for trying to fix this.

Sorry to be so late with answering . I tried the proposed patch - Thanks - but it doesn’t work .
And it seems there are also other problems with the installation of the driver.


The patch works in that it eliminates some of the errors on 3.10-rc1. I’m working on the issues with proc. The new interface has been in kernel for some time, it’s just the removal of the old one that’s recent. Strictly a spare-time effort, though, so it will be a bit. :)

— 2013-05-18 22:56:22.529438000 -0430
+++ 2013-05-18 23:05:41.939250703 -0430
@@ -203,7 +203,7 @@

 if [ "$OUTPUT" != "$SOURCES" ]; then
  •    if [ "$ARCH" = "i386" -o "$ARCH" = "x86_64" ]; then
  •    if [ "$ARCH" = "x86" -o "$ARCH" = "x86_64" ]; then
           MACH_CFLAGS="$MACH_CFLAGS -I$HEADERS/asm-x86/mach-default"
           MACH_CFLAGS="$MACH_CFLAGS -I$SOURCES/arch/x86/include/asm/mach-default"
           MACH_CFLAGS="$MACH_CFLAGS -I$HEADERS/arch/x86/include/uapi"

@@ -217,7 +217,7 @@

  •    if [ "$ARCH" = "i386" -o "$ARCH" = "x86_64" ]; then
  •    if [ "$ARCH" = "x86" -o "$ARCH" = "x86_64" ]; then
           MACH_CFLAGS="$MACH_CFLAGS -I$HEADERS/asm-x86/mach-default"
           MACH_CFLAGS="$MACH_CFLAGS -I$SOURCES/arch/x86/include/asm/mach-default"
           MACH_CFLAGS="$MACH_CFLAGS -I$HEADERS/arch/x86/include/uapi"

@@ -234,7 +234,7 @@
CFLAGS="$CFLAGS -I$HEADERS -I$HEADERS/uapi -I$OUTPUT/include/generated/uapi"

  • if [ “$ARCH” = “i386” -o “$ARCH” = “x86_64” ]; then
  • if [ “$ARCH” = “x86” -o “$ARCH” = “x86_64” ]; then
    CFLAGS="$CFLAGS -I$SOURCES/arch/x86/include"
    CFLAGS="$CFLAGS -I$SOURCES/arch/x86/include/uapi"
    CFLAGS="$CFLAGS -I$OUTPUT/arch/x86/include/generated"

I managed to replace “create_proc_entry” in nv-procfs.c with new “proc_create”, and it compiles and work with that on 3.9.1 kernel (but yet again, normal 319.17 driver works for me on that kernel). But then I started 3.10-rc1 kernel, and module does compile (there was an error “error dereferencing pointer to incomplete type”), but can’t be loaded. In “dmesg” there was this: nvidia disagrees about version of symbol module_layout

I don’t know how to make a patch, so here is the #define part of nv-procfs.c that I changed:

I tried to add “proc_fops” as 4th argument for “proc_create” as it is in kernels proc_fs.h file, but nothing changes, there is the same error as I mentioned above.

BTW, I’m not a programer, so please help with this. I believe I’m on a right path here. :)

So module compilled with error? Try to add this structure:

static const struct file_operations proc_file_fops = {
 .owner = THIS_MODULE,
 .open  = open_callback,
 .read  = read_callback,

And then, modify your proc_create to:

proc_create(name, mode, parent, &proc_file_fops);

Now we only need definitions for the “open_callback” and “read_callback”. That’s a placeholder (I also found that snippet on stackoverlow…)

@Nekroman: Well, it did say “Modul build complited”, and I had nvidia.ko in “kernel” folder. Maybe it remained from when I compiled it in 3.9.1. :S

I’ll try this and see if it works. And if it doesn’t work, I’ll post nvidia-install.log

It doesn’t work. Here is the nvidia-installer.log:

@Milos_SD: it looks like you set this structure:
static const struct file_operations proc_file_fops = {
.owner = THIS_MODULE,
.open = open_callback,
.read = read_callback,
but didn’t provide any proper callback function for “open_callback” nor “read_callback”. perhaps even just a stub function would get beyond this point.

good for you-all for continuing to pound on this! because otherwise, it’s nouveau for some of us from here on out (not that that’s terrible… but it’s a bit glitchy)

I’m still working on it. Open and read are fairly trivial using the seq_file API - it’s writes that are more complicated, which impacts only the registry entry. I have it compiling but I’m fairly sure the write code is not correct. You also need at least 3.10-rc2 to try on 3.10, as 3.10-rc1 broken some workqueue APIs for non-GPL modules.

Compiles on 3.9.x, 3.10-rc2+, tested on 3.10-rc2. Didn’t test write case for the registry /proc files but I think they’re correct.

How do I patch .run file with this? I did: sh --apply-patch nvidia-3.10-rc2.diff
but I’m getting asked what file to patch. :S

EDIT: I just extracted the .run package and patched it with “patch -p1” command.

Thanks @Unhelpful for the patch, it is working great. :)

I compilled it now, but just simple optirun glxgears is giving me some errors, so I don’t think it’s enough or I just really fucked up something :D

Interesting, have GL compositing, glxgears, and CUDA all working, and poking around in /proc shows what appear to be sane values. I have no idea what to write to the registry files, so write on them is the only thing I didn’t test. I don’t have an optimus system, so I can’t test that… what sort of errors did you see?