[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Kernel-sourcecode directory

On Mon, Mar 03, 2003 at 06:22:04PM +0100, Willem-Jan Meijer wrote:
> Hello for the 3rd time today,
> I've downloaded the nvidia-kernel-src and nvidia-glc-src and read the 
> documentation. You have to give a command wich gives this result:
> We do not seem to be in a top level linux kernel source directory
> tree. Since we are trying to make a kernel package, that does not make
> sense.  Please change directory to a top level linux kernel source
> directory, and try again. (If I am wrong, and this is indeed a top
> level linux kernel source directory, then I have gotten sadly out of
> date with current kernels, and you should upgrade kernel-package)
> So I downloaded the kernel-source-2.4.18 and installed that package. I 
> searched my computer but I can't find the correct directory. I still get this 
> message.
> Does someone know where to find this directory/how to install the nvidia 
> drivers?

This is a weird one.  I'm reading
/usr/share/doc/nvidia-kernel-src/README.Debian.gz right now, and it has
step-by-step instructions for how to do this, with explicit mentions of
how to do it with a precompiled kernel-image-bleh-bloh package.  I've
noticed people asking about it on #debian though, too, so perhaps the
documentation sucks in woody or sarge, even though it's dated August
last year...Either way, here it is...

Also, AFAICT, everyone else who replied has given you incorrect
information which won't work at all, since you won't have modversions.h
in a clean source tree.


nvidia-kernel-src for Debian


There are TWO ways to build the nvidia-kernel package. Which one depends on
your situation with your kernel.

 METHOD #1: You are running a Debian suppiled kernel or built a 
    kernel-headers package along with your own self-built kernel. 

 METHOD #2: You are running your own self-built kernel built from kernel

Which method you choose really depends on what kernel headers you wish to
use, those from a kernel-headers package or those from kernel
source (from which you built your own kernel). 


This is the important thing.  If you're using a pre-compiled Debian
kernel, you need to install kernel-headers-`uname r`.  Note the
bacticks, they're important.

If method #1 doesn't work, please file a bug against the package, since
it's, at the very least, a documentation bug.


As mentioned above, if you are running a Debian suppiled kernel you will
probably want to choose METHOD #1. If you compile your own kernels, METHOD #2.

- Decide where you want to build your module. By default it 
will build under /usr/src like other kernel modules but you may choose 
to build it under your home directory as some people prefer and writing to 
/usr violates the FHS. 

- During the building step the file NVIDIA_kernel-1.0-4191.tar.gz will be 
downloaded via wget from NVIDIA's website to
<YOUR BUILD LOCATION>/modules/nvidia-kernel-1.0.4191 if it isn't there
already. This file contains the actual driver files. 
If you don't have network access on the machine you are building on 
you need to download from 
and put the file in <YOUR BUILD LOCATION>/modules/nvidia-kernel-src-1.0.4191
before building.

- You may specify another location to place the downloaded file with 
the DOWNLOAD_DIR environment variable.

METHOD #1 Using a kernel-headers package

As root (or using fakeroot)
1. cd /usr/src 
   tar xzvf nvidia-kernel-src.tar.gz -C <YOUR BUILD LOCATION>         
   (It will install in <YOU BUILD LOCATION>/modules) 
   - or -
   tar xzvf nvidia-kernel-src.tar.gz  (if building in /usr/src) 
3. Find out your kernel version:
   uname -r   For example: 2.4.18-k7
4. Download and install package: kernel-headers-2.4.18-k7
   It will install in /usr/src/
5. Set some environment variables (if bash is your shell):
    export KSRC=/usr/src/kernel-headers-2.4.18-k7
    export KVERS=2.4.18-k7
6. Then build nvidia-kernel package:
   cd <YOUR BUILD LOCATION>/modules/nvidia-kernel-1.0.4191
   debian/rules binary_modules
7. Install the nvidia-kernel package:
   dpkg -i ../../nvidia-kernel-2.4.18-k7_1.0.4191-1+_.Custom_i386.deb
   ( or similar filename )

METHOD #2: Using your own kernel source headers

To build the nvidia-kernel deb you need to first make sure you have
kernel-package installed, then do the following:

As root
1. cd /usr/src
   tar xzvf nvidia-kernel-src.tar.gz -C <YOUR BUILD LOCATION>         
   (It will install in <YOU BUILD LOCATION>/modules) 
   - or -
   tar xzvf nvidia-kernel-src.tar.gz  (if building in /usr/src) 

2. If you are NOT using the default modules location /usr/src/modules
   then you must set an environment variable that points to your modules
     export MODULE_LOC=<YOUR BUILD LOCATION>/modules
   This is needed by make-kpkg which is used later. If 
   <YOUR BUILD LOCATION> is /usr/src there is no need to set this.
3. Build the modules under MODULE_LOC i.e. <YOU BUILD LOCATION>/modules 

     cd linux (or your kernel source directory)
     make-kpkg modules_image

4. Install the nvidia-kernel package:
     cd <YOUR BUILD LOCATION>    (e.g. /usr/src)
     dpkg -i nvidia-kernel-KVER*.deb

Notes for method #2: 
- If you are building a kernel and the nvidia module at the same time AND
are running a kernel built with a different version the NVIDIA kernel module
build will fail on a compiler check UNLESS the environment variable
IGNORE_CC_MISMATCH is set. The check is to prevent users from compiling the
module with a different compiler than that which compiled the kernel. But if
you are building a kernel you plan on running set the variable.

- It is advised not to clean the kernel source tree between 
"make-kpkg kernel_image" and "make-kpkg modules_image". 

- The Riva framebuffer is known to conflict with the nvidia X driver. If you
are using X it would be wise not to compile it in. The vesa framebuffer is
known to work slow but fine.


Also you must add any users who wish to use OpenGL applications to the group
video. You can do this with:

	adduser username video

Also note for AGP issues and further information please see the NVIDIA
README file (README.gz) in the nvidia-glx package that is built from

An old nvidia.o or NVdriver might be already loaded (run 'lsmod' to check) so 
do 'rmmod nvidia.o' or 'rmmod NVdriver' to remove the module from memory.

For any news on this package check http://people.debian.org/~rdonald and

 -- Randall Donald <rdonald@debian.org>, Sat, 24 Aug 2002 23:20:00 -0700


Rob Weir <rweir@ertius.org>				http://ertius.org/

Attachment: pgprz42it2PJK.pgp
Description: PGP signature

Reply to: