Tuesday, September 02, 2008

manually upgrade x11-drivers/nvidia-drivers

Upgrade kernel to v2.6.27-rc5, x11-drivers/nvidia-drivers have not support so late kernel,

So let's upgrade it manually:


Index: NVIDIA-Linux-x86-173.14.12-pkg0/usr/src/nv/nv-linux.h
--- NVIDIA-Linux-x86-173.14.12-pkg0.orig/usr/src/nv/nv-linux.h
+++ NVIDIA-Linux-x86-173.14.12-pkg0/usr/src/nv/nv-linux.h
@@ -77,6 +77,7 @@

#if !defined(KERNEL_2_4)
#include <linux/sched.h> /* suser(), capable() replacement */
+#include <linux/pid.h> /* for find_pid */
#include <linux/moduleparam.h> /* module_param() */
#include <linux/smp_lock.h> /* kernel_locked */
#include <asm/tlbflush.h> /* flush_tlb(), flush_tlb_all() */

@@ -104,7 +105,7 @@

#include <linux/spinlock.h>
-#include <asm/semaphore.h>
+#include <linux/semaphore.h>
#include <linux/completion.h>
#include <linux/highmem.h>

Index: NVIDIA-Linux-x86-173.14.12-pkg0/usr/src/nv/os-interface.c
--- NVIDIA-Linux-x86-173.14.12-pkg0.orig/usr/src/nv/os-interface.c
+++ NVIDIA-Linux-x86-173.14.12-pkg0/usr/src/nv/os-interface.c
@@ -704,7 +704,7 @@ RM_STATUS NV_API_CALL os_kill_process(
U032 sig
- return kill_proc(pid, sig, 1) ? RM_ERR_OPERATING_SYSTEM : RM_OK;
+ return kill_pid(find_vpid(pid), sig, 1) ? RM_ERR_OPERATING_SYSTEM : RM_OK;



this patch also reflects some changes in 2.6.27:
1. asm/semaphore.h => linux/semaphore.h stands a common implementation in all arch;
2. kill_proc => kill_pid

But there's still a problem haven't been resolved, it reports license issues in modpost phase:
1. kill_pid is exported with EXPORT_SYMBOL_GPL, can be used only by GPL code;
2. nvidia.ko is licensed with "NVIDIA", not GPL;

# cd /var/tmp/portage/x11-drivers/nvidia-drivers-173.14.12/work/NVIDIA-Linux-x86-173.14.12-pkg0/usr/src/nv/

# make -C /usr/src/linux-2.6.27-rc5/ M=$PWD modules

the core functionality of nvidia.ko is hidden in nv-kernel.o, that's completely binary, there's no corespoding nv-kernel.c, results of `strings` told that the license is declared in this binary file;

the last killer approach is hexeditor! use it to hexedit the string to "GPL\0", compiling well, insmod well, all runs OK!

Hexediting is an ugly hack, hope my next machine can run toally under free operating system, no hidden binary anymore!

No comments: