diff options
author | Martin Schlemmer <azarah@gentoo.org> | 2004-06-15 21:26:33 +0000 |
---|---|---|
committer | Martin Schlemmer <azarah@gentoo.org> | 2004-06-15 21:26:33 +0000 |
commit | 147ff35ea0f3c04b30b2538f49c94c5075fa158c (patch) | |
tree | 89dc506ea43cd744cc955de3fb7176ed06f1109a /media-video | |
parent | dependancy update for #54013 (Manifest recommit) (diff) | |
download | gentoo-2-147ff35ea0f3c04b30b2538f49c94c5075fa158c.tar.gz gentoo-2-147ff35ea0f3c04b30b2538f49c94c5075fa158c.tar.bz2 gentoo-2-147ff35ea0f3c04b30b2538f49c94c5075fa158c.zip |
Add latest patch from minion.de (-2.6-20040521.patch) - should fix issues with
gcc-3.4 and kill some warnings for gcc-3.3.x, bug #50820. Update my sysfs
patch to actually work. The problem was that for the conftest.sh test we
needed to also add $(SYSSRC)/include/asm/mach-generic to KERNEL_HEADERS, else
the tests silently failed. This should close bug #51715. Also add a third
patch (-fix-makefile-for-2.6.patch) that should handle later 2.6 kernels
transparently, and allows us to add some nice cleanups to the ebuild.
Diffstat (limited to 'media-video')
7 files changed, 1227 insertions, 18 deletions
diff --git a/media-video/nvidia-kernel/ChangeLog b/media-video/nvidia-kernel/ChangeLog index ffa209c1ab32..06e8cfd966ac 100644 --- a/media-video/nvidia-kernel/ChangeLog +++ b/media-video/nvidia-kernel/ChangeLog @@ -1,6 +1,21 @@ # ChangeLog for media-video/nvidia-kernel # Copyright 2002-2004 Gentoo Technologies, Inc.; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/media-video/nvidia-kernel/ChangeLog,v 1.75 2004/05/16 02:14:22 cyfred Exp $ +# $Header: /var/cvsroot/gentoo-x86/media-video/nvidia-kernel/ChangeLog,v 1.76 2004/06/15 21:26:28 azarah Exp $ + +*nvidia-kernel-1.0.5336-r4 (15 Jun 2004) + + 15 Jun 2004; Martin Schlemmer <azarah@gentoo.org> + +files/1.0.5336/NVIDIA_kernel-1.0-5336-2.6-20040521.patch, + +files/1.0.5336/NVIDIA_kernel-1.0-5336-basic-sysfs-support-v2.patch, + +files/1.0.5336/NVIDIA_kernel-1.0-5336-fix-makefile-for-2.6.patch, + +nvidia-kernel-1.0.5336-r4.ebuild: + Add latest patch from minion.de (-2.6-20040521.patch) - should fix issues with + gcc-3.4 and kill some warnings for gcc-3.3.x, bug #50820. Update my sysfs + patch to actually work. The problem was that for the conftest.sh test we + needed to also add $(SYSSRC)/include/asm/mach-generic to KERNEL_HEADERS, else + the tests silently failed. This should close bug #51715. Also add a third + patch (-fix-makefile-for-2.6.patch) that should handle later 2.6 kernels + transparently, and allows us to add some nice cleanups to the ebuild. 16 May 2004; Andrew Bevitt <cyfred@gentoo.org>; nvidia-kernel-1.0.5336-r3.ebuild: diff --git a/media-video/nvidia-kernel/Manifest b/media-video/nvidia-kernel/Manifest index d7432472d4d3..d3514dc6b24a 100644 --- a/media-video/nvidia-kernel/Manifest +++ b/media-video/nvidia-kernel/Manifest @@ -1,31 +1,36 @@ -MD5 e10ab910c03ebb85f4127f404a51034e nvidia-kernel-1.0.4499.ebuild 4018 -MD5 5cc7ee0513c5a802ef5ddd4b9c5f969e nvidia-kernel-1.0.5332-r1.ebuild 4247 -MD5 2bcece4880b7f85538090a66abcb9b24 nvidia-kernel-1.0.5336-r3.ebuild 4620 MD5 fda24a66f5cf039b25d9396076ec71ab nvidia-kernel-1.0.5328-r1.ebuild 4456 -MD5 c48cb5e4030504bc2accc430fc347e42 nvidia-kernel-1.0.4496-r3.ebuild 4276 -MD5 b8f9a81bca2535fd82321a80fb102ec6 nvidia-kernel-1.0.4363-r3.ebuild 4062 MD5 1b454e8926c8340e7e3accafbca675d3 nvidia-kernel-1.0.5336-r2.ebuild 4657 MD5 7015b0bbdd30578f52f8b9e796f8b4e9 ChangeLog 17314 +MD5 5cc7ee0513c5a802ef5ddd4b9c5f969e nvidia-kernel-1.0.5332-r1.ebuild 4247 +MD5 1457559b0186868c65de3c3f6711f4b2 nvidia-kernel-1.0.5336-r4.ebuild 4601 +MD5 b8f9a81bca2535fd82321a80fb102ec6 nvidia-kernel-1.0.4363-r3.ebuild 4062 +MD5 c48cb5e4030504bc2accc430fc347e42 nvidia-kernel-1.0.4496-r3.ebuild 4276 +MD5 e10ab910c03ebb85f4127f404a51034e nvidia-kernel-1.0.4499.ebuild 4018 MD5 fe2f0a492565eb0ae0831e308df50664 metadata.xml 158 -MD5 497ffcbd6a91ed9447dfdf7b736925bd files/digest-nvidia-kernel-1.0.5328-r1 80 -MD5 cf7b2bb276c568f0f66d10951b4ce3ad files/digest-nvidia-kernel-1.0.5332-r1 83 -MD5 1316f73c0eecd8832bb362a3d5ca4892 files/digest-nvidia-kernel-1.0.5336-r2 80 +MD5 f5f0c5fd9e0c5daab6fdba66533746ca nvidia-kernel-1.0.5336-r3.ebuild 4619 +MD5 56ebaa3ba92e9db848baea746a6aef1a files/digest-nvidia-kernel-1.0.4363-r3 74 MD5 1316f73c0eecd8832bb362a3d5ca4892 files/digest-nvidia-kernel-1.0.5336-r3 80 +MD5 1316f73c0eecd8832bb362a3d5ca4892 files/digest-nvidia-kernel-1.0.5336-r2 80 +MD5 b6a9c4bdd3961980af4a70f57485d708 files/nvidia-1.1 441 MD5 046ed3744551619863faea8c5c83db02 files/digest-nvidia-kernel-1.0.4499 74 -MD5 089e6829e7e8497a603ba9dc9563a722 files/nvidia 30 -MD5 56ebaa3ba92e9db848baea746a6aef1a files/digest-nvidia-kernel-1.0.4363-r3 74 MD5 a88479c177f936b6ef19fc73bb39d149 files/digest-nvidia-kernel-1.0.4496-r3 80 -MD5 b6a9c4bdd3961980af4a70f57485d708 files/nvidia-1.1 441 +MD5 cf7b2bb276c568f0f66d10951b4ce3ad files/digest-nvidia-kernel-1.0.5332-r1 83 +MD5 497ffcbd6a91ed9447dfdf7b736925bd files/digest-nvidia-kernel-1.0.5328-r1 80 +MD5 1316f73c0eecd8832bb362a3d5ca4892 files/digest-nvidia-kernel-1.0.5336-r4 80 +MD5 089e6829e7e8497a603ba9dc9563a722 files/nvidia 30 +MD5 c2a29e883336157e1a3e99a0bceca549 files/1.0.4499/NVIDIA_kernel-1.0-4499-2.6-20031014.diff 69389 MD5 eaed145a02e1457194d0e9fdb1f4851a files/1.0.4349/NVIDIA_kernel-1.0-4349-2.5-20030402.diff 70356 MD5 439563bcf7fa96c91361226fae454e0e files/1.0.4349/NVIDIA_kernel-1.0-4349-2.5.68.diff 1467 MD5 f7d7092e9eb9fbe926ff1b8aa9b3f50e files/1.0.4363/NVIDIA_kernel-1.0-4363-2.5-20030714.diff 79485 -MD5 183b64f528e98221291072f12db5859d files/1.0.4496/NVIDIA_kernel-1.0-4496-2.6-pci_name-20030905.diff 608 -MD5 c0f21cb76a7471671ec9665968dfaafb files/1.0.4496/NVIDIA_kernel-1.0-4496-2.6-20031026.diff 81900 -MD5 6d98825a3cf78f4a5ce42d4f4decab89 files/1.0.4496/NVIDIA_kernel-1.0-4496-2.6-20030905.diff 81553 -MD5 c2a29e883336157e1a3e99a0bceca549 files/1.0.4499/NVIDIA_kernel-1.0-4499-2.6-20031014.diff 69389 -MD5 e6571e952e13f13d9910b7ad29eaeb4a files/1.0.5328/NVIDIA_kernel-1.0-5328-2.4-via-chipset-fix.patch 970 MD5 0d4e20c2320c685caad56e357cff0b0c files/1.0.5328/NVIDIA_kernel-1.0-5328-2.6-20040105.diff 95197 +MD5 e6571e952e13f13d9910b7ad29eaeb4a files/1.0.5328/NVIDIA_kernel-1.0-5328-2.4-via-chipset-fix.patch 970 MD5 f04497fe1a0f76fcc41a93b554072c4a files/1.0.5328/NVIDIA_kernel-1.0-5328-2.6-20031226.diff 77616 +MD5 6d98825a3cf78f4a5ce42d4f4decab89 files/1.0.4496/NVIDIA_kernel-1.0-4496-2.6-20030905.diff 81553 +MD5 c0f21cb76a7471671ec9665968dfaafb files/1.0.4496/NVIDIA_kernel-1.0-4496-2.6-20031026.diff 81900 +MD5 183b64f528e98221291072f12db5859d files/1.0.4496/NVIDIA_kernel-1.0-4496-2.6-pci_name-20030905.diff 608 MD5 4c7749ca72483547e15031a2af560415 files/1.0.5332/NVIDIA-Linux-x86_64-1.0-5332-2.6.diff 7216 -MD5 6b364c4b64c6de0aea70163850fa3914 files/1.0.5336/Makefile 4410 +MD5 442f1483c003d291a90dfcc87903b045 files/1.0.5336/NVIDIA_kernel-1.0-5336-2.6-20040521.patch 18711 +MD5 276907ebd8946791398f5f24c27e54c4 files/1.0.5336/NVIDIA_kernel-1.0-5336-basic-sysfs-support-v2.patch 5666 +MD5 5dc4b9a2463cb459721ae3e642f6239f files/1.0.5336/NVIDIA_kernel-1.0-5336-fix-makefile-for-2.6.patch 886 MD5 7bf40e44b8f2181a1047ddfd13acd6b3 files/1.0.5336/NVIDIA_kernel-1.0-5336-basic-sysfs-support.patch 5439 +MD5 6b364c4b64c6de0aea70163850fa3914 files/1.0.5336/Makefile 4410 diff --git a/media-video/nvidia-kernel/files/1.0.5336/NVIDIA_kernel-1.0-5336-2.6-20040521.patch b/media-video/nvidia-kernel/files/1.0.5336/NVIDIA_kernel-1.0-5336-2.6-20040521.patch new file mode 100644 index 000000000000..502833d0f66f --- /dev/null +++ b/media-video/nvidia-kernel/files/1.0.5336/NVIDIA_kernel-1.0-5336-2.6-20040521.patch @@ -0,0 +1,829 @@ +diff -ruN NVIDIA_kernel-1.0-5336/Makefile.kbuild NVIDIA_kernel-1.0-5336-2.6/Makefile.kbuild +--- NVIDIA_kernel-1.0-5336/Makefile.kbuild 2004-01-15 04:29:12.000000000 +0100 ++++ NVIDIA_kernel-1.0-5336-2.6/Makefile.kbuild 2004-05-12 19:17:49.000000000 +0200 +@@ -73,7 +73,7 @@ + # + + EXTRA_CFLAGS += -I$(src) +-EXTRA_CFLAGS += -Wall -Wimplicit -Wreturn-type -Wswitch -Wformat -Wchar-subscripts -Wparentheses -Wpointer-arith -Wno-multichar -Werror -O -MD $(DEFINES) $(INCLUDES) -Wno-cast-qual -Wno-error ++EXTRA_CFLAGS += -Wall -Wimplicit -Wreturn-type -Wswitch -Wformat -Wchar-subscripts -Wparentheses -Wno-pointer-arith -Wno-multichar -Werror -O -MD $(DEFINES) $(INCLUDES) -Wno-cast-qual -Wno-error + + # + # We rely on these two definitions below; if they aren't set, we set them to +diff -ruN NVIDIA_kernel-1.0-5336/nv-linux.h NVIDIA_kernel-1.0-5336-2.6/nv-linux.h +--- NVIDIA_kernel-1.0-5336/nv-linux.h 2004-01-15 04:29:11.000000000 +0100 ++++ NVIDIA_kernel-1.0-5336-2.6/nv-linux.h 2004-05-12 19:17:36.000000000 +0200 +@@ -136,16 +136,19 @@ + + #if NV_ENABLE_MEM_TRACKING + #define NV_MEM_TRACKING_PAD_SIZE(size) ((size) += sizeof(void *)) +-#define NV_MEM_TRACKING_HIDE_SIZE(ptr, size) \ +- if ((ptr) && *(ptr)) { \ +- *(int *) *(ptr) = (size); \ +- (char *) *(ptr) += sizeof(void *); \ +- } +-#define NV_MEM_TRACKING_RETRIEVE_SIZE(ptr, size) \ +- { \ +- (char *) (ptr) -= sizeof(void *); \ +- size = *(int *) (ptr); \ +- } ++#define NV_MEM_TRACKING_HIDE_SIZE(ptr, size) \ ++ if ((ptr) && *(ptr)) { \ ++ U008 *__ptr; \ ++ *(unsigned long *) *(ptr) = (size); \ ++ __ptr = *(ptr); __ptr += sizeof(void *); \ ++ *(ptr) = (void *) __ptr; \ ++ } ++#define NV_MEM_TRACKING_RETRIEVE_SIZE(ptr, size) \ ++ { \ ++ U008 *__ptr = (ptr); __ptr -= sizeof(void *); \ ++ (ptr) = (void *) __ptr; \ ++ size = *(unsigned long *) (ptr); \ ++ } + #else + #define NV_MEM_TRACKING_PAD_SIZE(size) + #define NV_MEM_TRACKING_HIDE_SIZE(ptr, size) +@@ -293,13 +296,13 @@ + #if defined(NVCPU_IA64) + #define NV_VMALLOC(ptr, size) \ + { \ +- (void *) (ptr) = vmalloc_dma(size); \ ++ (ptr) = vmalloc_dma(size); \ + VM_ALLOC_RECORD(ptr, size, "vm_alloc"); \ + } + #else + #define NV_VMALLOC(ptr, size) \ + { \ +- (void *) (ptr) = vmalloc_32(size); \ ++ (ptr) = vmalloc_32(size); \ + VM_ALLOC_RECORD(ptr, size, "vm_alloc"); \ + } + #endif +@@ -312,13 +315,13 @@ + + #define NV_IOREMAP(ptr, physaddr, size) \ + { \ +- (void *) (ptr) = ioremap(physaddr, size); \ ++ (ptr) = ioremap(physaddr, size); \ + VM_ALLOC_RECORD(ptr, size, "vm_ioremap"); \ + } + + #define NV_IOREMAP_NOCACHE(ptr, physaddr, size) \ + { \ +- (void *) (ptr) = ioremap_nocache(physaddr, size); \ ++ (ptr) = ioremap_nocache(physaddr, size); \ + VM_ALLOC_RECORD(ptr, size, "vm_ioremap_nocache"); \ + } + +@@ -333,13 +336,13 @@ + */ + #define NV_KMALLOC(ptr, size) \ + { \ +- (void *) (ptr) = kmalloc(size, GFP_KERNEL); \ ++ (ptr) = kmalloc(size, GFP_KERNEL); \ + KM_ALLOC_RECORD(ptr, size, "km_alloc"); \ + } + + #define NV_KMALLOC_ATOMIC(ptr, size) \ + { \ +- (void *) (ptr) = kmalloc(size, GFP_ATOMIC); \ ++ (ptr) = kmalloc(size, GFP_ATOMIC); \ + KM_ALLOC_RECORD(ptr, size, "km_alloc_atomic"); \ + } + +@@ -352,7 +355,7 @@ + + #define NV_GET_FREE_PAGES(ptr, order) \ + { \ +- (void *) (ptr) = __get_free_pages(NV_GFP_HW, order); \ ++ (ptr) = __get_free_pages(NV_GFP_HW, order); \ + } + + #define NV_FREE_PAGES(ptr, order) \ +@@ -689,8 +692,7 @@ + #define NV_GET_NVFP(filep) ((nv_file_private_t *) FILE_PRIVATE(filep)) + + /* for the card devices */ +-#define NVL_FROM_FILEP(filep) \ +- ((nv_linux_state_t*) (NV_GET_NVFP(filep))->nvptr) ++#define NVL_FROM_FILEP(filep) (NV_GET_NVFP(filep)->nvptr) + + #define NV_GET_NVL_FROM_NV_STATE(nv) \ + ((nv_linux_state_t *) nv->os_state) +diff -ruN NVIDIA_kernel-1.0-5336/nv.c NVIDIA_kernel-1.0-5336-2.6/nv.c +--- NVIDIA_kernel-1.0-5336/nv.c 2004-01-15 04:29:11.000000000 +0100 ++++ NVIDIA_kernel-1.0-5336-2.6/nv.c 2004-05-12 19:18:29.000000000 +0200 +@@ -1182,7 +1182,7 @@ + struct vm_operations_struct nv_vm_ops = { + nv_kern_vma_open, + nv_kern_vma_release, /* "close" */ +- nv_kern_vma_nopage, ++/* nv_kern_vma_nopage, */ + }; + + static nv_file_private_t * +@@ -2006,7 +2006,7 @@ + * waiting on the wait queue + */ + +-void nv_set_hotkey_occurred_flag(void) ++void NV_API_CALL nv_set_hotkey_occurred_flag(void) + { + nv_printf(NV_DBG_EVENTINFO,"setting the hotkey occurred flag!\n"); + +@@ -2190,7 +2190,7 @@ + *** EXPORTS to rest of resman + ***/ + +-void *nv_find_nv_mapping( ++void* NV_API_CALL nv_find_nv_mapping( + nv_state_t *nv, + unsigned long address + ) +@@ -2261,8 +2261,7 @@ + * the TYPE_AGP flag to differeniate it from a PCI allocation. + * failure is fine, we may just be checking if a given page is agp + */ +-void * +-nv_find_agp_kernel_mapping( ++void* NV_API_CALL nv_find_agp_kernel_mapping( + nv_state_t *nv, + unsigned long address + ) +@@ -2338,8 +2337,7 @@ + return (unsigned long) NULL; + } + +-unsigned long +-nv_get_kern_phys_address( ++unsigned long NV_API_CALL nv_get_kern_phys_address( + unsigned long address + ) + { +@@ -2368,8 +2366,7 @@ + return _get_phys_address(address, 1); + } + +-unsigned long +-nv_get_user_phys_address( ++unsigned long NV_API_CALL nv_get_user_phys_address( + unsigned long address + ) + { +@@ -2391,8 +2388,7 @@ + + + /* allocate memory for DMA push buffers */ +-int +-nv_alloc_pages( ++int NV_API_CALL nv_alloc_pages( + nv_state_t *nv, + void **pAddress, + unsigned int page_count, +@@ -2583,8 +2579,7 @@ + return -1; \ + } + +-int +-nv_free_pages( ++int NV_API_CALL nv_free_pages( + nv_state_t *nv, + void **pAddress, + unsigned int page_count, +@@ -2686,7 +2681,7 @@ + nvl->rm_lock_count = 0; + } + +-void nv_lock_rm( ++void NV_API_CALL nv_lock_rm( + nv_state_t *nv + ) + { +@@ -2706,7 +2701,7 @@ + nvl->rm_lock_count = 1; + } + +-void nv_unlock_rm( ++void NV_API_CALL nv_unlock_rm( + nv_state_t *nv + ) + { +@@ -2720,7 +2715,7 @@ + spin_unlock_irq(&nvl->rm_lock); + } + +-void nv_lock_heap( ++void NV_API_CALL nv_lock_heap( + nv_state_t *nv + ) + { +@@ -2730,7 +2725,7 @@ + nv_lock(nvl->heap_lock); + } + +-void nv_unlock_heap( ++void NV_API_CALL nv_unlock_heap( + nv_state_t *nv + ) + { +@@ -2743,7 +2738,7 @@ + /* + ** post the event + */ +-void nv_post_event( ++void NV_API_CALL nv_post_event( + nv_state_t *nv, + nv_event_t *event, + U032 handle, +@@ -2781,7 +2776,7 @@ + nv_unlock_irq(nvfp->fp_lock, eflags); + } + +-int nv_get_event( ++int NV_API_CALL nv_get_event( + nv_state_t *nv, + VOID *void_file, + nv_event_t *event, +@@ -2822,8 +2817,7 @@ + } + + +-int +-nv_agp_init( ++int NV_API_CALL nv_agp_init( + nv_state_t *nv, + VOID **phys_start, + VOID **linear_start, +@@ -2888,8 +2882,7 @@ + return status; + } + +-int +-nv_agp_teardown( ++int NV_API_CALL nv_agp_teardown( + nv_state_t *nv + ) + { +@@ -2926,8 +2919,7 @@ + * (if the linear mapping was real, this is the page that would have been + * addressed by the virtual address. I know, confusing). + */ +-int +-nv_agp_translate_address( ++int NV_API_CALL nv_agp_translate_address( + nv_state_t *nv, + void *base, + U032 index, +@@ -2956,8 +2948,7 @@ + } + + +-int +-nv_int10h_call( ++int NV_API_CALL nv_int10h_call( + nv_state_t *nv, + U032 *eax, + U032 *ebx, +@@ -2970,8 +2961,7 @@ + } + + /* set a timer to go off every second */ +-int +-nv_start_rc_timer( ++int NV_API_CALL nv_start_rc_timer( + nv_state_t *nv + ) + { +@@ -2991,8 +2981,7 @@ + return 0; + } + +-int +-nv_stop_rc_timer( ++int NV_API_CALL nv_stop_rc_timer( + nv_state_t *nv + ) + { +diff -ruN NVIDIA_kernel-1.0-5336/os-interface.c NVIDIA_kernel-1.0-5336-2.6/os-interface.c +--- NVIDIA_kernel-1.0-5336/os-interface.c 2004-01-15 04:29:11.000000000 +0100 ++++ NVIDIA_kernel-1.0-5336-2.6/os-interface.c 2004-05-12 19:09:35.000000000 +0200 +@@ -35,7 +35,7 @@ + } + #endif + +-RM_STATUS os_raise_smp_barrier(VOID) ++RM_STATUS NV_API_CALL os_raise_smp_barrier(VOID) + { + os_block_on_smp_barrier = 1; + #ifdef CONFIG_SMP +@@ -45,26 +45,26 @@ + return RM_OK; + } + +-RM_STATUS os_clear_smp_barrier(VOID) ++RM_STATUS NV_API_CALL os_clear_smp_barrier(VOID) + { + os_block_on_smp_barrier = 0; + return RM_OK; + } + + // return TRUE if the caller is the super-user +-BOOL os_is_administrator( ++BOOL NV_API_CALL os_is_administrator( + PHWINFO pDev + ) + { + return NV_IS_SUSER(); + } + +-U032 os_get_page_size(VOID) ++U032 NV_API_CALL os_get_page_size(VOID) + { + return PAGE_SIZE; + } + +-ULONG os_get_page_mask(VOID) ++ULONG NV_API_CALL os_get_page_mask(VOID) + { + return PAGE_MASK; + } +@@ -78,7 +78,7 @@ + // just replace the code within osStringCopy with a call to the C library + // function strcpy. + // +-U008* os_string_copy( ++U008* NV_API_CALL os_string_copy( + U008 *dst, + const U008 *src + ) +@@ -86,7 +86,7 @@ + return strcpy(dst, src); + } + +-RM_STATUS os_strncpy_from_user( ++RM_STATUS NV_API_CALL os_strncpy_from_user( + U008 *dst, + const U008 *src, + U032 n +@@ -99,7 +99,7 @@ + #endif + } + +-S032 os_string_compare( ++S032 NV_API_CALL os_string_compare( + const U008 *s1, + const U008 *s2 + ) +@@ -107,14 +107,14 @@ + return strcmp(s1, s2); + } + +-U032 os_string_length( ++U032 NV_API_CALL os_string_length( + const U008* str + ) + { + return strlen(str); + } + +-U008* os_mem_copy( ++U008* NV_API_CALL os_mem_copy( + U008 *dst, + const U008 *src, + U032 length +@@ -123,7 +123,7 @@ + return memcpy(dst, src, length); + } + +-RM_STATUS os_memcpy_from_user( ++RM_STATUS NV_API_CALL os_memcpy_from_user( + VOID *dst, + const VOID* src, + U032 length +@@ -132,7 +132,7 @@ + return copy_from_user(dst, src, length) ? RM_ERR_BAD_ADDRESS : RM_OK; + } + +-RM_STATUS os_memcpy_to_user( ++RM_STATUS NV_API_CALL os_memcpy_to_user( + VOID *dst, + const VOID* src, + U032 length +@@ -141,7 +141,7 @@ + return copy_to_user(dst, src, length) ? RM_ERR_BAD_ADDRESS : RM_OK; + } + +-VOID* os_mem_set( ++VOID* NV_API_CALL os_mem_set( + VOID* dst, + U008 c, + U032 length +@@ -150,7 +150,7 @@ + return memset(dst, (int)c, length); + } + +-S032 os_mem_cmp( ++S032 NV_API_CALL os_mem_cmp( + const U008 *buf0, + const U008* buf1, + U032 length +@@ -159,7 +159,7 @@ + return memcmp(buf0, buf1, length); + } + +-VOID* os_copy_in_ioctl_param( ++VOID* NV_API_CALL os_copy_in_ioctl_param( + VOID *dst, + VOID *src, + U032 length +@@ -172,7 +172,7 @@ + } + } + +-VOID* os_copy_out_ioctl_param( ++VOID* NV_API_CALL os_copy_out_ioctl_param( + VOID *dst, + VOID *src, + U032 length +@@ -204,7 +204,7 @@ + + #define KMALLOC_LIMIT 131072 + +-RM_STATUS os_alloc_mem( ++RM_STATUS NV_API_CALL os_alloc_mem( + VOID **address, + U032 size + ) +@@ -251,7 +251,7 @@ + return *address ? RM_OK : RM_ERR_NO_FREE_MEM; + } + +-void os_free_mem(VOID *address) ++void NV_API_CALL os_free_mem(VOID *address) + { + unsigned long va; + int size; +@@ -273,7 +273,7 @@ + * we may allocate more pages than the caller really asked for. + * we'll only lock down the number of pages the caller asked for. + */ +-RM_STATUS os_alloc_contig_pages( ++RM_STATUS NV_API_CALL os_alloc_contig_pages( + VOID **address, + U032 size + ) +@@ -310,7 +310,7 @@ + * the same number of pages we locked, and to calculate the order we + * allocated, so we properly free the allocation. + */ +-VOID os_free_contig_pages( ++VOID NV_API_CALL os_free_contig_pages( + VOID *address, + U032 size + ) +@@ -335,7 +335,7 @@ + * + *****************************************************************************/ + +-RM_STATUS os_get_current_time( ++RM_STATUS NV_API_CALL os_get_current_time( + U032 *seconds, + U032 *useconds + ) +@@ -371,7 +371,7 @@ + * this, we use mdelay() for any full millisecond to be safe. + */ + +-RM_STATUS os_delay_us(U032 MicroSeconds) ++RM_STATUS NV_API_CALL os_delay_us(U032 MicroSeconds) + { + unsigned long mdelay_safe_msec; + unsigned long usec; +@@ -411,7 +411,7 @@ + * remainder will be accounted for with mdelay(). + */ + +-RM_STATUS os_delay(U032 MilliSeconds) ++RM_STATUS NV_API_CALL os_delay(U032 MilliSeconds) + { + unsigned long MicroSeconds; + unsigned long jiffies; +@@ -481,7 +481,7 @@ + } + + /* return CPU frequency in MHz */ +-U032 os_get_cpu_frequency(VOID) ++U032 NV_API_CALL os_get_cpu_frequency(VOID) + { + u64 tsc[2]; + u32 tsc_d; +@@ -500,13 +500,13 @@ + return cpu_mhz; + } + +-RM_STATUS os_get_current_process(U032 *pPid) ++RM_STATUS NV_API_CALL os_get_current_process(U032 *pPid) + { + *pPid = current->pid; + return RM_OK; + } + +-RM_STATUS os_kill_process( ++RM_STATUS NV_API_CALL os_kill_process( + U032 pid, + U032 sig + ) +@@ -531,7 +531,7 @@ + // + // this is what actually outputs the data. + // +-inline void out_string(const char *str) ++inline void NV_API_CALL out_string(const char *str) + { + printk("%d: %s", smp_processor_id(), str); + } +@@ -546,7 +546,7 @@ + * Returns the number of characters written. + */ + +-int nv_printf( ++int NV_API_CALL nv_printf( + int debuglevel, + const char *printf_format, + ... +@@ -571,7 +571,7 @@ + return chars_written; + } + +-BOOL os_pci_device_present( ++BOOL NV_API_CALL os_pci_device_present( + U016 vendor, + U016 device + ) +@@ -587,7 +587,7 @@ + return ret; \ + } + +-VOID* os_pci_init_handle( ++VOID* NV_API_CALL os_pci_init_handle( + U008 bus, + U008 slot, + U008 function, +@@ -604,7 +604,7 @@ + return (VOID *) dev; + } + +-U008 os_pci_read_byte( ++U008 NV_API_CALL os_pci_read_byte( + VOID *handle, + U008 offset + ) +@@ -615,7 +615,7 @@ + return value; + } + +-U016 os_pci_read_word( ++U016 NV_API_CALL os_pci_read_word( + VOID *handle, + U008 offset + ) +@@ -626,7 +626,7 @@ + return value; + } + +-U032 os_pci_read_dword( ++U032 NV_API_CALL os_pci_read_dword( + VOID *handle, + U008 offset + ) +@@ -637,7 +637,7 @@ + return value; + } + +-VOID os_pci_write_byte( ++VOID NV_API_CALL os_pci_write_byte( + VOID *handle, + U008 offset, + U008 value +@@ -647,7 +647,7 @@ + pci_write_config_byte( (struct pci_dev *) handle, offset, value); + } + +-VOID os_pci_write_word( ++VOID NV_API_CALL os_pci_write_word( + VOID *handle, + U008 offset, + U016 value +@@ -657,7 +657,7 @@ + pci_write_config_word( (struct pci_dev *) handle, offset, value); + } + +-VOID os_pci_write_dword( ++VOID NV_API_CALL os_pci_write_dword( + VOID *handle, + U008 offset, + U032 value +@@ -667,7 +667,7 @@ + pci_write_config_dword( (struct pci_dev *) handle, offset, value); + } + +-VOID os_io_write_byte( ++VOID NV_API_CALL os_io_write_byte( + PHWINFO pdev, + U032 address, + U008 value +@@ -676,7 +676,7 @@ + outb(value, address); + } + +-VOID os_io_write_word( ++VOID NV_API_CALL os_io_write_word( + PHWINFO pdev, + U032 address, + U016 value +@@ -685,7 +685,7 @@ + outw(value, address); + } + +-VOID os_io_write_dword( ++VOID NV_API_CALL os_io_write_dword( + PHWINFO pdev, + U032 address, + U032 value +@@ -694,7 +694,7 @@ + outl(value, address); + } + +-U008 os_io_read_byte( ++U008 NV_API_CALL os_io_read_byte( + PHWINFO pdev, + U032 address + ) +@@ -702,7 +702,7 @@ + return inb(address); + } + +-U016 os_io_read_word( ++U016 NV_API_CALL os_io_read_word( + PHWINFO pdev, + U032 address + ) +@@ -710,7 +710,7 @@ + return inw(address); + } + +-U032 os_io_read_dword( ++U032 NV_API_CALL os_io_read_dword( + PHWINFO pdev, + U032 address + ) +@@ -718,14 +718,14 @@ + return inl(address); + } + +-ULONG os_cli(ULONG flags) ++ULONG NV_API_CALL os_cli(ULONG flags) + { + NV_SAVE_FLAGS(flags); + NV_CLI(); + return flags; + } + +-ULONG os_sti(ULONG flags) ++ULONG NV_API_CALL os_sti(ULONG flags) + { + NV_RESTORE_FLAGS(flags); + return flags; +@@ -789,7 +789,7 @@ + * achieve the same results on a PIII or higher + */ + +-RM_STATUS os_set_mem_range( ++RM_STATUS NV_API_CALL os_set_mem_range( + U032 start, + U032 size, + U032 mode +@@ -817,7 +817,7 @@ + return RM_ERROR; + } + +-RM_STATUS os_unset_mem_range( ++RM_STATUS NV_API_CALL os_unset_mem_range( + U032 start, + U032 size + ) +@@ -839,7 +839,7 @@ + * should this also check for Write-Combining?? + */ + +-VOID *os_map_kernel_space( ++VOID *NV_API_CALL os_map_kernel_space( + U032 start, + U032 size_bytes, + U032 mode +@@ -864,7 +864,7 @@ + return vaddr; + } + +-VOID os_unmap_kernel_space( ++VOID NV_API_CALL os_unmap_kernel_space( + VOID *addr, + U032 size_bytes + ) +@@ -872,7 +872,7 @@ + NV_IOUNMAP(addr, size_bytes); + } + +-VOID* os_map_user_space( ++VOID* NV_API_CALL os_map_user_space( + VOID *kaddr, + VOID **priv, + U032 size_bytes, +@@ -883,14 +883,14 @@ + return NULL; + } + +-VOID os_unmap_user_space( ++VOID NV_API_CALL os_unmap_user_space( + VOID *uaddr, + VOID *priv + ) + { + } + +-VOID* os_map_io_space( ++VOID* NV_API_CALL os_map_io_space( + U032 start, + U032 size_bytes, + VOID **priv, +@@ -920,7 +920,7 @@ + return (void *)(NV_UINTPTR_T) vma->vm_start; + } + +-VOID os_unmap_io_space( ++VOID NV_API_CALL os_unmap_io_space( + VOID *addr, + U032 size_bytes, + VOID *priv, +@@ -930,14 +930,14 @@ + } + + // flush the cpu's cache, uni-processor version +-RM_STATUS os_flush_cpu_cache() ++RM_STATUS NV_API_CALL os_flush_cpu_cache() + { + CACHE_FLUSH(); + return RM_OK; + } + + // override initial debug level from registry +-VOID os_dbg_init(void) ++VOID NV_API_CALL os_dbg_init(void) + { + U032 new_debuglevel; + if (RM_OK == rm_read_registry_dword(0, +@@ -950,7 +950,7 @@ + } + } + +-VOID os_dbg_set_level(U032 new_debuglevel) ++VOID NV_API_CALL os_dbg_set_level(U032 new_debuglevel) + { + nv_printf(NV_DBG_SETUP, "Changing debuglevel from 0x%x to 0x%x\n", cur_debuglevel, new_debuglevel); + cur_debuglevel = new_debuglevel; +@@ -962,7 +962,7 @@ + * a lock or which threw the breakpoint. I should probably scan the list of + * nv_state_t's and drop any held locks before throwing this breakpoint. + */ +-VOID os_dbg_breakpoint(void) ++VOID NV_API_CALL os_dbg_breakpoint(void) + { + #ifdef DEBUG + out_string("Break\n"); +@@ -979,7 +979,7 @@ + } + + +-U032 os_get_cpu_count() ++U032 NV_API_CALL os_get_cpu_count() + { + return NV_NUM_CPUS(); + } +@@ -1008,7 +1008,7 @@ + #define NV_CANARY_CAGE ((unsigned long *)(current + 1)) + + void +-os_canary_arm() ++NV_API_CALL os_canary_arm() + { + int i; + +@@ -1017,7 +1017,7 @@ + } + + void +-os_canary_check() ++NV_API_CALL os_canary_check() + { + int i; + diff --git a/media-video/nvidia-kernel/files/1.0.5336/NVIDIA_kernel-1.0-5336-basic-sysfs-support-v2.patch b/media-video/nvidia-kernel/files/1.0.5336/NVIDIA_kernel-1.0-5336-basic-sysfs-support-v2.patch new file mode 100644 index 000000000000..468d909a613d --- /dev/null +++ b/media-video/nvidia-kernel/files/1.0.5336/NVIDIA_kernel-1.0-5336-basic-sysfs-support-v2.patch @@ -0,0 +1,182 @@ +diff -urN NVIDIA-Linux-x86-1.0-5336/usr/src/nv/Makefile.kbuild NVIDIA-Linux-x86-1.0-5336.sysfs/usr/src/nv/Makefile.kbuild +--- NVIDIA-Linux-x86-1.0-5336/usr/src/nv/Makefile.kbuild 2004-01-15 05:29:12.000000000 +0200 ++++ NVIDIA-Linux-x86-1.0-5336.sysfs/usr/src/nv/Makefile.kbuild 2004-05-22 21:04:52.143088872 +0200 +@@ -117,6 +117,9 @@ + MODULE_OBJECT := $(MODULE_NAME).o + else + MODULE_OBJECT := $(MODULE_NAME).ko ++ ++ # We need this for the conftest.sh tests to work ++ KERNEL_HEADERS += -I$(KERNEL_SOURCES)/include/asm/mach-generic + endif + + # +@@ -146,6 +149,16 @@ + EXTRA_CFLAGS += -DREMAP_PAGE_RANGE_4 + endif + ++ifeq ($(shell sh $(src)/conftest.sh remap_page_range $(KERNEL_HEADERS)),) ++ # Check if 'conftest.sh remap_page_rage' have no output - if so, we ++ # can expect issues ... ! ++ $(error Cannot compile tests! Please check $$KERNEL_HEADERS) ++endif ++ ++ifeq ($(shell sh $(src)/conftest.sh class_simple $(KERNEL_HEADERS)), yes) ++ EXTRA_CFLAGS += -DHAVE_CLASS_SIMPLE ++endif ++ + # + # NVIDIA binary object file includes .common section. + # +diff -urN NVIDIA-Linux-x86-1.0-5336/usr/src/nv/conftest.sh NVIDIA-Linux-x86-1.0-5336.sysfs/usr/src/nv/conftest.sh +--- NVIDIA-Linux-x86-1.0-5336/usr/src/nv/conftest.sh 2004-01-15 05:29:11.000000000 +0200 ++++ NVIDIA-Linux-x86-1.0-5336.sysfs/usr/src/nv/conftest.sh 2004-05-22 20:58:19.382797512 +0200 +@@ -42,6 +42,29 @@ + fi + ;; + ++ class_simple) ++ shift ++ # ++ # Determine if we have struct class_simple needed for limited sysfs ++ # support in 2.6 ++ # ++ echo "#include <linux/device.h> ++ void add_test_class(void) { ++ struct class_simple *test_class; ++ test_class = class_simple_create(THIS_MODULE, \"test\"); ++ }" > conftest.c ++ ++ gcc -Wall -c conftest.c -o conftest.o $* -D__KERNEL__ > output.log 2>&1 ++ ++ if test -f conftest.o && test -z "`cat output.log`"; then ++ echo "yes" ++ else ++ echo "no" ++ fi ++ ++ rm -f conftest.{c,o} output.log ++ ;; ++ + cc_sanity_check) + shift + # +diff -urN NVIDIA-Linux-x86-1.0-5336/usr/src/nv/nv-linux.h NVIDIA-Linux-x86-1.0-5336.sysfs/usr/src/nv/nv-linux.h +--- NVIDIA-Linux-x86-1.0-5336/usr/src/nv/nv-linux.h 2004-01-15 05:29:11.000000000 +0200 ++++ NVIDIA-Linux-x86-1.0-5336.sysfs/usr/src/nv/nv-linux.h 2004-05-22 20:58:19.387796752 +0200 +@@ -448,6 +448,33 @@ + # endif // defined(KERNEL_2_4) + #endif // defined(CONFIG_DEVFS_FS) + ++#if defined(KERNEL_2_6) && defined(HAVE_CLASS_SIMPLE) ++# define NV_SYSFS_REGISTER \ ++ nvidia_class = class_simple_create(THIS_MODULE, "nvidia"); ++ ++# define NV_SYSFS_ADD_CONTROL \ ++ class_simple_device_add(nvidia_class, \ ++ MKDEV(NV_MAJOR_DEVICE_NUMBER, 255), \ ++ NULL, "nvidiactl"); ++ ++# define NV_SYSFS_ADD_DEVICE(_name, _minor) \ ++ class_simple_device_add(nvidia_class, \ ++ MKDEV(NV_MAJOR_DEVICE_NUMBER, _minor), \ ++ &nv_linux_devices[_minor].dev->dev, _name); ++ ++# define NV_SYSFS_REMOVE_DEVICE(i) \ ++ class_simple_device_remove(MKDEV(NV_MAJOR_DEVICE_NUMBER, i)); ++ ++# define NV_SYSFS_UNREGISTER \ ++ class_simple_destroy(nvidia_class); ++#else ++# define NV_SYSFS_REGISTER ++# define NV_SYSFS_ADD_CONTROL ++# define NV_SYSFS_ADD_DEVICE(_name, _minor) ++# define NV_SYSFS_REMOVE_DEVICE(i) ++# define NV_SYSFS_UNREGISTER ++#endif ++ + + /* + * Linux 2.5 introduced the five argument version of remap_page_range, all +diff -urN NVIDIA-Linux-x86-1.0-5336/usr/src/nv/nv.c NVIDIA-Linux-x86-1.0-5336.sysfs/usr/src/nv/nv.c +--- NVIDIA-Linux-x86-1.0-5336/usr/src/nv/nv.c 2004-01-15 05:29:11.000000000 +0200 ++++ NVIDIA-Linux-x86-1.0-5336.sysfs/usr/src/nv/nv.c 2004-05-22 20:58:19.393795840 +0200 +@@ -47,6 +47,10 @@ + devfs_handle_t nv_devfs_handles[NV_MAX_DEVICES+1]; + #endif + ++#if defined(KERNEL_2_6) && defined(HAVE_CLASS_SIMPLE) ++struct class_simple *nvidia_class; ++#endif ++ + // #define NV_DBG_MEM 1 + #undef NV_DBG_MEM + +@@ -874,23 +878,31 @@ + rc = register_chrdev(nv_major, "nvidia", &nv_fops); + #endif + ++ NV_SYSFS_REGISTER; ++ + if (rc < 0) + { + nv_printf(NV_DBG_ERRORS, "nvidia_init_module: register failed\n"); + return rc; + } + +-#ifdef CONFIG_DEVFS_FS ++#if defined(CONFIG_DEVFS_FS) || defined(KERNEL_2_6) + do + { + char name[10]; + ++# if defined(CONFIG_DEVFS_FS) + nv_devfs_handles[0] = NV_DEVFS_REGISTER("nvidiactl", 255); ++# endif ++ NV_SYSFS_ADD_CONTROL; + + for (i = 0; i < num_nv_devices; i++) + { + sprintf(name, "nvidia%d", i); ++# if defined(CONFIG_DEVFS_FS) + nv_devfs_handles[i+1] = NV_DEVFS_REGISTER(name, i); ++# endif ++ NV_SYSFS_ADD_DEVICE(name, i); + } + } while(0); + #endif +@@ -951,6 +963,7 @@ + #else + unregister_chrdev(nv_major, "nvidia"); + #endif ++ NV_SYSFS_UNREGISTER; + return rc; + } + +@@ -1011,15 +1024,24 @@ + nv_printf(NV_DBG_ERRORS, "nvidia_exit_module: unregister nv failed\n"); + } + +-#ifdef CONFIG_DEVFS_FS ++#if defined(CONFIG_DEVFS_FS) || defined(KERNEL_2_6) + do { + int i; ++# if defined(CONFIG_DEVFS_FS) + NV_DEVFS_REMOVE_CONTROL(); +- for (i = 0; i < num_nv_devices; i++) ++# endif ++ NV_SYSFS_REMOVE_DEVICE(255); ++ for (i = 0; i < num_nv_devices; i++) { ++# if defined(CONFIG_DEVFS_FS) + NV_DEVFS_REMOVE_DEVICE(i); ++# endif ++ NV_SYSFS_REMOVE_DEVICE(i); ++ } + } while (0); + #endif + ++ NV_SYSFS_UNREGISTER; ++ + #if NV_ENABLE_MEM_TRACKING + nv_list_mem(vm_list); + nv_list_mem(km_list); diff --git a/media-video/nvidia-kernel/files/1.0.5336/NVIDIA_kernel-1.0-5336-fix-makefile-for-2.6.patch b/media-video/nvidia-kernel/files/1.0.5336/NVIDIA_kernel-1.0-5336-fix-makefile-for-2.6.patch new file mode 100644 index 000000000000..16e6571523c1 --- /dev/null +++ b/media-video/nvidia-kernel/files/1.0.5336/NVIDIA_kernel-1.0-5336-fix-makefile-for-2.6.patch @@ -0,0 +1,20 @@ +diff -urN NVIDIA-Linux-x86-1.0-5336/usr/src/nv/makefile NVIDIA-Linux-x86-1.0-5336.az/usr/src/nv/makefile +--- NVIDIA-Linux-x86-1.0-5336/usr/src/nv/makefile 2004-06-15 21:35:13.034445000 +0200 ++++ NVIDIA-Linux-x86-1.0-5336.az/usr/src/nv/makefile 2004-06-15 21:48:43.410249152 +0200 +@@ -12,4 +12,15 @@ + default: module + + module nvidia.o nvidia.ko install nv-linux.o clean module-install package-install print-module-filename: select_makefile +- @ $(MAKE) --no-print-directory -f Makefile $@ ++ @if [ "`ls -l Makefile`" == "Makefile.kbuild" ]; then \ ++ if [ "${SYSSRC}" ]; then \ ++ KERNEL_INCLUDE="${SYSSRC}/include"; \ ++ elif [ "${SYSINCLUDE}" ]; then \ ++ KERNEL_INCLUDE="${SYSINCLUDE}"; \ ++ else \ ++ KERNEL_INCLUDE="/lib/modules/`uname -r`/build/include"; \ ++ fi; \ ++ make -C "${KERNEL_INCLUDE}/../" M=`pwd` $@; \ ++ else \ ++ $(MAKE) --no-print-directory -f Makefile $@; \ ++ fi diff --git a/media-video/nvidia-kernel/files/digest-nvidia-kernel-1.0.5336-r4 b/media-video/nvidia-kernel/files/digest-nvidia-kernel-1.0.5336-r4 new file mode 100644 index 000000000000..56ddf0d273b7 --- /dev/null +++ b/media-video/nvidia-kernel/files/digest-nvidia-kernel-1.0.5336-r4 @@ -0,0 +1 @@ +MD5 6d7361347ebbef5dfdbe6bdcb560fda8 NVIDIA-Linux-x86-1.0-5336-pkg1.run 6821193 diff --git a/media-video/nvidia-kernel/nvidia-kernel-1.0.5336-r4.ebuild b/media-video/nvidia-kernel/nvidia-kernel-1.0.5336-r4.ebuild new file mode 100644 index 000000000000..15f847f3a055 --- /dev/null +++ b/media-video/nvidia-kernel/nvidia-kernel-1.0.5336-r4.ebuild @@ -0,0 +1,157 @@ +# Copyright 1999-2004 Gentoo Technologies, Inc. +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/media-video/nvidia-kernel/nvidia-kernel-1.0.5336-r4.ebuild,v 1.1 2004/06/15 21:26:29 azarah Exp $ + +inherit eutils kmod + +PKG_V="pkg1" +NV_V="${PV/1.0./1.0-}" +NV_PACKAGE="NVIDIA-Linux-x86-${NV_V}" +S="${WORKDIR}/${NV_PACKAGE}-${PKG_V}/usr/src/nv" +DESCRIPTION="Linux kernel module for the NVIDIA's X driver" +HOMEPAGE="http://www.nvidia.com/" +SRC_URI="ftp://download.nvidia.com/XFree86/Linux-x86/${NV_V}/${NV_PACKAGE}-${PKG_V}.run" + +# The slot needs to be set to $KV to prevent unmerges of modules for other kernels. +LICENSE="NVIDIA" +SLOT="${KV}" +KEYWORDS="-* ~x86" +RESTRICT="nostrip" + +DEPEND="virtual/linux-sources" +export _POSIX2_VERSION="199209" + +KMOD_SOURCES="none" + +mtrr_check() { + if [ ! -f /proc/mtrr ] + then + eerror "This version needs MTRR support for most chipsets!" + eerror "Please enable MTRR support in your kernel config, found at:" + eerror + eerror " Processor type and features -> [*] MTRR (Memory Type Range Register) support" + eerror + eerror "and recompile your kernel ..." + die "MTRR support not detected!" + fi +} + +pkg_setup() { + mtrr_check + + echo + ewarn "The new 2.6.6 Series kernels include an option for 4K Stack sizes," + ewarn "this option must NOT be selected. This driver will only work with" + ewarn "the OLD 8K Stack size, please ensure you leave 8K stack sizes for now." + echo +} + +ck_kern_write() { + if [ ! "${KV_PATCH}" -ge "6" ] + then + ewarn "You are running Linux Kernel ${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}\n" + ewarn "Due to incompatibilities between the current nvidia drivers and" + ewarn "the new 2.6.6 kernel sources we need to use the koutput feature" + ewarn "unfortunately this means that older kernels will be omitted from" + ewarn "the sandbox for this build.\n" + ewarn "This will be over come with newer driver releases from nvidia." + echo + ewarn "THIS BUILD WILL NOT WORK WITH FEATURES=\"userpriv\"" + echo + ewarn "We are working to resolve this issue, please disable userpriv" + ewarn "if you use it while building nvidia-kernel." + return 0 + else + return 1 + fi +} + +src_unpack() { + # Let the kmod eclass set the variables for us + kmod_src_unpack + + cd ${WORKDIR} + bash ${DISTDIR}/${NV_PACKAGE}-${PKG_V}.run --extract-only + + # Next section applies patches for linux-2.5 kernel, and/or + # bugfixes for linux-2.4. All these are from: + # + # http://www.minion.de/nvidia/ + # + # Many thanks to Christian Zander <zander@minion.de> for bringing + # these to us, and being so helpful to select which to use. + + cd ${S} + + # Support for gcc-3.4, so 2.4.xx should benifit as well ... + epatch ${FILESDIR}/${PV}/NVIDIA_kernel-${NV_V}-2.6-20040521.patch + # Cannot hurt for 2.4.xx as well ... + epatch ${FILESDIR}/${PV}/NVIDIA_kernel-${NV_V}-fix-makefile-for-2.6.patch + + if is_kernel 2 5 || is_kernel 2 6 + then + # Add sysfs support + epatch ${FILESDIR}/${PV}/NVIDIA_kernel-${NV_V}-basic-sysfs-support-v2.patch + fi + + # if you set this then it's your own fault when stuff breaks :) + [ ! -z "${USE_CRAZY_OPTS}" ] && sed -i "s:-O:${CFLAGS}:" Makefile.* +} + +src_compile() { + # IGNORE_CC_MISMATCH disables a sanity check that's needed when gcc has been + # updated but the running kernel is still compiled with an older gcc. This is + # needed for chrooted building, where the sanity check detects the gcc of the + # kernel outside the chroot rather than within. + if is_kernel 2 5 || is_kernel 2 6 + then + if ck_kern_write + then + KD="`/bin/readlink -f ${KERNEL_DIR}`" + einfo "Adding write support to ${KD}\n" + addwrite "${KD}" + fi + + unset ARCH + fi + make IGNORE_CC_MISMATCH="yes" SYSSRC="${KERNEL_DIR}" \ + clean module V=1 || die "Failed to build module" +} + +src_install() { + # The driver goes into the standard modules location + insinto /lib/modules/${KV}/video + + # Insert the module + doins nvidia.${KV_OBJ} + + # Add the aliases + insinto /etc/modules.d + newins ${FILESDIR}/nvidia-1.1 nvidia + + # Docs + dodoc ${S}/README + + # The device creation script + into / + newsbin ${S}/makedevices.sh NVmakedevices.sh +} + +pkg_postinst() { + if [ "${ROOT}" = "/" ] + then + # Update module dependency + [ -x /usr/sbin/update-modules ] && /usr/sbin/update-modules + if [ ! -e /dev/.devfsd ] && [ ! -e /dev/.udev ] && [ -x /sbin/NVmakedevices.sh ] + then + /sbin/NVmakedevices.sh >/dev/null 2>&1 + fi + fi + + echo + einfo "If you need to load the module automatically on boot up you need" + einfo "to add \"nvidia\" to /etc/modules.autoload.d/kernel-${KV_MAJOR}.${KV_MINOR}" + echo + einfo "Please note that the driver name is nvidia.${KV_OBJ}, not NVdriver" + echo +} |