LinuxQuestions.org
Visit Jeremy's Blog.
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 04-24-2005, 09:50 PM   #1
Embiggens
LQ Newbie
 
Registered: Apr 2005
Location: Madison, WI
Distribution: Debian Etch
Posts: 7

Rep: Reputation: 0
kernel headers questions


OK, anyone/anything that can guide me out of this confused state would be greatly appreciated. Sorry this is so long...
I am a newb running deb sarge in the early stages of installing ndiswrapper for my wireless card (smc2802w (version 2, so no linux driver available)), and I'm seeing various things about kernel headers and symbolic links. I'm totally confused, partly b/c I don't understand the concept of kernel headers and I can't really find good info on them.

I'm looking at the debian-specific wiki for ndiswrapper and it says that to find out which kernel headers I need, I can type in

"COLUMNS=200 dpkg -l | grep kernel-headers-$(uname -r)"

and it will print out the header files package (b/c this is required to compile ndiswrapper). But when I do, I get nothing (and I've also manually read through the "COLUMNS=200 dpkg -l" output and seen that there's nothing in there about headers). So, from this, it appears that I don't have any kernel headers installed and/or my kernel knows nothing of kernel headers. So, umm, I don't know what this means. I'm running a 2.4.30 kernel that I compiled myself and I certainly didn't do anything involving kernel headers with that. The wiki then says to apt-get the corresponding kernel-header package. In searching around, the 'newest' 2.4 kernel headers seem to involve 2.4.27. In the above-mentioned wiki, it says that I must have headers at least matching the kernel i'm running. So do I need to go back to 2.4.27?

2nd part: Now, in looking at the Debian Reference manual (Aoki, Feb 05), it says

"most "normal" programs don't need kernel headers and in fact may break if you use them directly; instead they should be compiled against the headers with which glibc was built, which are the versions in /usr/include/linux and /usr/include/asm"

I have not installed glibc. Does this have anything to do with why my kernel doesn't 'know about' headers? Or are these different 'headers' being referred to?

Well, I hope this isn't too garbled- Anywhere anyone can help or link me to some general info would be great.
 
Old 04-25-2005, 02:38 AM   #2
TigerOC
Senior Member
 
Registered: Jan 2003
Location: Devon, UK
Distribution: Debian Etc/kernel 2.6.18-4K7
Posts: 2,380

Rep: Reputation: 49
If you compiled the kernel then you have the source file. Usually the make files for compiling programs from source can be edited to point to the kernel source. Check the readme. You can create the header files as well from the source - reference for this;

http://www.fifi.org/cgi-bin/man2html...make-kpkg.1.gz

Last edited by TigerOC; 04-25-2005 at 02:39 AM.
 
Old 04-25-2005, 01:11 PM   #3
Embiggens
LQ Newbie
 
Registered: Apr 2005
Location: Madison, WI
Distribution: Debian Etch
Posts: 7

Original Poster
Rep: Reputation: 0
thanks

I think you've got me headed in the right direction. I'm semi-confident that once I get the header files made correctly, I can figure out the rest.
Making the header files seems pretty straightforward- it seems this has nothing to do with the .config file, correct? Ie, header files come from source so they'll work with any kernel image from that source? Would I need to do a 'make clean' or anything prior to making the header files? (just wondering b/c everytime I see someone mention making header files it's part of the kernel compiling process)
 
Old 04-25-2005, 01:34 PM   #4
m_yates
Senior Member
 
Registered: Aug 2003
Location: Upstate
Distribution: Debian, Mint, Mythbuntu
Posts: 1,249

Rep: Reputation: 101Reputation: 101
The header files should be there already if you compiled your own kernel. What I did to install ndiswrapper was to first compile a kernel, install the compiled kernel, then boot into the new kernel. Next, download ndiswrapper-1.1.tar.gz, unpack it and install it with "make" and "make install". It shouldn't complain about kernel headers as long as you are running the kernel that you compiled yourself. I did not have to add any simlinks to kernel header files nor did I have to install kernel headers.

The ndiswrapper installation will complain about kernel header files if you try to do it using a precompiled kernel from debian.org. In that case, you will have to install kernel headers and link them, but it is easier to just recompile your kernel and boot into the new kernel like I said above. Hopefully that makes sense.
 
