lenny and Nvidia proprietary driver Howto

I tried to install the accelerated Nvidia drivers on a system with Debian lenny according to
http://wiki.debian.org/NvidiaGraphicsDrivers#non-free
(I used the debian specific method)

Unfortunately there are problems with the current debian package from Nvidia (version 169.09). It has a conflict with the X server of lenny.

The older version (1.0.8776) will produce compiler error with kernel 2.6.23 and newer.

So I made a patch for version 1.0.8776 that it compiles with newer kernels.

* Install nvidia-glx_1.0.8776-4_i386.deb, nvidia-kernel-source_1.0.8776-4_i386.deb,

This will install a source tarball in /usr/src/nvidia-kernel-source.tar.gz. Unpack it in /usr/src. For example, to unpack the source tarball of the current driver:
$ cd /usr/src
# tar -zxf nvidia-kernel-source_1.0.8776-4_i386.tar.gz

* Apply patch below:
Copy everything below "------------------" into a file (e.g. nvpatch)
cd to /usr/lib/modules where the proprietary extension nvidia-kernel is located
patch -p1 < nvpatch

* Build the kernel and the nvidia kernel module:
$ cd /usr/src/linux
# make-kpkg clean
# make-kpkg kernel_image modules_image

* Install the new kernel and kernel module:
$ cd /usr/src
# dpkg -i /path/kernel-image-*.deb /path/nvidia-kernel-*.deb

-------------------------------------------------------------------
diff -Nru modules/nvidia-kernel/nv/nv-linux.h modules_lennypatch/nvidia-kernel/nv/nv-linux.h
--- modules/nvidia-kernel/nv/nv-linux.h 2007-01-05 04:51:29.000000000 +0000
+++ modules_lennypatch/nvidia-kernel/nv/nv-linux.h 2008-03-09 15:01:46.000000000 +0000
@@ -31,6 +31,16 @@
# error This driver does not support development kernels!
#endif

+// #include "conftest.h"
+
+// #if defined(KERNEL_2_4)
+#if 1
+#define NV_KMEM_CACHE_CREATE_PRESENT
+#define NV_KMEM_CACHE_CREATE_ARGUMENT_COUNT 6
+#define NV_IRQ_HANDLER_T_TAKES_PTREGS
+#endif
+
+
#if defined (CONFIG_SMP) && !defined (__SMP__)
#define __SMP__
#endif
@@ -506,17 +516,40 @@
free_pages(ptr, order); \
}

+/*
#define NV_KMEM_CACHE_CREATE(kmem_cache, name, type) \
{ \
kmem_cache = kmem_cache_create(name, sizeof(type), \
0, 0, NULL, NULL); \
}
+*/

+#if defined(NV_KMEM_CACHE_CREATE_PRESENT)
+#if (NV_KMEM_CACHE_CREATE_ARGUMENT_COUNT == 6)
+// taken
+#define NV_KMEM_CACHE_CREATE(kmem_cache, name, type) \
+ { \
+ kmem_cache = kmem_cache_create(name, sizeof(type), \
+ 0, 0, /* NULL, */ NULL); \
+ }
+#elif (NV_KMEM_CACHE_CREATE_ARGUMENT_COUNT == 5)
+#define NV_KMEM_CACHE_CREATE(kmem_cache, name, type) \
+ { \
+ kmem_cache = kmem_cache_create(name, sizeof(type), \
+ 0, 0, NULL); \
+ }
+#else
+//#error "NV_KMEM_CACHE_CREATE_ARGUMENT_COUNT value unrecognized!"
+#endif
#define NV_KMEM_CACHE_DESTROY(kmem_cache) \
{ \
kmem_cache_destroy(kmem_cache); \
kmem_cache = NULL; \
}
+#else
+//#error "NV_KMEM_CACHE_CREATE() undefined (kmem_cache_create() unavailable)!"
+#endif
+

#define NV_KMEM_CACHE_ALLOC(ptr, kmem_cache, type) \
{ \
diff -Nru modules/nvidia-kernel/nv/nv.c modules_lennypatch/nvidia-kernel/nv/nv.c
--- modules/nvidia-kernel/nv/nv.c 2007-01-05 04:51:29.000000000 +0000
+++ modules_lennypatch/nvidia-kernel/nv/nv.c 2008-03-09 15:06:24.000000000 +0000
@@ -99,7 +99,8 @@
int nv_use_cpa = 1;
#endif

-static kmem_cache_t *nv_pte_t_cache = NULL;
+// V8776: static kmem_cache_t *nv_pte_t_cache = NULL;
+static void *nv_pte_t_cache = NULL;

// allow an easy way to convert all debug printfs related to events
// back and forth between 'info' and 'errors'
@@ -1453,8 +1454,9 @@
if (apm_nv_dev[i] != NULL) pm_unregister(apm_nv_dev[i]);
#endif

- if (unregister_chrdev(nv_major, "nvidia") < 0)
- nv_printf(NV_DBG_ERRORS, "NVRM: unregister nv chrdev failed\n");
+ /* if (unregister_chrdev(nv_major, "nvidia") < 0) */
+ // nv_printf(NV_DBG_ERRORS, "NVRM: unregister nv chrdev failed\n");
+ unregister_chrdev(nv_major, "nvidia");

for (i = 0; i < num_nv_devices; i++)
{
@@ -1478,8 +1480,9 @@

nv_printf(NV_DBG_INFO, "NVRM: nvidia_exit_module\n");

- if (unregister_chrdev(nv_major, "nvidia") < 0)
- nv_printf(NV_DBG_ERRORS, "NVRM: unregister nv chrdev failed\n");
+ /* if (unregister_chrdev(nv_major, "nvidia") < 0) */
+ // nv_printf(NV_DBG_ERRORS, "NVRM: unregister nv chrdev failed\n");
+ unregister_chrdev(nv_major, "nvidia");

for (i = 0; i < num_nv_devices; i++)
{

No votes yet
Syndicate content