Linux-2.4.26 headers
Prev | Chapter 6. Installing basic system software | Next

## Linux-2.4.26 headers

    Approximate build time:  0.1 SBU
    Required disk space:     186 MB

### Installation of the kernel headers

We won't be compiling a new kernel yet -- we'll do that when we have finished the installation of all the packages. But the libraries installed in the next section need to refer to the kernel header files in order to know how to interface with the kernel. Instead of unpacking the kernel sources again, making the version file and the symlinks and so on, we will simply copy the headers from the temporary tools directory in one swoop:

    cp -a /tools/include/{asm,asm-generic,linux} /usr/include

A few kernel header files refer to the `autoconf.h` header file. Since we have not yet configured the kernel, we need to create this file ourselves in order to avoid a compilation failure of Sysklogd. Create an empty `autoconf.h` file with:

    touch /usr/include/linux/autoconf.h

### Why we copy the kernel headers

In the past it was common practice to symlink the `/usr/include/{linux,asm}` directories to `/usr/src/linux/include/{linux,asm}`. This was a bad practice, as the following extract from a post by Linus Torvalds to the Linux Kernel Mailing List points out:

    I would suggest that people who compile new kernels should:

     - not have a single symbolic link in sight (except the one that the
       kernel build itself sets up, namely the “linux/include/asm”
       symlink that is only used for the internal kernel compile itself)

    And yes, this is what I do. My /usr/src/linux still has the old 2.2.13
    header files, even though I haven't run a 2.2.13 kernel in a _loong_
    time. But those headers were what Glibc was compiled against, so those
    headers are what matches the library object files.

    And this is actually what has been the suggested environment for at
    least the last five years. I don't know why the symlink business keeps
    on living on, like a bad zombie. Pretty much every distribution still
    has that broken symlink, and people still remember that the linux
    sources should go into “/usr/src/linux” even though that hasn't
    been true in a _loong_ time.

The essential part is where Linus states that the header files should be the ones which Glibc was compiled against. These are the headers that should be used when you later compile other packages, as they are the ones that match the object-code library files. By copying the headers, we ensure that they remain available if later you upgrade your kernel.

Note, by the way, that it is perfectly all right to have the kernel sources in `/usr/src/linux`, as long as you don't have the `/usr/include/{linux,asm}` symlinks.

Prev | Up | Next
Creating devices with Make_devices-1.2 | Home | Man-pages-1.66