Old 04-25-2005, 01:56 PM   #5
Embiggens
LQ Newbie
 
Registered: Apr 2005
Location: Madison, WI
Distribution: Debian Etch
Posts: 7

Original Poster
Rep: Reputation: 0
OK, I'll give it a try, but I'm still a bit confused.
In my op, I mentioned that I can't find anything about header files on my computer, so I was under the impression that they're not present. When I compiled my kernel, I only did "make-kpkg kernel_image", so I don't think I made them that point. Is this what you did also? If so, I'll just give it a whirl.
Thanks so much for the quick reply- sorry if I'm not comprehending.
 
Old 04-25-2005, 02:15 PM   #6
TigerOC
Senior Member
 
Registered: Jan 2003
Location: Devon, UK
Distribution: Debian Etc/kernel 2.6.18-4K7
Posts: 2,380

Rep: Reputation: 49
Quote:
Originally posted by Embiggens
When I compiled my kernel, I only did "make-kpkg kernel_image", so I don't think I made them that point.
if you didn't expressly tell it to make the headers then it would not. As I said above you can usually edit the make-file to point it at the kernel source which works as well, but you need to look at the readme and also have a look at the make-file.
 
Old 04-25-2005, 03:13 PM   #7
m_yates
Senior Member
 
Registered: Aug 2003
Location: Upstate
Distribution: Debian, Mint, Mythbuntu
Posts: 1,249

Rep: Reputation: 101Reputation: 101
Here is what I did, starting with the 2.6.8 kernel installed by Sarge:
Code:
apt-get -t unstable install kernel-source-2.6.11
cd /usr/src
tar -jfx kernel-source-2.6.11.tar.bz2
ln -s kernel-source-2.6.11 linux
cd linux
cp /boot/config-2.6.8-2-386 .config
make menuconfig
Note, at this point you should select "Code Maturity Level Options --> Select Only Drivers Expected to compile cleanly" or else the compile will fail. I also selected my processor type and changed a few other minor things. Save your configuration, then compile:
Code:
make-kpkg --initrd --append-to-version=-debian kernel_image
I didn't say anything about kernel headers. After it finishes, install the kernel:
Code:
cd /usr/src
dpkg -i kernel-image-2.6.11-debian_10.00.Custom_i386.deb
The installer will create an entry for it in /boot/grub/menu.lst. Reboot into the new kernel.

I then installed ndiswrapper after booting into the new kernel:
Code:
tar zxvf ndiswrapper1.1.tar.gz
cd ndiswrapper1.1
make distclean
make
make install
Complete the installation following: http://ndiswrapper.sourceforge.net/p...p/Installation As I said above, the ndiswrapper installation didn't work until I had compiled my kernel. You can try to set up kernel headers with a pre-compiled kernel, but it is probably easier to just recompile your kernel. Hopefully there are no typos above, but you can get the point I guess. I have done the above more than once and I know it works.

Last edited by m_yates; 04-25-2005 at 03:15 PM.
 
Old 04-29-2005, 01:44 AM   #8
Embiggens
LQ Newbie
 
Registered: Apr 2005
Location: Madison, WI
Distribution: Debian Etch
Posts: 7

Original Poster
Rep: Reputation: 0
sweet

it's working! Thanks so much to both of you for your help. i basically just followed your steps, m_yates (did move to a 2.6 kernel first). I kind of feel like an idiot- there was nothing especially tricky here, I just got a bit scared by the headers talk. Anyway, I'm currently getting a vague idea of what headers files are, since I'm starting to toy with c. Thanks again.
 
  


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
trying to find/install kernel-source or kernel-headers timsch75 Slackware 3 10-22-2005 09:17 AM
Difference between kernel-headers kernel-source twinkers Debian 2 06-18-2005 11:20 AM
send packets with kernel routing and without kernel messing with headers bassdemon Programming 5 02-08-2005 06:29 PM
kernel-headers linuxham Linux - Software 4 11-24-2003 03:18 PM
Headers of the Kernel leonora Linux - Newbie 1 10-29-2003 10:13 AM

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

All times are GMT -5. The time now is 05:31 PM.

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