LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 05-25-2006, 07:40 AM   #1
knuhe
LQ Newbie
 
Registered: May 2006
Posts: 7

Rep: Reputation: 0
Cannot find kernel source directory in Sarge


I'm about to install some drivers for my WiFi-card, and to do this I need to locate
the kernel source directory. When I did the 'make config' I'm asked to correct the default directory if it doesn't apply.

It's set to /usr/src/linux by default. This is not right.

Can anyone help?
 
Old 05-25-2006, 08:03 AM   #2
Okie
Senior Member
 
Registered: Mar 2002
Location: Oklahoma
Posts: 1,154

Rep: Reputation: 187Reputation: 187
usually /usr/src/linux is a symlnk to /usr/src/linux-2.6.16.xx or similar
 
Old 05-25-2006, 08:09 AM   #3
knuhe
LQ Newbie
 
Registered: May 2006
Posts: 7

Original Poster
Rep: Reputation: 0
The /usr/src/ directory is completely empty in my system. Should I have a directory
or something in this dir?

Cheers
 
Old 05-25-2006, 08:13 AM   #4
Dutch Master
Senior Member
 
Registered: Dec 2005
Posts: 1,686

Rep: Reputation: 124Reputation: 124
Did you install the kernel-sources for your kernel? Do so with apt-get or Synaptic. Open a rootconsole, cd to /usr/src/ and then untar the sources (tar -xjf <packagename>) That gives you a new directory 'kernel-source-<version>' Go in there, do the obligatory 'make menuconfig && make && make modules_install && make install' to get the sources in place. You now kan adjust the path to /usr/src/kernel-cource-<version> or make a symlink from /usr/src/linux to /usr/src/kernel-source-<version> with
Code:
ln -s /usr/src/linux /usr/src/kernel-source-<version>
 
Old 05-25-2006, 08:22 AM   #5
knuhe
LQ Newbie
 
Registered: May 2006
Posts: 7

Original Poster
Rep: Reputation: 0
I see...

Do I have to install kernel-sources to install drivers for my wireless-card?

Here's the link to what I'm trying to get done:
ftp://ftp.linux-wlan.org/pub/linux-wlan-ng/README
My 'problem' can be found about halfway down in section 3, under the point saying:
Linux Source Directory.
 
Old 05-25-2006, 09:32 AM   #6
Okie
Senior Member
 
Registered: Mar 2002
Location: Oklahoma
Posts: 1,154

Rep: Reputation: 187Reputation: 187
yes, whenever you compile drivers or modules you need the kernel source for the exact kernel you are using for the driver or module source to be compiled against
 
Old 05-25-2006, 09:59 AM   #7
farslayer
LQ Guru
 
Registered: Oct 2005
Location: Northeast Ohio
Distribution: linuxdebian
Posts: 7,249
Blog Entries: 5

Rep: Reputation: 191Reputation: 191
This is how I typically setup kernel source in Debian.. just installing the package only downloads the compressed source, you still need to unpack it and create your symlink..

Quote:
itg-debian:/# uname -a
Linux itg-debian 2.6.8-3-686 #1 Thu Feb 9 07:39:48 UTC 2006 i686 GNU/Linux
itg-debian:/# apt-get install kernel-source-2.6.8
Reading Package Lists... Done
Building Dependency Tree... Done
The following NEW packages will be installed:
kernel-source-2.6.8
Setting up kernel-source-2.6.8 (2.6.8-16sarge2) ...
itg-debian:/# cd /usr/src
itg-debian:/usr/src# ls
kernel-source-2.6.8.tar.bz2
itg-debian:/usr/src# tar -xjvf kernel-source-2.6.8.tar.bz2
itg-debian:/usr/src# ln -s /usr/src/kernel-source-2.6.8 linux
Code:
itg-debian:/usr/src# ls -al
total 34112
drwxrwsr-x   3 root src      4096 May 25 10:46 .
drwxr-xr-x  14 root root     4096 Sep 27  2005 ..
drwxr-xr-x  18 root root     4096 Mar 22 12:00 kernel-source-2.6.8
-rw-r--r--   1 root root 34875250 Mar 22 12:02 kernel-source-2.6.8.tar.bz2
lrwxrwxrwx   1 root src        28 May 25 10:46 linux -> /usr/src/kernel-source-2.6.8

Last edited by farslayer; 05-25-2006 at 10:06 AM.
 
Old 05-25-2006, 11:15 AM   #8
knuhe
LQ Newbie
 
Registered: May 2006
Posts: 7

Original Poster
Rep: Reputation: 0
I tried what you are saying, and got my kernel sources.
Once again I tried to make my wireless-driver set up.
When I was asked to confirm this directory I get an error message:

Code:
Linux source tree /usr/src/linux is incomplete og missing!
    The kernel header files are present, but not the full source code.

Configuration failed

make: *** [config] Error 1
Thats everything that appears in the error message.

What am I doing wrong?
 
Old 05-25-2006, 12:38 PM   #9
Dutch Master
Senior Member
 
Registered: Dec 2005
Posts: 1,686

Rep: Reputation: 124Reputation: 124
Who's directions did you follow, from farslayer or mine? Shouldn't make a difference, basically we're saying the same thing.

What you have are the kernel-headers. Useful on your system, but you really need the full sources. Let's help you step by step.

First, open a commandprompt, become root with the su command and type
Code:
uname -r
This gives you the versionnumber of the running kernel. Still on the commandline, continue with
Code:
apt-get update && apt-get install kernel-source-<version>
Substitute <version> with the exact number you got from the uname command. Apt may come up with dependencies, answer affirmative. Let it 'do it's thing'.

Next, cd to the /usr/src directory. If all went well, an ls command should show you the source package. Now, untar the package with
Code:
tar -xjf kernel-source-<version>
That unpacks the sources in a new directory. Enter that directory with cd (use tab-completion: cd li<tab> will most likely do)

Now is a good time to figure out all you can from your hardware, 'cause you have to configure the kernel. Choose either make menuconfig (requires the ncurses dev packages) or make xconfig (requires Qt, in general already available on your system) If you don't know what to do next, save the default configuration and exit the program. You're still on the commandline, do
Code:
make && make modules && make modules_install && make install
This will take the better part of a few hours (depending on your hardware)

Don't dispair, we're nearly done! After the previous command finishes you'll have to make a symbolic link from where the sources are installed to the /usr/src/linux directory. You do that with
Code:
ln -s /usr/src/linux /usr/src/kernel-source-<version>
Done!

Good luck!

Regards, Dutch Master
 
Old 05-25-2006, 03:26 PM   #10
knuhe
LQ Newbie
 
Registered: May 2006
Posts: 7

Original Poster
Rep: Reputation: 0
Wow, that was a timeconsuming process

Done it all, but it still won't work. Before I started this rather long, but perfectly described tutorial, I was able to see my wireless-card when i did the [ifconfig]. When I tried that pre-wireless era I could in fact see it recognized as 'eth0', but now I can't see a darn thing.
Except from 'eth1', my "hard-wire" card.

Whats happend?
 
Old 05-25-2006, 03:57 PM   #11
Dutch Master
Senior Member
 
Registered: Dec 2005
Posts: 1,686

Rep: Reputation: 124Reputation: 124
Install the wireless-tools package, it has the iwconfig tool for configuring WLAN interfaces. By default many WLAN drivers register their device as wlan0 (that's a zero, not a letter)
 
Old 05-25-2006, 05:22 PM   #12
knuhe
LQ Newbie
 
Registered: May 2006
Posts: 7

Original Poster
Rep: Reputation: 0
You're a genius!

It worked without a flaw. Thank you very much! It'll make my
life pretty much easier without all the cabling
 
Old 05-25-2006, 05:41 PM   #13
Dutch Master
Senior Member
 
Registered: Dec 2005
Posts: 1,686

Rep: Reputation: 124Reputation: 124
Quote:
Originally Posted by knuhe
You're a genius!
Errr... I'm not so sure about that
 
  


Reply



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
compiling sid kernel source 2.6.15 in sarge lvgandhi Debian 3 03-01-2006 02:50 PM
Installing sarge kernel source linuxmandrake Debian 1 09-20-2005 05:20 PM
How to find Linux source directory? adelaideyip Linux - Newbie 7 08-20-2004 04:58 PM
Installing kernel source with sarge unstable technochef Debian 2 08-10-2004 04:49 PM
where is linux source build directory/kernel source tree? webazoid Linux - Software 2 07-01-2004 08:37 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 01:32 AM.

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