# Nvidia and mm-sources

## potatoface

hi,

my problem is that the newest nvidia-kernel doesnt compile with mm-sources.

the versions are

```
nvidia-kernel-1.0.6629-r2

nvidia-glx-1.0.6629-r1

nvidia-settings-1.0.6629
```

the versions of the kernels

```
mm-sources-2.6.10-r2

mm-sources-2.6.11_rc1-r1
```

this is the whole error output when i want to merge nvidia-kernel. it is quite the same for both mm-kernels

```
>>> emerge (1 of 4) media-video/nvidia-kernel-1.0.6629-r2 to /

x86

>>> md5 src_uri ;-) NVIDIA-Linux-x86-1.0-6629-pkg1.run

x86

 * Determining the location of the kernel source code

 * Found kernel source directory:

 *     /usr/src/linux

 * Found sources for kernel version:

 *     2.6.10-mm2

 * Using KV_OBJ=ko

 * Checking for MTRR support...                                                                                                       [ ok ]

x86

>>> Unpacking source...

Creating directory NVIDIA-Linux-x86-1.0-6629-pkg1

Verifying archive integrity... OK

Uncompressing NVIDIA Accelerated Graphics Driver for Linux-x86 1.0-6629.........................................................................................................................................................................................................

x86

 * Applying nv-shutup-warnings.patch ...                                                                                              [ ok ]

 * Applying NVIDIA_kernel-1.0-6629-1155389.patch ...                                                                                  [ ok ]

 * Applying NVIDIA_kernel-1.0-6629-1165235.patch ...                                                                                  [ ok ]

 * Applying NVIDIA_kernel-1.0-6629-1171869.patch ...                                                                                  [ ok ]

 * Applying NVIDIA_kernel-1.0-6629-1175225.patch ...                                                                                  [ ok ]

 * Applying NVIDIA_kernel-1.0-6629-1182399.patch ...                                                                                  [ ok ]

 * Applying NVIDIA_kernel-1.0-6629-1189413.patch ...                                                                                  [ ok ]

 * Applying 2.6 kernel patches

 * Applying conftest_koutput_includes.patch ...                                                                                       [ ok ]

 * Applying nv-disable-preempt-on-smp_processor_id.patch ...                                                                          [ ok ]

 * Applying NVIDIA_kernel-1.0-6629-1161283.patch ...                                                                                  [ ok ]

 * Converting NVIDIA-Linux-x86-1.0-6629-pkg1/usr/src/nv/Makefile.kbuild to use M= instead of SUBDIRS=...                              [ ok ]

>>> Source unpacked.

x86

 * Preparing nvidia module

NVIDIA: calling KBUILD...

make CC=cc  KBUILD_VERBOSE=1 -C /usr/src/linux M=/home/tmp/portage/nvidia-kernel-1.0.6629-r2/work/NVIDIA-Linux-x86-1.0-6629-pkg1/usr/src/nvmodules

make[2]: warning: jobserver unavailable: using -j1.  Add `+' to parent make rule.

mkdir -p /home/tmp/portage/nvidia-kernel-1.0.6629-r2/work/NVIDIA-Linux-x86-1.0-6629-pkg1/usr/src/nv/.tmp_versions

make -f scripts/Makefile.build obj=/home/tmp/portage/nvidia-kernel-1.0.6629-r2/work/NVIDIA-Linux-x86-1.0-6629-pkg1/usr/src/nv

echo \#define NV_COMPILER \"`cc -v 2>&1 | tail -n 1`\" > /home/tmp/portage/nvidia-kernel-1.0.6629-r2/work/NVIDIA-Linux-x86-1.0-6629-pkg1/usr/src/nv/nv_compiler.h

  cc -Wp,-MD,/home/tmp/portage/nvidia-kernel-1.0.6629-r2/work/NVIDIA-Linux-x86-1.0-6629-pkg1/usr/src/nv/.nv.o.d -nostdinc -isystem /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.5/include -D__KERNEL__ -Iinclude  -Wall -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -ffreestanding -O2     -fomit-frame-pointer -pipe -msoft-float -mpreferred-stack-boundary=2  -march=athlon -Iinclude/asm-i386/mach-default  -I/home/tmp/portage/nvidia-kernel-1.0.6629-r2/work/NVIDIA-Linux-x86-1.0-6629-pkg1/usr/src/nv -Wall -Wimplicit -Wreturn-type -Wswitch -Wformat-Wchar-subscripts -Wparentheses -Wno-multichar  -Werror -O -fno-common -MD   -Wno-cast-qual -Wno-error -D_LOOSE_KERNEL_NAMES -D__KERNEL__ -DMODULE  -DNTRM -D_GNU_SOURCE -D_LOOSE_KERNEL_NAMES -D__KERNEL__ -DMODULE  -DNV_MAJOR_VERSION=1 -DNV_MINOR_VERSION=0 -DNV_PATCHLEVEL=6629  -DNV_UNIX   -DNV_LINUX   -DNV_INT64_OK   -DNVCPU_X86      -UDEBUG -U_DEBUG -DNDEBUG -DNV_REMAP_PFN_RANGE_PRESENT -DNV_CHANGE_PAGE_ATTR_PRESENT -DNV_PCI_DISABLE_DEVICE_PRESENT -DNV_CLASS_SIMPLE_CREATE_PRESENT -DNV_PCI_GET_CLASS_PRESENT  -DMODULE -DKBUILD_BASENAME=nv -DKBUILD_MODNAME=nvidia -c -o /home/tmp/portage/nvidia-kernel-1.0.6629-r2/work/NVIDIA-Linux-x86-1.0-6629-pkg1/usr/src/nv/nv.o /home/tmp/portage/nvidia-kernel-1.0.6629-r2/work/NVIDIA-Linux-x86-1.0-6629-pkg1/usr/src/nv/nv.c

/home/tmp/portage/nvidia-kernel-1.0.6629-r2/work/NVIDIA-Linux-x86-1.0-6629-pkg1/usr/src/nv/nv.c: In function `nvidia_init_module':

/home/tmp/portage/nvidia-kernel-1.0.6629-r2/work/NVIDIA-Linux-x86-1.0-6629-pkg1/usr/src/nv/nv.c:936: warning: `pm_register' is deprecated (declared at include/linux/pm.h:106)

/home/tmp/portage/nvidia-kernel-1.0.6629-r2/work/NVIDIA-Linux-x86-1.0-6629-pkg1/usr/src/nv/nv.c:993: warning: `pm_unregister' is deprecated(declared at include/linux/pm.h:111)

/home/tmp/portage/nvidia-kernel-1.0.6629-r2/work/NVIDIA-Linux-x86-1.0-6629-pkg1/usr/src/nv/nv.c: In function `nvidia_exit_module':

/home/tmp/portage/nvidia-kernel-1.0.6629-r2/work/NVIDIA-Linux-x86-1.0-6629-pkg1/usr/src/nv/nv.c:1072: warning: `pm_unregister' is deprecated (declared at include/linux/pm.h:111)

/home/tmp/portage/nvidia-kernel-1.0.6629-r2/work/NVIDIA-Linux-x86-1.0-6629-pkg1/usr/src/nv/nv.c: In function `nv_agp_init':

/home/tmp/portage/nvidia-kernel-1.0.6629-r2/work/NVIDIA-Linux-x86-1.0-6629-pkg1/usr/src/nv/nv.c:3010: warning: `inter_module_put' is deprecated (declared at include/linux/module.h:577)

  cc -Wp,-MD,/home/tmp/portage/nvidia-kernel-1.0.6629-r2/work/NVIDIA-Linux-x86-1.0-6629-pkg1/usr/src/nv/.nv-vm.o.d -nostdinc -isystem /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.5/include -D__KERNEL__ -Iinclude  -Wall -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -ffreestanding -O2     -fomit-frame-pointer -pipe -msoft-float -mpreferred-stack-boundary=2  -march=athlon -Iinclude/asm-i386/mach-default -I/home/tmp/portage/nvidia-kernel-1.0.6629-r2/work/NVIDIA-Linux-x86-1.0-6629-pkg1/usr/src/nv -Wall -Wimplicit -Wreturn-type -Wswitch -Wformat -Wchar-subscripts -Wparentheses -Wno-multichar  -Werror -O -fno-common -MD   -Wno-cast-qual -Wno-error -D_LOOSE_KERNEL_NAMES -D__KERNEL__ -DMODULE  -DNTRM -D_GNU_SOURCE -D_LOOSE_KERNEL_NAMES -D__KERNEL__ -DMODULE  -DNV_MAJOR_VERSION=1 -DNV_MINOR_VERSION=0 -DNV_PATCHLEVEL=6629 -DNV_UNIX   -DNV_LINUX   -DNV_INT64_OK   -DNVCPU_X86      -UDEBUG -U_DEBUG -DNDEBUG -DNV_REMAP_PFN_RANGE_PRESENT -DNV_CHANGE_PAGE_ATTR_PRESENT -DNV_PCI_DISABLE_DEVICE_PRESENT -DNV_CLASS_SIMPLE_CREATE_PRESENT -DNV_PCI_GET_CLASS_PRESENT  -DMODULE -DKBUILD_BASENAME=nv_vm -DKBUILD_MODNAME=nvidia -c -o /home/tmp/portage/nvidia-kernel-1.0.6629-r2/work/NVIDIA-Linux-x86-1.0-6629-pkg1/usr/src/nv/nv-vm.o /home/tmp/portage/nvidia-kernel-1.0.6629-r2/work/NVIDIA-Linux-x86-1.0-6629-pkg1/usr/src/nv/nv-vm.c

  cc -Wp,-MD,/home/tmp/portage/nvidia-kernel-1.0.6629-r2/work/NVIDIA-Linux-x86-1.0-6629-pkg1/usr/src/nv/.os-agp.o.d -nostdinc -isystem /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.5/include -D__KERNEL__ -Iinclude  -Wall -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -ffreestanding -O2     -fomit-frame-pointer -pipe -msoft-float -mpreferred-stack-boundary=2  -march=athlon -Iinclude/asm-i386/mach-default  -I/home/tmp/portage/nvidia-kernel-1.0.6629-r2/work/NVIDIA-Linux-x86-1.0-6629-pkg1/usr/src/nv -Wall -Wimplicit -Wreturn-type -Wswitch -Wformat -Wchar-subscripts -Wparentheses -Wno-multichar  -Werror -O -fno-common -MD   -Wno-cast-qual -Wno-error -D_LOOSE_KERNEL_NAMES -D__KERNEL__ -DMODULE  -DNTRM -D_GNU_SOURCE -D_LOOSE_KERNEL_NAMES -D__KERNEL__ -DMODULE  -DNV_MAJOR_VERSION=1 -DNV_MINOR_VERSION=0 -DNV_PATCHLEVEL=6629  -DNV_UNIX   -DNV_LINUX   -DNV_INT64_OK   -DNVCPU_X86      -UDEBUG -U_DEBUG -DNDEBUG -DNV_REMAP_PFN_RANGE_PRESENT -DNV_CHANGE_PAGE_ATTR_PRESENT -DNV_PCI_DISABLE_DEVICE_PRESENT -DNV_CLASS_SIMPLE_CREATE_PRESENT -DNV_PCI_GET_CLASS_PRESENT  -DMODULE -DKBUILD_BASENAME=os_agp -DKBUILD_MODNAME=nvidia -c -o /home/tmp/portage/nvidia-kernel-1.0.6629-r2/work/NVIDIA-Linux-x86-1.0-6629-pkg1/usr/src/nv/os-agp.o /home/tmp/portage/nvidia-kernel-1.0.6629-r2/work/NVIDIA-Linux-x86-1.0-6629-pkg1/usr/src/nv/os-agp.c

/home/tmp/portage/nvidia-kernel-1.0.6629-r2/work/NVIDIA-Linux-x86-1.0-6629-pkg1/usr/src/nv/os-agp.c: In function `KernInitAGP':

/home/tmp/portage/nvidia-kernel-1.0.6629-r2/work/NVIDIA-Linux-x86-1.0-6629-pkg1/usr/src/nv/os-agp.c:85: error: too few arguments to function

/home/tmp/portage/nvidia-kernel-1.0.6629-r2/work/NVIDIA-Linux-x86-1.0-6629-pkg1/usr/src/nv/os-agp.c:88: warning: `inter_module_put' is deprecated (declared at include/linux/module.h:577)

/home/tmp/portage/nvidia-kernel-1.0.6629-r2/work/NVIDIA-Linux-x86-1.0-6629-pkg1/usr/src/nv/os-agp.c:113: warning: passing arg 1 of pointer to function from incompatible pointer type

/home/tmp/portage/nvidia-kernel-1.0.6629-r2/work/NVIDIA-Linux-x86-1.0-6629-pkg1/usr/src/nv/os-agp.c:113: error: too few arguments to function

/home/tmp/portage/nvidia-kernel-1.0.6629-r2/work/NVIDIA-Linux-x86-1.0-6629-pkg1/usr/src/nv/os-agp.c:173: warning: passing arg 1 of pointer to function makes pointer from integer without a cast

/home/tmp/portage/nvidia-kernel-1.0.6629-r2/work/NVIDIA-Linux-x86-1.0-6629-pkg1/usr/src/nv/os-agp.c:173: error: too few arguments to function

/home/tmp/portage/nvidia-kernel-1.0.6629-r2/work/NVIDIA-Linux-x86-1.0-6629-pkg1/usr/src/nv/os-agp.c:185: error: too few arguments to function

/home/tmp/portage/nvidia-kernel-1.0.6629-r2/work/NVIDIA-Linux-x86-1.0-6629-pkg1/usr/src/nv/os-agp.c:186: warning: `inter_module_put' is deprecated (declared at include/linux/module.h:577)

/home/tmp/portage/nvidia-kernel-1.0.6629-r2/work/NVIDIA-Linux-x86-1.0-6629-pkg1/usr/src/nv/os-agp.c: In function `KernTeardownAGP':

/home/tmp/portage/nvidia-kernel-1.0.6629-r2/work/NVIDIA-Linux-x86-1.0-6629-pkg1/usr/src/nv/os-agp.c:216: error: too few arguments to function

/home/tmp/portage/nvidia-kernel-1.0.6629-r2/work/NVIDIA-Linux-x86-1.0-6629-pkg1/usr/src/nv/os-agp.c:218: warning: `inter_module_put' is deprecated (declared at include/linux/module.h:577)

/home/tmp/portage/nvidia-kernel-1.0.6629-r2/work/NVIDIA-Linux-x86-1.0-6629-pkg1/usr/src/nv/os-agp.c: In function `KernAllocAGPPages':

/home/tmp/portage/nvidia-kernel-1.0.6629-r2/work/NVIDIA-Linux-x86-1.0-6629-pkg1/usr/src/nv/os-agp.c:265: warning: passing arg 1 of pointer to function makes pointer from integer without a cast

/home/tmp/portage/nvidia-kernel-1.0.6629-r2/work/NVIDIA-Linux-x86-1.0-6629-pkg1/usr/src/nv/os-agp.c:265: error: too few arguments to function

make[3]: *** [/home/tmp/portage/nvidia-kernel-1.0.6629-r2/work/NVIDIA-Linux-x86-1.0-6629-pkg1/usr/src/nv/os-agp.o] Error 1

make[2]: *** [_module_/home/tmp/portage/nvidia-kernel-1.0.6629-r2/work/NVIDIA-Linux-x86-1.0-6629-pkg1/usr/src/nv] Error 2

NVIDIA: left KBUILD.

nvidia.ko failed to build!

make[1]: *** [module] Error 1

make: *** [module] Error 2

!!! ERROR: media-video/nvidia-kernel-1.0.6629-r2 failed.

!!! Function linux-mod_src_compile, Line 340, Exitcode 2

!!! Unable to make                                  IGNORE_CC_MISMATCH=yes V=1 SYSSRC=/usr/src/linux SYSOUT=/usr/src/linux clean module.

!!! If you need support, post the topmost build error, NOT this status message.
```

i think the problem are the mm-sources because the nvidia drivers compiled with no errors with these kernels

```
gentoo-dev-sources-2.6.10-r5

nitro-sources-2.6.10-r4
```

anyone out there with the same problems?  :Crying or Very sad: 

----------

## moocha

Faced the exact same problem. This thread seems to offer a solution: https://forums.gentoo.org/viewtopic.php?t=278745

If that doesn't work, see my workaround on the same thread: https://forums.gentoo.org/viewtopic.php?p=1978200#1978200

----------

## potatoface

 *moocha wrote:*   

> I fixed it using a different method, before finding that thread. Had to add some spaces editing /usr/src/linux/agp_backend.h - namely going to the end and changing the function pointer signatures like this:
> 
> Code:
> 
> typedef struct {
> ...

 

i read this and didnt understand it.

the only thing you did was editing the agp_backend.h file?

could you explain it not so complicated, too?   :Embarassed: 

----------

## potatoface

i tried your workaround and this one too with no luck ...

----------

## potatoface

anyone with a solution?

----------

## yoyo

I'll try to help ...

First copy the 2 patches in your /root directory :

 *Quote:*   

> --- linux/drivers/char/agp/generic.c.orig	2005-01-09 15:21:08.000000000 -0500
> 
> +++ linux/drivers/char/agp/generic.c	2005-01-09 15:21:32.000000000 -0500
> 
> @@ -211,6 +211,7 @@
> ...

  and  *Quote:*   

> --- /usr/src/nv/os-agp.c.6629	2005-01-09 15:28:42.000000000 -0500
> 
> +++ /usr/src/nv/os-agp.c	2005-01-09 15:30:00.000000000 -0500
> 
> @@ -82,7 +82,7 @@
> ...

 

Let's call first k.patch and other n.patch.

Apply the kernel patch : 

```
cd /usr/src/linux; patch -sp1 < /root/k.patch
```

Then : 

```
cd /usr/portage/media-video/nvidia-kernel; cp /root/n.patch ./files/1.0.6629/
```

Edit the nvidia-kernel-1.0.6629-r2.ebuild.

Section "src_unpack()", kernel_2.6 part add : 

```
# patch for 2.6.10-mm sources

epatch ${FILESDIR}/${PV}/n.patch

/usr/bin/patch -p3 < ${FILESDIR}/${PV}/n.patch
```

Create the new digest :"ebuild nvidia-kernel-1.0.6629-r2.ebuild digest.

Make your kernel then emerge nvidia-kernel.

Hope this works ...

EDIT : Don't forget that next "emerge sync" erase the nvidia ebuild modifications ...

----------

## potatoface

ok i will try this.

thank you for your patience!   :Rolling Eyes: 

----------

## potatoface

hi,

what is this?

```
bash-2.05b# patch -sp1 < /root/k.patch

patch: **** malformed patch at line 4: new->memory[i] = virt_to_phys(addr);
```

and this?

```
bash-2.05b# ebuild nvidia-kernel-1.0.6629-r2.ebuild digest

x86

>>> Generating digest file...

<<< NVIDIA-Linux-x86-1.0-6629-pkg1.run

<<< NVIDIA-Linux-x86_64-1.0-6629-pkg2.run

Traceback (most recent call last):

  File "/usr/sbin/ebuild", line 49, in ?

    a=portage.doebuild(pargs[0],x,getroot(),tmpsettings,debug=debug,cleanup=cleanup)

  File "/usr/lib/portage/pym/portage.py", line 2520, in doebuild

    return (not digestgen(aalist,mysettings,overwrite=1))

  File "/usr/lib/portage/pym/portage.py", line 1950, in digestgen

    mydigests=digestCreate(myarchives, basedir, oldDigest=myolddigest)

  File "/usr/lib/portage/pym/portage.py", line 1886, in digestCreate

    raise portage_exception.DigestException, "Size mismatch during checksums"

portage_exception.DigestException: 'Size mismatch during checksums'
```

and i saw these lines when compiling my 2.6.10-mm kernel

```
drivers/char/agp/backend.c: In function `agp_add_bridge':

drivers/char/agp/backend.c:288: warning: `inter_module_register' is deprecated (declared at include/linux/module.h:572)

drivers/char/agp/backend.c: In function `agp_remove_bridge':

drivers/char/agp/backend.c:314: warning: `inter_module_unregister' is deprecated (declared at include/linux/module.h:573)

```

and this

```
>>> emerge (1 of 4) media-video/nvidia-kernel-1.0.6629-r2 to /

x86

>>> md5 src_uri ;-) NVIDIA-Linux-x86-1.0-6629-pkg1.run

x86

 * Determining the location of the kernel source code

 * Found kernel source directory:

 *     /usr/src/linux

 * Found sources for kernel version:

 *     2.6.10-mm2

 * Using KV_OBJ=ko

 * Checking for MTRR support...                                                                                                       [ ok ]

x86

>>> Unpacking source...

Creating directory NVIDIA-Linux-x86-1.0-6629-pkg1

Verifying archive integrity... OK

Uncompressing NVIDIA Accelerated Graphics Driver for Linux-x86 1.0-6629.........................................................................................................................................................................................................

x86

 * Applying nv-shutup-warnings.patch ...                                                                                              [ ok ]

 * Applying NVIDIA_kernel-1.0-6629-1155389.patch ...                                                                                  [ ok ]

 * Applying NVIDIA_kernel-1.0-6629-1165235.patch ...                                                                                  [ ok ]

 * Applying NVIDIA_kernel-1.0-6629-1171869.patch ...                                                                                  [ ok ]

 * Applying NVIDIA_kernel-1.0-6629-1175225.patch ...                                                                                  [ ok ]

 * Applying NVIDIA_kernel-1.0-6629-1182399.patch ...                                                                                  [ ok ]

 * Applying NVIDIA_kernel-1.0-6629-1189413.patch ...                                                                                  [ ok ]

 * Applying 2.6 kernel patches

 * Applying conftest_koutput_includes.patch ...                                                                                       [ ok ]

 * Applying nv-disable-preempt-on-smp_processor_id.patch ...                                                                          [ ok ]

 * Applying NVIDIA_kernel-1.0-6629-1161283.patch ...                                                                                  [ ok ]

 * Applying n.patch ...

 * Failed Patch: n.patch!

 *

 * Include in your bugreport the contents of:

 *

 *   /home/tmp/portage/nvidia-kernel-1.0.6629-r2/temp/n.patch-12217.out

!!! ERROR: media-video/nvidia-kernel-1.0.6629-r2 failed.

!!! Function epatch, Line 352, Exitcode 0

!!! Failed Patch: n.patch!

!!! If you need support, post the topmost build error, NOT this status message.
```

any suggestions?   :Crying or Very sad: 

----------

## yoyo

Do you apply k.patch on 2.6.10-mm2 kernle sources ??

Maybe the second problem with nvidia ebuild can be solved by using portdir overlay.

Try this : 

```
mkdir /usr/local/portage

cp -R /usr/portage/media-video/nvidia-kernel /usr/local/portage/

cd /usr/portage/media-video/nvidia-kernel

ebuild nvidia-kernel-1.0.6629-r2.ebuild digest
```

Hope this works ...

----------

