# 2.6.6 (stable) and Nvidia - How to make it work?

## hardcampa

Let me start this thread =D

How do you make nvidias drivers work with kernel 2.6.6 that was released today (the final version not a rc).

If someone finds a patch or similar. Please post it.

 :Very Happy: 

Well that's it. I'm sure more people are waiting for this answer/solution.

----------

## wizard69

 *Quote:*   

> If you've emerged nvidia-kernel with a newer (>=2.6.5) kernel, this script should take care of it for you. 
> 
> There is also a patch available for this, but I've had problems patching some sources, and some people have had trouble applying the patch themselves. 
> 
> This script does NOT patch anything. It backs up the unpatched files, replaces them with the patched ones, then restores the backups again. It also emerges nvidia-kernel for you. It should leave no trace in the kernel source directory. 
> ...

  try this script

----------

## stahlsau

and i´m sure the answer is on this forum. Just try searchin  :Wink: 

But ok, this worked for me:

```
# Copyright 1999-2004 Gentoo Technologies, Inc.

# Distributed under the terms of the GNU General Public License v2

# $Header: /home/cvsroot/gentoo-x86/media-video/nvidia-kernel/nvidia-kernel-1.0.5336-r2.ebuild,v 1.2 2004/04/13 17:07:54 cyfred Exp $

inherit eutils rpm

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"

pkg_setup() {

   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

   check_version_h

}

check_version_h() {

   if [ ! -f "${ROOT}/usr/src/linux/include/linux/version.h" ]

   then

      eerror "Please verify that your /usr/src/linux symlink is pointing"

      eerror "to your current kernel sources, and that you did run:"

      eerror

      eerror "  # make dep"

      die "/usr/src/linux symlink not setup!"

   fi

}

get_KV_info() {

   check_version_h

   # Get the kernel version of sources in /usr/src/linux ...

   export KV_full="$(awk '/UTS_RELEASE/ { gsub("\"", "", $3); print $3 }' \

      "${ROOT}/usr/src/linux/include/linux/version.h")"

   export KV_major="$(echo "${KV_full}" | cut -d. -f1)"

   export KV_minor="$(echo "${KV_full}" | cut -d. -f2)"

   export KV_micro="$(echo "${KV_full}" | cut -d. -f3 | sed -e 's:[^0-9].*::')"

}

is_kernel() {

   [ -z "$1" -o -z "$2" ] && return 1

   get_KV_info

   if [ "${KV_major}" -eq "$1" -a "${KV_minor}" -eq "$2" ]

   then

      return 0

   else

      return 1

   fi

}

pkg_setup() {

   ewarn "This ebuild may require write access to the sources of your current kernel,"

   ewarn "so this directory will be omitted from the sandbox restrictions."

   einfo "This requirement will be overcome in future ebuilds."

}

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.

   get_KV_info

   cd ${S}

   einfo "Linux kernel ${KV_major}.${KV_minor}.${KV_micro}"

   if is_kernel 2 5 || is_kernel 2 6

   then

      EPATCH_SINGLE_MSG="Applying basic sysfs patch ..." \

      epatch ${FILESDIR}/${PV}/NVIDIA_kernel-${NV_V}-basic-sysfs-support.patch

      rm makefile

      ln -snf Makefile.kbuild Makefile

   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() {

   # Portage should determine the version of the kernel sources

   check_KV

   # 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

      addwrite "/usr/src/linux"

      env -u ARCH make IGNORE_CC_MISMATCH="yes" KERNDIR="/usr/src/linux" \

         SYSSRC="/usr/src/linux" clean module || die

   else

      env -u ARCH make IGNORE_CC_MISMATCH="yes" KERNDIR="/usr/src/linux" \

         clean module || die

   fi

}

src_install() {

   # The driver goes into the standard modules location

   insinto /lib/modules/${KV}/video

   if is_kernel 2 5 || is_kernel 2 6

   then

      doins nvidia.ko

   else

      doins nvidia.o

   fi

   # 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 are not using devfs, loading the module automatically at"

   einfo "boot up, you need to add \"nvidia\" to your /etc/modules.autoload."

   echo

   ewarn "Please note that the driver name changed from \"NVdriver\""

   ewarn "to \"nvidia.o\"."

   echo

}

```

----------

## charlieg

 *stahlsau wrote:*   

> But ok, this worked for me:

 

You should log that on bugzilla.

----------

## dsd

edit:removed misinformation as i misread the ebuild

see https://bugs.gentoo.org/show_bug.cgi?id=48030 for more info on the nvidia vs 2.6.6 problem

also, dont compile the kernel with 4k-stacks enabled, else you'll get lockups when going into X.

----------

## stahlsau

 *Quote:*   

> You should log that on bugzilla.

 

well, i found that ebuild in the forum, so i thought most people would know about this. Also, i have no idea ´bout logging s/t at bugzilla or so, i only know the search-function (and maybe google  :Wink: )

I´m no geek, so when i find a problem with my computer, most of all it will be my fault; and i can´t report all my faults to bugzilla   :Embarassed: 

----------

## Gentree

 *stahlsau wrote:*   

> and i´m sure the answer is on this forum. Just try searchin 
> 
> 

 

I was sure as well, about a week ago. I searched ....and searched , tried lots of suggested "fixes" but sadly still do not have a working GeForce4

The reverse patch suggested above does not help for 2.6.6-rc3-love4.It appears that the patch set already takes care of that and the unpatch fails both "hunks".

Also 4k stacks is off,

Can build and modprobe nvidia module but starting x always fails like this:

```

(II) Loading font FreeType

(II) LoadModule: "tdfx"

(II) Loading /usr/X11R6/lib/modules/drivers/tdfx_drv.o

(II) Module tdfx: vendor="X.Org Foundation"

        compiled for 6.7.0, module version = 1.0.0

        Module class: X.Org Video Driver

        ABI class: X.Org Video Driver, version 0.7

(II) LoadModule: "nvidia"

(II) Loading /usr/X11R6/lib/modules/drivers/nvidia_drv.o

(II) Module nvidia: vendor="NVIDIA Corporation"

        compiled for 4.0.2, module version = 1.0.5336

        Module class: XFree86 Video Driver

.................

(II) Reloading /usr/X11R6/lib/modules/libvgahw.a

(**) NVIDIA(1): Depth 24, (--) framebuffer bpp 32

(==) NVIDIA(1): RGB weight 888

(==) NVIDIA(1): Default visual is TrueColor

(==) NVIDIA(1): Using gamma correction (1.0, 1.0, 1.0)

(--) NVIDIA(1): Linear framebuffer at 0xE4000000

(--) NVIDIA(1): MMIO registers at 0xEC000000

(EE) NVIDIA(1): Failed to initialize the NVIDIA kernel module!

(EE) NVIDIA(1):  *** Aborting ***

(II) UnloadModule: "nvidia"

(II) UnloadModule: "vgahw"

(--) Depth 24 pixmap format is 32 bpp

```

any ideas?

----------

## younker

I have the same problem with kernel 2.6.5 and gcc 3.4

I can only build the nvidia kernel module through the ebuild, if I use the nv installer, it fails to build the module, use the ebuild can build the module but can't use, every time use modprobe to load the module it will show some error messages.

 *Gentree wrote:*   

>  *stahlsau wrote:*   and i´m sure the answer is on this forum. Just try searchin 
> 
>  
> 
> I was sure as well, about a week ago. I searched ....and searched , tried lots of suggested "fixes" but sadly still do not have a working GeForce4
> ...

 

----------

## trumee

 *Gentree wrote:*   

>  *stahlsau wrote:*   and i´m sure the answer is on this forum. Just try searchin 
> 
>  
> 
> I was sure as well, about a week ago. I searched ....and searched , tried lots of suggested "fixes" but sadly still do not have a working GeForce4
> ...

 

same error here too  :Sad: 

using 2.6.6-mm1 and bugzilla ebuild'sLast edited by trumee on Tue May 11, 2004 7:48 am; edited 1 time in total

----------

## kruthles

the ebuild on the bugzilla worked here with 2.6.6 and a gf3   :Cool: 

----------

## Gil-galad55

Btw, the ebuilds don't work with -mm patchset, and you can't turn 4k stacks off in any case that I can tell in -mm, at least not easily.  But, working fine with vanilla 2.6.6 here.

----------

## dob

I made a 5341 version of the M="${S}" ebuild (since I had 'badness in 

pci.c' crashes with version 5336, and I don't get those anymore with 5341).

It seems to work fine so far with vanilla 2.6.6

Dowload here.

----------

## Gentree

 *Gil-galad55 wrote:*   

> Btw, the ebuilds don't work with -mm patchset, and you can't turn 4k stacks off in any case that I can tell in -mm, at least not easily.  But, working fine with vanilla 2.6.6 here.

 

This is taken care of in love-sources , which is a patch of mm. No more $k issue with love. But I cant say I've sussed my Geforce yet, although I'm prette sure its not related to love.

 :Cool: 

----------

## guilc

I confirm : this ebuild (5336 or 5341) doesn't work with 2.6.6-mm2, because we cannot disable anymore 4K stack (it will be the same thing in near 2.6.* vanilla release, as said on the lkml)...

I have read on the nvidia forum that nvidia consider 4K stack as a very experimental feature, whereas developpers in the lkml says that its quite stable and very near to be hard integrated to the vanilla sources as it provides some avantages... So we will probably have a long time to wait before new drivers with 4K stack support will be released.

So I think nvidia makes fun of 2.6.x users... I'm really thinking that my new video card will be an ati...

----------

## HydroSan

 *Quote:*   

> So I think nvidia makes fun of 2.6.x users... I'm really thinking that my new video card will be an ati...

 

Oh come now. It takes a while to implement new features. And nVidia just recently released a new card with ATI breathing down their necks - give them a little slack. nVidia has done wonders with their drivers and yet ATI barely supports XFree nevermind XOrg with shitty .rpm based drivers which apparently only work on RedHat and of course Gentoo.

Give nVidia some more time. They'll eventually implement it when they are convinced that it is stable enough - they want to keep releasing quality drivers that wont die on anyone.

----------

## Gentree

 *Quote:*   

> I confirm : this ebuild (5336 or 5341) doesn't work with 2.6.6-mm2, because we cannot disable anymore 4K stack

 

so move to love sources which allow 4k or 8k. I can confirm that this works , I'm running 2.6.6-r1-love1 as I write this.

You're welcome to spend your pocket-money on ATI next time , then dont forget to come back and tell us if you think they are laughing Linux users as well.

----------

## Gentii

 *Gentree wrote:*   

>  *Quote:*   I confirm : this ebuild (5336 or 5341) doesn't work with 2.6.6-mm2, because we cannot disable anymore 4K stack 
> 
> so move to love sources which allow 4k or 8k. I can confirm that this works , I'm running 2.6.6-r1-love1 as I write this.
> 
> You're welcome to spend your pocket-money on ATI next time , then dont forget to come back and tell us if you think they are laughing Linux users as well.

 

You mean more?

----------

