LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 05-18-2005, 06:32 PM   #1
Jack0ne
LQ Newbie
 
Registered: Feb 2005
Posts: 6

Rep: Reputation: 0
Kernel Headers


Hi guys.

I was trying to compile some sources, and they just could'nt find some headers. So I googled a lot and found some kernel headers packages, but no one seems to be the "official".

So my questions are:

- what the hell are these headers for? Could'nt compilers just use the (.h) files at the kernel source path?
- where can I find the headers for a specific kernel?
- why are some files missing, such as version.h and autoconf.h? where can I find them?

Well, I'm very confused.
Please, clarify me.

[]'s

Last edited by Jack0ne; 05-18-2005 at 06:38 PM.
 
Old 05-18-2005, 06:50 PM   #2
reddazz
LQ Guru
 
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298

Rep: Reputation: 75
You need to install the source package of whatever kernel you are running. It helps if you mention what linux distribution and version you are using so that you can get accurate answers.
 
Old 05-18-2005, 08:20 PM   #3
Jack0ne
LQ Newbie
 
Registered: Feb 2005
Posts: 6

Original Poster
Rep: Reputation: 0
I'm tweaking Slackware. Now it's running with Kernel 2.6.11...
Actually I don't want to "make it work". I just want to undestand a bit more about the headers.

BTW, what "source package"?
I downloaded the tar.bz2 from kernel.org.

[]'s

Last edited by Jack0ne; 05-18-2005 at 08:21 PM.
 
Old 05-19-2005, 12:25 AM   #4
foo_bar_foo
Senior Member
 
Registered: Jun 2004
Posts: 2,553

Rep: Reputation: 53
ok this is kind of complicated but i will try to explain
first anything in kernel space like a module or something has to have access to current running kernel build directory to compile as kernel space modules like device drivers or whatever need to have access to all current running kernel internals.
this is accomplished by the build link that gets made when you do make modules_install on the kernel so leave that kernel build directory where it is and don't move or delete it.

uerspace programs are a different story

when your glibc was build it was originally built against the actual raw headers from the kernel you started with

so those headers give userspace access to glibc kernel functions not actual access to the kernel itself
but rather the kernel functions are exposed in glibc to userspace.
therefore they become the headers in /usr/include and should be used by userspace programs linked to glibc. these headers should not be changed as you change kernels.

that way you can run a newer version of the kernel but the glibc interface stays constant and stable -- that is the headers match what is actually compiled into glibc -- instead of what would be in glibc if it had been compiled against the headers in your new kernel. otherwise performance and stability would degrade as programs try to access stuff that isn't there or has changed slightly.

now to add to this, kernel developers have explained to us that internall kernel functions should not be exposed at all to userspace programs but should rather be kept hidden and even though they have been compiled into glibc the user space kernel headers in /usr/include should be "sanitized" and contain only the kernel ABI. so we have the linux-libc-headers project trying to make sense of that idea and trying to clean up the headers to expose the proper interface to userspace and they are doing a good job at that.

we believe that by kernel 2.8 or so the kernel wil come with it's own set of clean abi headers but untill then use linux-libc-headers for userspace headers

now all of this can lead to the notion that Linux users are wrongfully under the impression they can change kernels at will and this is where i come down on all of this personally. But with a stable kernel userspace abi i guess it's ok to change the kernel.

Last edited by foo_bar_foo; 05-19-2005 at 12:30 AM.
 
Old 05-19-2005, 06:11 AM   #5
reddazz
LQ Guru
 
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298

Rep: Reputation: 75
The best thing to do is install the headers for the 2.4 default kernel. Even though I don't use the 2.4 kernel, the headers are essential for compiling stuff. Some Slackware sites offer headers for the 2.6.x kernel, so you may want to look into those as well.
 
Old 05-19-2005, 11:45 PM   #6
foo_bar_foo
Senior Member
 
Registered: Jun 2004
Posts: 2,553

Rep: Reputation: 53
Quote:
Originally posted by reddazz
The best thing to do is install the headers for the 2.4 default kernel. Even though I don't use the 2.4 kernel, the headers are essential for compiling stuff. Some Slackware sites offer headers for the 2.6.x kernel, so you may want to look into those as well.
No absolutely NOT
you HAVE to use the userspace headers your glibc was compiled against as i said earlier or your system will go downhill fast
 
  


Reply


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 On
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
where can I get kernel-headers for 2.6.7? darkleaf Linux - Software 2 06-30-2004 04:13 PM
kernel-headers linuxham Linux - Software 4 11-24-2003 03:18 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 04:55 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration