# alternate nvidia-kernel mm-sources fix thread

## chickaroo

EDIT: This ebuild is obsoleted by gentoo's nvidia-kernel-1.0.6111-r2 all you need to do is ACCEPT_KEYWORDS="~ARCH" and you'll emerge it. 

nvidia-kernel-1.0.6111-r2.tar.bz2

or if that doesn't work

nvidia-kernel-1.0.6111-r2.tar.gz

^rename that to bz2 (don't ask lol)

just extract this in /usr/portage/ and then do

```
 ebuild /usr/portage/media-video/nvidia-kernel/nvidia-kernel-1.0.6111-r2.ebuild digest
```

then emerge nvidia-kernel

ebuild includes:

power-suspend-2.6.9-changes.patch

nv_enable_pci.patch

fix_pci_find_class.patch

vmalloc_reserve.patch

tested and working on my system with kernel 2.6.9-rc2-mm1 with con's staircase 8.4 patches. (found here    if anyone wants them )

update: also has been working with 2.6.9-rc2-mm2 with con's new staircase 8.6 patches

fix_pci_find_class.patch i found in the files from the thread here

__VMALLOC_RESERVE fix i found in the linux kernel mailing list, which was in a manual fix here

(which i never got to work)

marienz at #gentoo made the vmalloc_reserve fix into a patch for me (thanks!)

----------

## Moloch

 *chickaroo wrote:*   

> http://gentoo-chick.is-a-geek.net:81/nvidia-kernel-1.0.6111-r2.tar.bz2
> 
> just extract this in /usr/portage/ and then do
> 
> ```
> ...

 

Ahh cool thanks. The vmalloc fix might explain my instability issues. I just declared the varible in nv.c, copied from some one on here. That just made the module probeable   :Rolling Eyes:   but not stable.

----------

## chickaroo

sorry about my server downage if anyone's been trying to download from me. my reiser4 RAID0 went down  :Surprised:  lol. but i was back up in no time with my stage4 and all my backups. 

just got someone to mirror it for me also  :Smile: 

----------

## smg

well i can use this for all > 2.6.9 kernels?

----------

## chickaroo

Yes it should work on all kernels that get those errors. however if used on an older kernel, it'll get the opposite errors cuz it'll be fixing something that's not broke.

----------

## RealityMage

I suggest extracting that into your portage overlay directory. So extract em into /usr/local/portage/ (for me) instead.

Thanks a great deal for the patch, by the way.

----------

## Phk

Love you guys.... saved my xorg  :Razz: 

thanks!   :Wink: 

----------

## Gentii

I don't understand what you did... What's the difference with Damouse's ebuilds which are available for ages ?

----------

## Gentii

As far as I can see, the only difference is in the vmalloc patch :

```
< +// patch. I don't know what it does, but who cares.

< +unsigned int __VMALLOC_RESERVE = 128 << 20;

---

> +#ifndef __VMALLOC_RESERVE

> +unsigned int __VMALLOC_RESERVE;

> +#endif
```

So the both are working for kernels <= mm3. But there a new breakage in the mm4. If you could fix it too, it would be very nice  :Smile:  I didn't find any patch yet on lkml.org.

I didn't learn the error by earth, but it was an error in dmesg when I tried to modprobe it. Anyway I think most people will have the same problem too :p

----------

## c0debreaker

I followed the instructions to the letter but I get a failed build.  These are the ending lines but I can post the whole thing if needed:

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

!!! Function src_compile, Line 93, Exitcode 2

!!! Failed to build module

I am using the gentoo-dev-sources - 2.6.8-gentoo-r4 and need to get my nvidia card running.  (I haven't been able to play NWN for four days!!!)

 :Sad: 

----------

## chickaroo

 *c0debreaker wrote:*   

> I followed the instructions to the letter but I get a failed build.  These are the ending lines but I can post the whole thing if needed:
> 
> !!! ERROR: media-video/nvidia-kernel-1.0.6111-r2 failed.
> 
> !!! Function src_compile, Line 93, Exitcode 2
> ...

 

try recompiling your kernel first and make sure your symlink in /usr/src/linux is correct.

EDIT: actually i just noticed your using 2.6.8.1-gentoo... that can use the standard portage nvidia drivers, the one i released won't work on that.

----------

## chickaroo

Okay i managed to fix nvidia drivers once again... this is more of a kernel workaround, rather then the actual driver fix. would be nice to get a true fix for it, like i've seen people over here have been "trying", but... this is what i did. (seems to be the only working one)

I reversed the following patches:

convert-references-to-remap_page_range-under-arch-and-documentation-to-remap_pfn_range.patch

convert-users-of-remap_page_range-under-drivers-and-net-to-use-remap_pfn_range.patch

convert-users-of-remap_page_range-under-include-asm--to-use-remap_pfn_range.patch

convert-users-of-remap_page_range-under-sound-to-use-remap_pfn_range.patch

for-mm-only-remove-remap_page_range-completely.patch

introduce-remap_pfn_range-to-replace-remap_page_range.patch

And added 

```
EXPORT_SYMBOL(__VMALLOC_RESERVE);
```

 under  

```
unsigned int __VMALLOC_RESERVE = 128 << 20;
```

 in 

```
/usr/src/linux/arch/i386/mm/init.c
```

This is a bit if a pain in the ass, so i wrote a script to automate it all.

It downloads all the patches, reverses it, and patches init.c with my patch.

Download the script from:

here

or

here

Copy it to /usr/src/linux, chmod it, and execute it.

Thats it  :Smile: 

Tested and working on my box with 2.6.9-rc2-mm4

Note: other kernels such as love-sources already have those patches reversed, so it would only need the export-vmalloc.patch (i think) which can be found

here or here

(which is applied with 'patch -p1 < export-vmalloc.patch' in /usr/src/linux)

BTW: you don't need my previous nvidia-kernel fix on this one. nvidia-kernel-1.0.6111-r1 works fine on it.

----------

## radek

and what about nvidia + 2.6.9-rc3-mm1 ?

Your ebuild -r2 is not enough. modprobe nvidia results in unresolved symbols.

is there possibility to patch just nvidia sources leaving kernel intact ? or i have to use your script ?  :Sad: 

----------

## chickaroo

 *radek wrote:*   

> and what about nvidia + 2.6.9-rc3-mm1 ?
> 
> Your ebuild -r2 is not enough. modprobe nvidia results in unresolved symbols.
> 
> is there possibility to patch just nvidia sources leaving kernel intact ? or i have to use your script ? 

 

well they seem to have b0rked a lot of things... this is the best i can do. in my previous post, i linked to the other thread for mm-sources fixes, which is over here. i think they finally got with a fix for it.

 i haven't had any luck on rc3-mm1 at all. compile errors (apic stuff). seems i'm not the only one on the linux kernel mailing list. it should be fixed soon.

 but anyways, this is my updated script. i haven't been able to test it, so don't bitch at me if it doesn't work  :Razz: 

nvidia-rc3-mm1-fix.sh

Edit: just fixed my link. even tho this is obsolete..

----------

## graadz

You should not extract  nvidia-kernel-1.0.6111-r2.tar.gz  in /usr/portage because the next 

```

# emerge sync

```

will remove it from the portage tree. That's why portage comes with an overlay directory. You can set it in /etc/make.conf:

```

# PORTDIR_OVERLAY is a directory where local ebuilds may be stored without

#     concern that they will be deleted by rsync updates. Default is not

#     defined.

PORTDIR_OVERLAY=/usr/local/portage

```

So you should extract it there. After that you need to build a digest for that particular file.  With the PORTDIR_OVERLAY set to the example above this will be:

```

# ebuild /usr/local/portage/media-video/nvidia-kernel/nvidia-kernel-1.0.6111-r2.ebuild digest

# emerge nvidia-kernel

```

Ciao!

G

Kernel: 2.6.9-rc2-mm3

Nvidia-kernel: 1.0.6111-r2

Compiler: gcc 3.3.4-r1

 *Moloch wrote:*   

>  *chickaroo wrote:*   http://gentoo-chick.is-a-geek.net:81/nvidia-kernel-1.0.6111-r2.tar.bz2
> 
> just extract this in /usr/portage/ and then do
> 
> ```
> ...

 

----------

## chickaroo

nice! i never knew about that lol...  :Smile: 

might be confusing to some users though. i think it's just easiest to extract it in /usr/portage/ and then when you need it again you can re-extract the tar... but this does seem like the proper way.

----------

## schrippe

is this patch used to fix this problem:?

(==) NVIDIA(0): Silken mouse enabled

(**) Option "dpms" "On"

(**) NVIDIA(0): DPMS enabled

(II) Loading extension NV-CONTROL

(II) Loading extension XINERAMA

(==) RandR enabled

Symbol __glXgetActiveScreen from module /usr/X11R6/lib/modules/extensions/libdri.a is unresolved!

Symbol __glXgetActiveScreen from module /usr/X11R6/lib/modules/extensions/libdri.a is unresolved!

Symbol __glXLastContext from module /usr/X11R6/lib/modules/extensions/libGLcore.a is unresolved!

Symbol __glXFree from module /usr/X11R6/lib/modules/extensions/libGLcore.a is unresolved!

Symbol __glXMalloc from module /usr/X11R6/lib/modules/extensions/libGLcore.a is unresolved!

Symbol __glXFree from module /usr/X11R6/lib/modules/extensions/libGLcore.a is unresolved!

Symbol __glXFree from module /usr/X11R6/lib/modules/extensions/libGLcore.a is unresolved!

Symbol _gl_context_modes_destroy from module /usr/X11R6/lib/modules/extensions/libGLcore.a is unresolved!

Symbol __glXFree from module /usr/X11R6/lib/modules/extensions/libGLcore.a is unresolved!

Symbol _gl_convert_to_x_visual_type from module /usr/X11R6/lib/modules/extensions/libGLcore.a is unresolved!

Symbol __glXMalloc from module /usr/X11R6/lib/modules/extensions/libGLcore.a is unresolved!

Symbol __glXMalloc from module /usr/X11R6/lib/modules/extensions/libGLcore.a is unresolved!

Symbol _gl_convert_to_x_visual_type from module /usr/X11R6/lib/modules/extensions/libGLcore.a is unresolved!

Symbol __glXFree from module /usr/X11R6/lib/modules/extensions/libGLcore.a is unresolved!

Symbol __glXFree from module /usr/X11R6/lib/modules/extensions/libGLcore.a is unresolved!

Symbol __glXFree from module /usr/X11R6/lib/modules/extensions/libGLcore.a is unresolved!

Symbol __glXFree from module /usr/X11R6/lib/modules/extensions/libGLcore.a is unresolved!

Symbol __glXFree from module /usr/X11R6/lib/modules/extensions/libGLcore.a is unresolved!

Symbol __glXFree from module /usr/X11R6/lib/modules/extensions/libGLcore.a is unresolved!

Symbol _gl_context_modes_destroy from module /usr/X11R6/lib/modules/extensions/libGLcore.a is unresolved!

Symbol __glXFree from module /usr/X11R6/lib/modules/extensions/libGLcore.a is unresolved!

Symbol _gl_convert_from_x_visual_type from module /usr/X11R6/lib/modules/extensions/libGLcore.a is unresolved!

Symbol _gl_copy_visual_to_context_mode from module /usr/X11R6/lib/modules/extensions/libGLcore.a is unresolved!

Symbol __glXFree from module /usr/X11R6/lib/modules/extensions/libGLcore.a is unresolved!

Symbol __glXFree from module /usr/X11R6/lib/modules/extensions/libGLcore.a is unresolved!

Symbol __glXFree from module /usr/X11R6/lib/modules/extensions/libGLcore.a is unresolved!

Symbol __glXFree from module /usr/X11R6/lib/modules/extensions/libGLcore.a is unresolved!

Symbol __glXFree from module /usr/X11R6/lib/modules/extensions/libGLcore.a is unresolved!

Symbol __glXMalloc from module /usr/X11R6/lib/modules/extensions/libGLcore.a is unresolved!

Symbol __glXMalloc from module /usr/X11R6/lib/modules/extensions/libGLcore.a is unresolved!

Symbol __glXMalloc from module /usr/X11R6/lib/modules/extensions/libGLcore.a is unresolved!

Symbol _gl_context_modes_create from module /usr/X11R6/lib/modules/extensions/libGLcore.a is unresolved!

Symbol __glXMalloc from module /usr/X11R6/lib/modules/extensions/libGLcore.a is unresolved!

Symbol __glXMalloc from module /usr/X11R6/lib/modules/extensions/libGLcore.a is unresolved!

Symbol __glXMalloc from module /usr/X11R6/lib/modules/extensions/libGLcore.a is unresolved!

(II) Initializing built-in extension MIT-SHM

(II) Initializing built-in extension XInputExtension

(II) Initializing built-in extension XTEST

(II) Initializing built-in extension XKEYBOARD

<Nvidia-Kernel 1.0.6111-r2

<Nvidia-Glx 1.0.6111

<Kernel 2.6.8.1-gentoo-r10

<Kernel Modul loaded 

... 

rtc                    11464  0 

nvidia               4819924  12 

thanks

----------

## chickaroo

 *schrippe wrote:*   

> is this patch used to fix this problem:?
> 
> 

 

no this thread was for the older mm-sources kernels. the nvidia drivers wouldn't work with them without patches. your using a standard kernel.

on another note, the new portage nvidia drivers work perfectly on the latest mm-sources.

Edit: (well actually i'm using love-sources based on rc4-mm1 and it works)

----------

## Ijon Tichy

Just have to give a big "THANKS!" to everyone who added info to this thread (especially chickaroo  :Smile: ). I thought I was doomed to suffer my graphics card problems alone, but the information here fixed me right up. 

For the record, I've got an older Nvidia GeForce-based card (a GeForce2 Ti, I think) and the Nvidia kernel module/driver that worked for the 2.6.8 kernel failed when I updated to the 2.6.9-r1 kernel. The handy new ebuild given in this thread works like a charm, tho!

So, thanks folks. The Gentoo community continues to kick bootock!   :Very Happy: 

----------

## chickaroo

glad it helped  :Smile: 

nvidia-kernel in portage didn't work? i think it's in ~x86 but it works with the new 2.6.9-* kernels.

----------

## apc

do i do ACCEPT_KEYWORDS="~ARCH" in make.conf?

and yes, its not working right now with 2.6.9, with a vmalloc reserve error

edit: i tried anyways and it didnt work...also when it was dling it said it was dling 5336 nvidia drivers not 6111

----------

## chickaroo

well you can put ACCEPT_KEYWORDS="~ARCH" in make.conf but then your entire system will be converted to testing/unstable packages. 

BTW: ARCH = your architecture, if you didn't know. so in most cases it'll be x86 which would be ~x86

you prolly only want the nvidia drivers in ~x86 so you should do this

```
nano -w /etc/portage/package.keywords
```

and put the following line in it

```
media-video/nvidia-kernel ~x86
```

(if the directory and file doesn't exist, then make it)

alternatively you could do

```
ACCEPT_KEYWORDS="~x86" emerge nvidia-kernel
```

however this is the wrong way to emerge ~ARCH packages/

another note: i see people downloading my script for the older mm kernels, this will NOT work on the new mm kernels, and 2.6.9-gentoo-r1 if you did appy this script, i suggest you get a new kernel source, as this will mess up your kernel

----------

## apc

thanks, this solved my problem and i dled the 6111 drivers fine.  now though, i was going to emerge nvidia-glx but it wants to dl the old 5336 kernel drivers, but i did the same ~x86 thing for the nvidia-glx and it says i need x11-base/opengl-update-1.8.1 or -r1 which are masked.  what should i do?

edit: also, i don't know if this is because i don't have glx yet or because i have another problem, but i tried changing nv to nvidia in xorg.conf (i didnt uncomment glx yet) and when i startx it says no screens found.  will this be solved with glx or do i have another problem?

----------

