Saturday, April 19, 2008

NVIDIA driver on Linux Kernel 2.6.25

The current Nvidia driver (NVIDIA-Linux-x86_64-169.12-pkg2.run) is somehow broken with Linux kernel 2.6.25. I googled and found discussion about this. Some people suggested to replace EXPORT_UNUSED_SYMBOL(init_mm) to EXPORT_SYMBOL(init_mm) in
/usr/src/linux/arch/x86/kernel/init_task.c. It didn't work (at least on my machine).

I look at the error log in /var/log/nvidia-installer.log. The last few lines in the file told me the global_flush_tlb() was implicitly declared (meaning, it was no longer exported by the Linux kernel. People in the discussion forum mentioned since 2.6.24 or something) while trying to compile nv-vm.c. This look weird, so I extracted the Nvidia driver with the following command:

sh download/nvidia/NVIDIA-Linux-x86_64-169.12-pkg2.run -a -q -n -x

This command extracted both binary files and its source codes onto NVIDIA-Linux-x86_64-169.12-pkg2/
I then cd to NVIDIA-Linux-x86_64-169.12-pkg2/usr/src/nv and commented out calling to that procedure. Here's my modified procedure of that file:

static void nv_flush_caches(void)
{
#if defined(KERNEL_2_4)
// for 2.4 kernels, just automatically flush the caches and invalidate tlbs
nv_execute_on_all_cpus(cache_flush, NULL);
#else
// for 2.6 (and later) kernels, rely on global_flush_tlb
#if defined(NV_CPA_NEEDS_FLUSHING)
nv_execute_on_all_cpus(cache_flush, NULL);
#endif
#if defined (NVCPU_X86) || defined (NVCPU_X86_64)
//global_flush_tlb();
#endif
nv_ext_flush_caches(); // handle other platform flushes if present
#endif
}

I then manually compile the code usual way (make module) from that folder and did "make install" (executed as root). For the binary files, I just manually copied them to their proper places.

Nervously, I typed "startx" and voila....my Xwindows started successfuly! So far, I haven't noticed any anomalies nor problems (this blog is actually done from my machine running the new driver). Apparently, the latest kernel doesn't require flushing cache anymore (it must be done automatically elsewhere).

No comments:

Post a Comment