Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Linux - Kernel This forum is for all discussion relating to the Linux kernel.


  Search this Thread
Old 01-25-2010, 02:17 AM   #1
LQ Newbie
Registered: Jan 2010
Posts: 2

Rep: Reputation: 0
[SOLVED] nvidia kernel module with custom kernel


I use Debian Squeeze with a custom kernel but I have a problem when I want to build the Nvidia kernel module.

I extracted Debian's linux-source to my home directory where I compiled a custom kernel-image and kernel-headers.
I used this command:
MAKEFLAGS="CC=/usr/lib/ccache/gcc-4.3" make-kpkg --rootcmd fakeroot --initrd --append-to-version=-c0.6 --revision=2.6.32 kernel-image kernel-headers
After this finished I installed the image and headers and created the Nvidia kernel module. Everything worked fine.

However, if I remove the linux-source from my home directory then I can't build the kernel module:
ERROR: Unable to find the kernel source tree for the currently running kernel. 
       Please make sure you have installed the kernel source files for your
       kernel and that they are properly configured; on Red Hat Linux systems,
       for example, be sure you have the 'kernel-source' or 'kernel-devel' RPM
       installed.  If you know the correct kernel source files are installed,
       you may specify the kernel source path with the '--kernel-source-path'
       command line option.
So my question is why does this kernel module need the source I used to compile the kernel when I have the headers for that kernel installed?

Last edited by feech; 01-26-2010 at 01:26 PM.
Old 01-25-2010, 04:39 AM   #2
LQ Guru
Registered: Jan 2006
Location: Ireland
Distribution: Slackware & Android
Posts: 8,280

Rep: Reputation: 829Reputation: 829Reputation: 829Reputation: 829Reputation: 829Reputation: 829Reputation: 829
Never mind the error. It's a standard one. You need
1. To be running a kernel
2. To have that compiled kernel source somewhere. So when you build your kernel do not run 'make clean.' If you did, go back and run make again.
3. A symlink in /lib/modules/kernel-version/build pointing to your compiled kernel source

In the words of the fictional Capt.Luc Picquard "Make it so" and try again.
Old 01-26-2010, 01:25 PM   #3
LQ Newbie
Registered: Jan 2010
Posts: 2

Original Poster
Rep: Reputation: 0
Thanks business_kid, that comment helped.

So it turned out the symlink in /lib/modules/kernel-version/build was pointing to the compiled kernel source in my home directory instead of pointing to the kernel-headers in /usr/src/linux-headers-kernel-version. Creating the correct symlink solved my problem.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Nvidia Kernel Module & Kernel source KinnowGrower Linux - Desktop 2 09-29-2008 10:23 PM
Error compiling NVIDIA kernel module on kernel Slaco Linux - Hardware 6 10-31-2007 07:57 PM
Installing NVIDIA kernel module for newly installed kernel philippeP Linux - General 1 07-13-2006 05:50 AM
Unable to build NVIDIA kernel module / determin kernel version Night Ink Fedora 2 05-31-2004 04:54 PM
recompiled kernel and no vmlinuz.old or kernel module for Nvidia Bruce Hill Slackware 13 12-11-2003 01:36 AM > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 12:07 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration