Anyway, kernel headers. What are they? Google gave me this:
http://ubuntuforums.org/showthread.php?t=358080
Fair enough, So I get the idea, essentially a source/library file BUT
when was the kernel header invented? I'm coming back to linux having
previously used Slackware 8.0. I didn't learn too much about linux then
but I did compile a couple kernels and during all this time I never
encountered "kernel headers". Am I to assume that they are, relatively,
new?
Can I also assume that there is no such thing as kernel headers for the
vanilla kernel release and that headers exist as a means of preserving
the highly patched and tweaked configurations of the more 'user friendly'
distributions (so these settings are easily available to source which
requires them?)
Could someone please confirm or deny, and or add truths?
Thanks
No, they are as old as the kernel, in some distros they have been called
glibc-headers too, which was a bad name as it wasn't headers for glibc but
headers that was needed to build glibc.
> Can I also assume that there is no such thing as kernel headers for the
> vanilla kernel release and that headers exist as a means of preserving
> the highly patched and tweaked configurations of the more 'user friendly'
> distributions (so these settings are easily available to source which
> requires them?)
The headers has nothing to do with patches or configurations, those are
handled in the config file (/usr/src/linux/.config). Headers are used by
external applications and drivers that needs to be built against a kernel, for
example nvidia-drivers (this one uses directly the current used source and
it's configuration) and glibc.
The kernel headers don't differ in usage from any other headers, say headers
for qt, gtk2 and so on...
--
//Aho
> Anyway, kernel headers. What are they? Google gave me this:
The package of kernel headers includes a subset of kernel source.
It allows third party kernel modules to be compiled without
having to have the full kernel source installed.
With Mandriva linux, the name of the header package is the same as
the name of the kernel package, but with -devel added. So, for
the kernel package kernel-desktop-2.6.30-2mnb, the header package
is called kernel-desktop-devel-2.6.30-2mnb.
I'm not familiar with ubuntu's naming conventions for kernel packages
or kernel header packages.
Most of the traffic in the alt.os.linux hierarchy is in the distro
specific newsgroups.
Regards, Dave Hodgins
--
Change nomail.afraid.org to ody.ca to reply by email.
(nomail.afraid.org has been set up specifically for
use in usenet. Feel free to use it yourself.)
Kernel headers are the include files used to compile the kernel and
its modules. They're also used to build libc and some low-level system
programs. A buildable kernel source tree includes the kernel headers,
but you might have another set, perhaps in /usr/src/linux/ which were
used to build the libc on your system.
Jerry
Hi Aho, Thanks for your response.
> No, they are as old as the kernel, in some distros they have been called
> glibc-headers too, which was a bad name as it wasn't headers for glibc
> but headers that was needed to build glibc.
This glibc headers rings a bell now you mention it, I kinda recall seeing
these previously.
> The headers has nothing to do with patches or configurations, those are
> handled in the config file (/usr/src/linux/.config). Headers are used by
> external applications and drivers that needs to be built against a
> kernel, for example nvidia-drivers (this one uses directly the current
> used source and it's configuration) and glibc.
But kernel headers aren't required to compile a kernel? Is the header
code already in the kernel source and just duplicated by the headers for
use by other software?
> The kernel headers don't differ in usage from any other headers, say
> headers for qt, gtk2 and so on...
Ok, so i'm not 100% clear on how headers are used in general. They are
the cited in source code as includes? As librarys of pre-defined
functions yes??
On Mon, 13 Jul 2009 15:45:37 -0400, David W. Hodgins wrote:
Hi Dave, thanks for your reply,
> The package of kernel headers includes a subset of kernel source.
>
> It allows third party kernel modules to be compiled without having to
> have the full kernel source installed.
Ok, I see, I think. So the header code is duplicated from source code?
And if the full kernel source is available on the local drive the headers
need not be??
> With Mandriva linux, the name of the header package is the same as the
> name of the kernel package, but with -devel added. So, for the kernel
> package kernel-desktop-2.6.30-2mnb, the header package is called
> kernel-desktop-devel-2.6.30-2mnb.
>
> I'm not familiar with ubuntu's naming conventions for kernel packages or
> kernel header packages.
>
> Most of the traffic in the alt.os.linux hierarchy is in the distro
> specific newsgroups.
I see, glad it's still ticking over. Will possibly pop over to the slack
group.
> Regards, Dave Hodgins
Cheers
> Keiron <po...@nospamsheffield.ac.uk> wrote:
>> I'm surprised that my couple questions from a few weeks ago are
>> basically the last posted in this group: is the group slowly on its way
>> out???
>>
>> Anyway, kernel headers. What are they? Google gave me this:
>>
>> http://ubuntuforums.org/showthread.php?t=358080
>>
>> Fair enough, So I get the idea, essentially a source/library file BUT
>> when was the kernel header invented? I'm coming back to linux having
>> previously used Slackware 8.0. I didn't learn too much about linux then
>> but I did compile a couple kernels and during all this time I never
>> encountered "kernel headers". Am I to assume that they are, relatively,
>> new?
>>
>> Can I also assume that there is no such thing as kernel headers for the
>> vanilla kernel release and that headers exist as a means of preserving
>> the highly patched and tweaked configurations of the more 'user
>> friendly' distributions (so these settings are easily available to
>> source which requires them?)
>>
>> Could someone please confirm or deny, and or add truths?
>>
>> Thanks
Hi Jerry.
> Kernel headers are the include files used to compile the kernel and its
> modules. They're also used to build libc and some low-level system
> programs. A buildable kernel source tree includes the kernel headers,
Ah ok. So the kernel headers are always a distinct entity from the kernel
source (although packaged together) and not just various methods and
functions replicated from kernel source?
> but you might have another set, perhaps in /usr/src/linux/ which were
> used to build the libc on your system.
>
> Jerry
Thanks
> Anyway, kernel headers. What are they? Google gave me this:
>
> http://ubuntuforums.org/showthread.php?t=358080
Kernel headers are the collection of header files for the kernel.
Do you know what a header file is?
When programing, it is common to create prototypes for functions and data
structures. This way the compiler can check that calls to functions, and
access to data structures is consistent with the prototypes. When
writing program1 or library1, the writer will often put function
prototypes in a header file. Then include this header file in the c
source file. This makes things cleaner, as other c source files can
include the same header file. Later another person writes program2 that
will call a function from library1. In order for program2 to compile it
must have access to prototype for the function. This prototype will be
in the library1 header files. Often a filename ending with ".h" Often a
packaging system for a gnu/linux system will include the binaries for a
library in one package, and the headers in another package. If no
compiling is done on a system, then there is no need to include all of
the header files. If you are going to compile on the system, then you
need the header files for any library your compile may need. In this
case the headers for the kernel. Also known as "Kernel Headers".
When you compiled your kernel for slackware, if you had looked in the
kernel sources, you would have seen a directory "includes" that contained
the kernel header files. The distros often extract these headers and
include them in the package "linux-headers"
>> The headers has nothing to do with patches or configurations, those are
>> handled in the config file (/usr/src/linux/.config). Headers are used by
>> external applications and drivers that needs to be built against a
>> kernel, for example nvidia-drivers (this one uses directly the current
>> used source and it's configuration) and glibc.
>
> But kernel headers aren't required to compile a kernel? Is the header
> code already in the kernel source and just duplicated by the headers for
> use by other software?
Headers are always part of the source they belong to, kernel headers are part
of the kernel source, in the same way as lame headers are part of lame (those
are usually called something-devel).
Headers are needed by other applications that want to use features that the
"package" the headers belongs to supplies, like if you write a application
that plays mp3s, then you need lame headers to be able to use the features
that lame offers when it comes to handle mp3.
>> The kernel headers don't differ in usage from any other headers, say
>> headers for qt, gtk2 and so on...
>
> Ok, so i'm not 100% clear on how headers are used in general. They are
> the cited in source code as includes? As librarys of pre-defined
> functions yes??
yes, the files in the include directory are headers for different
libraries/applications, telling how to use the functions that are in the
libraries (function descriptions, the definition are in the c/c++/... files
and aren't part of the header, but the source code).
--
//Aho
> Ok, I see, I think. So the header code is duplicated from source code?
> And if the full kernel source is available on the local drive the headers
> need not be??
The kernel header is setup for the corresponding binary kernel.
With the full source installed, you could compile third party
modules, without installing the header package, but you'd have
to change things like .config, to match the running kernel. It's
easier to just install the header package.
The only reasons to install the full source, include compiling
your own kernel, and to viewing the source code.
>I'm surprised that my couple questions from a few weeks ago are
>basically the last posted in this group: is the group slowly on its
>way out???
[compton ~]$ grep -c linux .newsrc
1160
[compton ~]$ grep -c alt.linux .newsrc
11
[compton ~]$ grep -c alt.os.linux .newsrc
46
[compton ~]$ grep -c comp.os.linux .newsrc
117
[compton ~]$ grep linux big.8.list.06.15.09 | cut -f1 | column
comp.os.linux.advocacy comp.os.linux.misc
comp.os.linux.alpha comp.os.linux.networking
comp.os.linux.announce comp.os.linux.portable
comp.os.linux.answers comp.os.linux.powerpc
comp.os.linux.development.apps comp.os.linux.security
comp.os.linux.development.system comp.os.linux.setup
comp.os.linux.embedded comp.os.linux.x
comp.os.linux.hardware comp.os.linux.xbox
comp.os.linux.m68k
[compton ~]$
As with the O/S, there is a huge choice of Usenet newsgroups.
>Anyway, kernel headers. What are they?
>I'm coming back to linux having previously used Slackware 8.0. I
>didn't learn too much about linux then but I did compile a couple
>kernels and during all this time I never encountered "kernel
>headers".
PACKAGE NAME: kernel-headers-2.4.18-i386-3.tgz
PACKAGE LOCATION: ./slackware/d
PACKAGE SIZE (compressed): 1037 K
PACKAGE SIZE (uncompressed): 4170 K
PACKAGE DESCRIPTION:
kernel-headers: kernel-headers (Linux kernel include files)
kernel-headers:
kernel-headers: These are the include files from the 2.4.18 Linux
kernel. You'll
kernel-headers: need these to compile most system software for Linux.
kernel-headers:
That is from the Slackware 8.1 PACKAGES.TXT.gz file (I don't have the
8.0 file handy). In earlier versions of Slackware, they were in the
linuxinc.tgz package.
-rw-rw-r-- 1 admin admin 30108170 Feb 25 2002 linux-2.4.18.tar.gz
and 1037 k is a bit smaller than 30108 k.
>Am I to assume that they are, relatively, new?
1993? Lessee... here's some from a October 1996 listing of sunsite:
667116 May 23 19:27 kernel-headers-1.99.7-0.deb
671836 Jun 11 20:45 linuxinc.tgz
676792 Jun 16 12:55 kernel-headers-2.0.0-0.all.deb
680854 Jul 15 00:10 kernel-headers-2.0.6_2.0.6-0.deb
743581 Oct 4 22:33 kernel-headers-2.0.18-5.i386.rpm
Old guy
> I'm surprised that my couple questions from a few weeks ago are basically
> the last posted in this group: is the group slowly on its way out???
>
That's because it's a dead group. There are plenty of other linux
related newsgroups, including a cluster in the Big Eight hierarchy.
The problem with alt.* newsgroups is that it's really easy to create
them, so people do, leaving a lot of unused newsgroups floating around.
Silly people somehow find this newsgroup before others, and it's they
who create any traffic here. It would be far better if we ignored
any questions here, so the traffic would go where it belongs.
> Anyway, kernel headers. What are they? Google gave me this:
>
You're asking the wrong question. A source file is only text, and
there's no reason for it to be all in one large file. So one can
put in a line to include another file. Just like using subroutines
is a good practice to get into, one might as well keep source code
in small bits, so once one segment is figured out, it doesn't clutter
things up.
Headers were part of the C language from the beginning. It's just a
file for defining things, and since it's fixed, one can keep it in a
separate file. If the information is used over multiple files, it
makes sense to keep it separate, so you don't have to duplicate it
in all those files.
It's no different than if you are using CSS in
html, if you invoke the same CSS over multiple pages, it's far better
to put it in a separate file that's "called" from other webpages. That
way, if you want to change something, you just have to edit that
one css file, rather than go through all the html files to change
the css-related bits.
Kernel headers surely go back to when Unix was reimplemnted in C, sometime
in the early seventies.
You wouldn't be editing kernel headers unless you were doing something
seriously different with the kernel. As a user, you'd never edit them.
Hence they are invisible unless you look for them.
Michael
They're *part* of the kernel source, you can't build a kernel without
them.