You are not logged in.

#1 2008-04-14 20:53:32

Roberth
Member
From: The Pale Blue Dot
Registered: 2007-01-12
Posts: 894

Help with PKGBUILD for nvidia driver cards

Hello, I'm trying to make a PKGBUILD for the new geforce beta driver for the kernel26-mm kernel, geforce-utils went just fine, but the the geforce package was more tricky, here's the PKGBUILD:

pkgname=geforce-mm
pkgver=173.08
_kernver='2.6.25-mm'
pkgrel=1
pkgdesc="NVIDIA drivers for kernel26mm."
arch=(i686 x86_64)
[ "$CARCH" = "i686"   ] && ARCH=x86
[ "$CARCH" = "x86_64" ] && ARCH=x86_64
url="http://www.nvidia.com/"
depends=('kernel26mm' 'geforce-utils')
install=geforce.install
source=(http://us.download.nvidia.com/XFree86/Linux-$ARCH/${pkgver}/NVIDIA-Linux-$ARCH-${pkgver}-pkg1.run)
md5sums=()
[ "$CARCH" = "x86_64" ] && md5sums=()

build()
{
  # Extract
  cd $startdir/src/
  sh NVIDIA-Linux-$ARCH-${pkgver}-pkg1.run --extract-only
  cd NVIDIA-Linux-$ARCH-${pkgver}-pkg1

  cd usr/src/nv/
  ln -s Makefile.kbuild Makefile
  make SYSSRC=/lib/modules/${_kernver}/build module || return 1
  
  # install kernel module
  mkdir -p $startdir/pkg/lib/modules/${_kernver}/kernel/drivers/video/
  install -m644 nvidia.ko $startdir/pkg/lib/modules/${_kernver}/kernel/drivers/video/

  sed -i -e "s/KERNEL_VERSION='.*'/KERNEL_VERSION='${_kernver}'/" $startdir/*.install
}

Output when running it:

[roberth@Magda geforce-mm]$ makepkg
==> Making package: geforce-mm 173.08-1  (Mon Apr 14 22:44:41 CEST 2008)
==> Checking Runtime Dependencies...
==> Checking Buildtime Dependencies...
==> Retrieving Sources...
  -> Downloading NVIDIA-Linux-x86-173.08-pkg1.run...
--2008-04-14 22:44:41--  http://us.download.nvidia.com/XFree86/Linux-x86/173.08/NVIDIA-Linux-x86-173.08-pkg1.run
Resolving us.download.nvidia.com... 193.213.121.82, 193.213.121.74
Connecting to us.download.nvidia.com|193.213.121.82|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 18958181 (18M) [application/octet-stream]
Saving to: `NVIDIA-Linux-x86-173.08-pkg1.run'

100%[===========================================================================================================================================================================================>] 18,958,181   710K/s   in 26s    

2008-04-14 22:45:07 (720 KB/s) - `NVIDIA-Linux-x86-173.08-pkg1.run' saved [18958181/18958181]

==> WARNING: Integrity checks (md5) are missing or incomplete.
==> Extracting Sources...
==> Entering fakeroot environment...
==> Starting build()...
Creating directory NVIDIA-Linux-x86-173.08-pkg1
Verifying archive integrity... OK
Uncompressing NVIDIA Accelerated Graphics Driver for Linux-x86 173.08...............................................................................................................................................................................................................................................................................................
NVIDIA: calling KBUILD...
make CC=cc  KBUILD_VERBOSE=1 -C /lib/modules/2.6.25-mm/build SUBDIRS=/home/roberth/pkg/geforce-mm/src/NVIDIA-Linux-x86-173.08-pkg1/usr/src/nv modules
test -e include/linux/autoconf.h -a -e include/config/auto.conf || (        \
    echo;                                \
    echo "  ERROR: Kernel configuration is invalid.";        \
    echo "         include/linux/autoconf.h or include/config/auto.conf are missing.";    \
    echo "         Run 'make oldconfig && make prepare' on kernel src to fix it.";    \
    echo;                                \
    /bin/false)
mkdir -p /home/roberth/pkg/geforce-mm/src/NVIDIA-Linux-x86-173.08-pkg1/usr/src/nv/.tmp_versions ; rm -f /home/roberth/pkg/geforce-mm/src/NVIDIA-Linux-x86-173.08-pkg1/usr/src/nv/.tmp_versions/*
make -f scripts/Makefile.build obj=/home/roberth/pkg/geforce-mm/src/NVIDIA-Linux-x86-173.08-pkg1/usr/src/nv
  cc -Wp,-MD,/home/roberth/pkg/geforce-mm/src/NVIDIA-Linux-x86-173.08-pkg1/usr/src/nv/.nv.o.d  -nostdinc -isystem /usr/lib/gcc/i686-pc-linux-gnu/4.3.0/include -D__KERNEL__ -Iinclude  -include include/linux/autoconf.h -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -O2  -fno-stack-protector -m32 -msoft-float -mregparm=3 -freg-struct-return -mpreferred-stack-boundary=2  -march=i686 -mtune=generic -ffreestanding -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -pipe -Wno-sign-compare -fno-asynchronous-unwind-tables -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -Iinclude/asm-x86/mach-default -fno-omit-frame-pointer -fno-optimize-sibling-calls -Wdeclaration-after-statement -Wno-pointer-sign   -I/home/roberth/pkg/geforce-mm/src/NVIDIA-Linux-x86-173.08-pkg1/usr/src/nv -Wall -Wimplicit -Wreturn-type -Wswitch -Wformat -Wchar-subscripts -Wparentheses -Wpointer-arith -Wno-multichar -Werror -MD   -Wsign-compare -Wno-cast-qual -Wno-error -D__KERNEL__ -DMODULE -DNVRM -DNV_VERSION_STRING=\"173.08\" -UDEBUG -U_DEBUG -DNDEBUG  -DMODULE -D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(nv)"  -D"KBUILD_MODNAME=KBUILD_STR(nvidia)" -c -o /home/roberth/pkg/geforce-mm/src/NVIDIA-Linux-x86-173.08-pkg1/usr/src/nv/nv.o /home/roberth/pkg/geforce-mm/src/NVIDIA-Linux-x86-173.08-pkg1/usr/src/nv/nv.c
In file included from include/linux/list.h:8,
                 from include/linux/preempt.h:11,
                 from include/linux/spinlock.h:49,
                 from include/linux/seqlock.h:29,
                 from include/linux/time.h:8,
                 from include/linux/timex.h:57,
                 from include/linux/sched.h:54,
                 from include/linux/utsname.h:35,
                 from /home/roberth/pkg/geforce-mm/src/NVIDIA-Linux-x86-173.08-pkg1/usr/src/nv/nv-linux.h:19,
                 from /home/roberth/pkg/geforce-mm/src/NVIDIA-Linux-x86-173.08-pkg1/usr/src/nv/nv.c:14:
include/linux/prefetch.h: In function 'prefetch_range':
include/linux/prefetch.h:57: warning: pointer of type 'void *' used in arithmetic
In file included from include/linux/gfp.h:4,
                 from include/linux/slab.h:14,
                 from include/linux/percpu.h:5,
                 from include/linux/rcupdate.h:41,
                 from include/linux/pid.h:4,
                 from include/linux/sched.h:74,
                 from include/linux/utsname.h:35,
                 from /home/roberth/pkg/geforce-mm/src/NVIDIA-Linux-x86-173.08-pkg1/usr/src/nv/nv-linux.h:19,
                 from /home/roberth/pkg/geforce-mm/src/NVIDIA-Linux-x86-173.08-pkg1/usr/src/nv/nv.c:14:
include/linux/mmzone.h: In function 'first_zones_zonelist':
include/linux/mmzone.h:778: warning: comparison between signed and unsigned
include/linux/mmzone.h:781: warning: comparison between signed and unsigned
include/linux/mmzone.h: In function 'next_zones_zonelist':
include/linux/mmzone.h:798: warning: comparison between signed and unsigned
include/linux/mmzone.h:801: warning: comparison between signed and unsigned
In file included from include/asm/dma-mapping_32.h:5,
                 from include/asm/dma-mapping.h:2,
                 from include/linux/dma-mapping.h:52,
                 from include/asm-generic/pci-dma-compat.h:7,
                 from include/asm/pci.h:90,
                 from include/linux/pci.h:937,
                 from /home/roberth/pkg/geforce-mm/src/NVIDIA-Linux-x86-173.08-pkg1/usr/src/nv/nv-linux.h:86,
                 from /home/roberth/pkg/geforce-mm/src/NVIDIA-Linux-x86-173.08-pkg1/usr/src/nv/nv.c:14:
include/linux/scatterlist.h: In function 'sg_virt':
include/linux/scatterlist.h:199: warning: pointer of type 'void *' used in arithmetic
In file included from /home/roberth/pkg/geforce-mm/src/NVIDIA-Linux-x86-173.08-pkg1/usr/src/nv/nv-linux.h:109,
                 from /home/roberth/pkg/geforce-mm/src/NVIDIA-Linux-x86-173.08-pkg1/usr/src/nv/nv.c:14:
include/linux/highmem.h: In function 'zero_user_segments':
include/linux/highmem.h:134: warning: pointer of type 'void *' used in arithmetic
include/linux/highmem.h:134: warning: pointer of type 'void *' used in arithmetic
include/linux/highmem.h:134: warning: pointer of type 'void *' used in arithmetic
include/linux/highmem.h:134: warning: pointer of type 'void *' used in arithmetic
include/linux/highmem.h:137: warning: pointer of type 'void *' used in arithmetic
include/linux/highmem.h:137: warning: pointer of type 'void *' used in arithmetic
include/linux/highmem.h:137: warning: pointer of type 'void *' used in arithmetic
include/linux/highmem.h:137: warning: pointer of type 'void *' used in arithmetic
/home/roberth/pkg/geforce-mm/src/NVIDIA-Linux-x86-173.08-pkg1/usr/src/nv/nv.c: In function 'nv_kern_vma_nopage':
/home/roberth/pkg/geforce-mm/src/NVIDIA-Linux-x86-173.08-pkg1/usr/src/nv/nv.c:1846: error: 'NOPAGE_SIGBUS' undeclared (first use in this function)
/home/roberth/pkg/geforce-mm/src/NVIDIA-Linux-x86-173.08-pkg1/usr/src/nv/nv.c:1846: error: (Each undeclared identifier is reported only once
/home/roberth/pkg/geforce-mm/src/NVIDIA-Linux-x86-173.08-pkg1/usr/src/nv/nv.c:1846: error: for each function it appears in.)
/home/roberth/pkg/geforce-mm/src/NVIDIA-Linux-x86-173.08-pkg1/usr/src/nv/nv.c: At top level:
/home/roberth/pkg/geforce-mm/src/NVIDIA-Linux-x86-173.08-pkg1/usr/src/nv/nv.c:1853: error: unknown field 'nopage' specified in initializer
/home/roberth/pkg/geforce-mm/src/NVIDIA-Linux-x86-173.08-pkg1/usr/src/nv/nv.c:1853: warning: initialization from incompatible pointer type
make[3]: *** [/home/roberth/pkg/geforce-mm/src/NVIDIA-Linux-x86-173.08-pkg1/usr/src/nv/nv.o] Error 1
make[2]: *** [_module_/home/roberth/pkg/geforce-mm/src/NVIDIA-Linux-x86-173.08-pkg1/usr/src/nv] Error 2
NVIDIA: left KBUILD.
nvidia.ko failed to build!
make[1]: *** [module] Error 1
make: *** [module] Error 2
==> ERROR: Build Failed.
    Aborting...

Anybody have a clue?


Use the Source, Luke!

Offline

#2 2008-04-15 20:28:30

tgc
Member
From: DK
Registered: 2004-03-09
Posts: 96

Re: Help with PKGBUILD for nvidia driver cards

I got the same issue - though with a nvidia-mm pkg, version 173.08. I think it might be a mm-issue, and found this page which talks about it: http://www.kuro5hin.org/story/2008/4/4/223541/6704. Does not seem to be an easy fix sad

Last edited by tgc (2008-04-15 20:36:43)

Offline

#3 2008-04-18 11:02:07

tgc
Member
From: DK
Registered: 2004-03-09
Posts: 96

Re: Help with PKGBUILD for nvidia driver cards

It seems I was wrong! I found a patch on the nvidia forums which actually makes it works smile
I don't know if it will work for you, or how safe it is, but I guess it is worth a shot.

The patch:

--- os-agp.c.25    2008-04-02 01:34:49.000000000 -0400
+++ os-agp.c    2008-04-02 01:39:00.000000000 -0400
@@ -293,7 +293,7 @@
     {
          nv_pte_t *page_ptr = at->page_table[i];
 
-         page_ptr->phys_addr = (ptr->memory[i] & PAGE_MASK);
+         page_ptr->phys_addr = (ptr->memory[i]);
          page_ptr->virt_addr = (unsigned long) __va(page_ptr->phys_addr);
          page_ptr->dma_addr  = page_ptr->phys_addr;
     }
--- nv.c.25    2008-03-15 22:00:46.000000000 -0400
+++ nv.c    2008-04-02 01:31:46.000000000 -0400
@@ -613,7 +613,7 @@
     nv_state_t *nv;
     nv_linux_state_t *nvl;
 
-    proc_nvidia = create_proc_entry("nvidia", d_flags, proc_root_driver);
+    proc_nvidia = create_proc_entry("driver/nvidia", d_flags, NULL);
     if (!proc_nvidia)
         goto failed;
 
@@ -1811,6 +1811,19 @@
     }
 }
 
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24))
+int nv_kern_vma_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
+{
+struct page *page;
+
+    page = pfn_to_page(vma->vm_pgoff);
+    if (!page)
+        return VM_FAULT_SIGBUS;
+    get_page(page);
+    vmf->page = page;
+    return 0;
+}
+#else
 struct page *nv_kern_vma_nopage(
     struct vm_area_struct *vma,
     unsigned long address,
@@ -1832,11 +1845,16 @@
     return NOPAGE_SIGBUS;
 #endif
 }
+#endif /* 2.6.24 */
 
 struct vm_operations_struct nv_vm_ops = {
     .open   = nv_kern_vma_open,
     .close  = nv_kern_vma_release,  /* "close" */
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24))
+    .fault  = nv_kern_vma_fault,
+#else
     .nopage = nv_kern_vma_nopage,
+#endif
 };
 
 static nv_file_private_t *

Offline

#4 2008-04-19 12:44:17

Roberth
Member
From: The Pale Blue Dot
Registered: 2007-01-12
Posts: 894

Re: Help with PKGBUILD for nvidia driver cards

Could you please post your PKGBUILDS(nvidia and nvidia-utils)?


Use the Source, Luke!

Offline

#5 2008-04-19 13:00:04

tgc
Member
From: DK
Registered: 2004-03-09
Posts: 96

Re: Help with PKGBUILD for nvidia driver cards

Roberth wrote:

Could you please post your PKGBUILDS(nvidia and nvidia-utils)?

I'll just post the nvidia-mm, nvidia-utils is not modified - except the version.
Be aware that I didn't bother updating the md5sums or stuff like that. Save the patch previously posted as "nopage-nv.patch" in the same folder as the PKGBUILD, which is posted below. The nvidia.install file can be reused from the old version.

# $Id: PKGBUILD,v 1.87 2008/02/27 08:20:11 thomas Exp $
# Maintainer : Thomas Baechler <thomas@archlinux.org>

pkgname=nvidia-mm
#pkgver=169.12
pkgver=173.08
_kernver='2.6.25-mm'
pkgrel=1
pkgdesc="NVIDIA drivers for kernel26."
arch=('i686' 'x86_64')
[ "$CARCH" = "i686"   ] && ARCH=x86
[ "$CARCH" = "x86_64" ] && ARCH=x86_64
url="http://www.nvidia.com/"
#depends=('kernel26>=2.6.24-2' 'kernel26<=2.6.25-0' 'nvidia-utils')
conflicts=('nvidia-96xx' 'nvidia-71xx' 'nvidia-legacy')
license=('custom')
install=nvidia.install
source=(http://us.download.nvidia.com/XFree86/Linux-$ARCH/${pkgver}/NVIDIA-Linux-$ARCH-${pkgver}-pkg0.run nopage-nv.patch)
#md5sums=('e7aaca79c846e34cfe8111040bfee2d0')
#[ "$CARCH" = "x86_64" ] && md5sums=('843a1e8bc1923ba2e4b60f6fab31ad3b')

build()
{
  # Extract
  cd $startdir/src/
  sh NVIDIA-Linux-$ARCH-${pkgver}-pkg0.run --extract-only
  cd NVIDIA-Linux-$ARCH-${pkgver}-pkg0
  
  # Any extra patches are applied in here...
  cd usr/src/nv
  patch -i ../../../../nopage-nv.patch -p0

#  cd usr/src/nv/
  ln -s Makefile.kbuild Makefile
  make SYSSRC=/lib/modules/${_kernver}/build module 
  
  # install kernel module
  mkdir -p $startdir/pkg/lib/modules/${_kernver}/kernel/drivers/video/
  install -m644 nvidia.ko $startdir/pkg/lib/modules/${_kernver}/kernel/drivers/video/

  sed -i -e "s/KERNEL_VERSION='.*'/KERNEL_VERSION='${_kernver}'/" $startdir/*.install
}

Offline

#6 2008-04-22 15:08:41

Demind
Member
Registered: 2007-07-10
Posts: 111

Re: Help with PKGBUILD for nvidia driver cards

The driver seems very stable indeed.
However the solution of patching kernel and then driver is working.

OT: If anyone using -mm patches managed to use the STACKPROTECTOR option i would be very happy.
Obviously i can't yet dunno why sad

Offline

Board footer

Powered by FluxBB