Compile nVidia v256.53 on Kernel 3.1

As luck would have it my Asus board needs to run on v256 because anything higher the audio dies after an X reboot (See nVidia Asus Board Gefore 8330.

But starting with kernel 3.0 it will no longer compile, so out came the hacker in me and started hacking away at the files and i got it to work. Not much modification needs to be made to get it to work actually. Most of it is just test to make sure the kernel is a hard-coded compatible one.

Here is how to do it

1) Download the driver
v256.53 64x
v256.53 32

2) make is executable
chmod a+x NVIDIA-Linux-i386-256.53.run

3) start the installation process with the –keep command line
./NVIDIA-Linux-i386-256.53.run --keep

4) when the License agrement hits, press CTRL+c to stop the installation

5) Create a patch file in your fav editor (vi, nano, what ever)

diff -u NVIDIA-Linux-x86_64-256.53/kernel/conftest.sh kernel/conftest.sh
--- NVIDIA-Linux-x86_64-256.53/kernel/conftest.sh       2010-08-27 23:28:03.000000000 -0400
+++ kernel/conftest.sh  2011-12-30 18:17:02.927239154 -0500
@@ -76,10 +76,9 @@
 }

 build_cflags() {
-    BASE_CFLAGS="-D__KERNEL__ \
+    BASE_CFLAGS="-O2 -D__KERNEL__ \
 -DKBUILD_BASENAME=\"#conftest$$\" -DKBUILD_MODNAME=\"#conftest$$\" \
 -nostdinc -isystem $ISYSTEM"
-
     if [ "$OUTPUT" != "$SOURCES" ]; then
         OUTPUT_CFLAGS="-I$OUTPUT/include2 -I$OUTPUT/include"
         if [ -f "$OUTPUT/include/generated/autoconf.h" ]; then
diff -u NVIDIA-Linux-x86_64-256.53/kernel/nv.c kernel/nv.c
--- NVIDIA-Linux-x86_64-256.53/kernel/nv.c      2010-08-27 23:28:03.000000000 -0400
+++ kernel/nv.c 2011-12-30 18:17:10.259238711 -0500
@@ -423,7 +423,6 @@
 static struct file_operations nv_fops = {
     .owner     = THIS_MODULE,
     .poll      = nv_kern_poll,
-    .ioctl     = nv_kern_ioctl,
 #if defined(HAVE_UNLOCKED_IOCTL)
     .unlocked_ioctl = nv_kern_unlocked_ioctl,
 #endif
diff -u NVIDIA-Linux-x86_64-256.53/kernel/nv-linux.h kernel/nv-linux.h
--- NVIDIA-Linux-x86_64-256.53/kernel/nv-linux.h        2010-08-27 23:28:03.000000000 -0400
+++ kernel/nv-linux.h   2011-12-30 18:17:06.935238932 -0500
@@ -34,6 +34,8 @@
 #  error This driver does not support 2.5 kernels!
 #elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 7, 0)
 #  define KERNEL_2_6
+#elif LINUX_VERSION_CODE < KERNEL_VERSION(3, 1, 99)
+#  define KERNEL_2_6
 #else
 #  error This driver does not support development kernels!
 #endif
@@ -87,7 +89,7 @@
 #if !defined(KERNEL_2_4)
 #include             /* suser(), capable() replacement   */
 #include       /* module_param()                   */
-#include          /* kernel_locked                    */
+/*#include          /* kernel_locked                    */
 #include            /* flush_tlb(), flush_tlb_all()     */
 #include          /* page table entry lookup          */
 #endif

6) patch your insatllation (where yourpatch.diff is the filename of the patch you just created)
patch -p0 < yourpatch.diff

7) run the nvidia installer
NVIDIA-Linux-x86_64-256.53/nvidia-installer

8) Continue as normal

This entry was posted in Uncategorized. Bookmark the permalink.

3 Responses to Compile nVidia v256.53 on Kernel 3.1

  1. admin says:

    Bad news… Newest X doesnt support that driver any more!

  2. fabien says:

    Hi
    I get this error while patching and then the install fails

    Hunk #2 FAILED at 89.
    1 out of 2 hunks FAILED — saving rejects to file NVIDIA-Linux-x86_64-256.53/kernel/nv-linux.h.rej

    Do you have any idea why ?

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>