[1987d72] | 1 | <sect2>
|
---|
| 2 | <title>Why we copy the kernel headers and don't symlink them</title>
|
---|
| 3 |
|
---|
[bed61bb] | 4 | <para>In the past it was common practice to symlink the
|
---|
| 5 | <filename class="directory">/usr/include/{linux,asm}</filename> directories
|
---|
| 6 | to <filename class="directory">/usr/src/linux/include/{linux,asm}</filename>.
|
---|
| 7 | This was a <emphasis>bad</emphasis> practice, as the following extract from a
|
---|
| 8 | post by Linus Torvalds to the Linux Kernel Mailing List points out:</para>
|
---|
[1987d72] | 9 |
|
---|
| 10 | <screen>I would suggest that people who compile new kernels should:
|
---|
| 11 |
|
---|
| 12 | - not have a single symbolic link in sight (except the one that the
|
---|
| 13 | kernel build itself sets up, namely the "linux/include/asm" symlink
|
---|
| 14 | that is only used for the internal kernel compile itself)
|
---|
| 15 |
|
---|
| 16 | And yes, this is what I do. My /usr/src/linux still has the old 2.2.13
|
---|
| 17 | header files, even though I haven't run a 2.2.13 kernel in a _loong_
|
---|
| 18 | time. But those headers were what glibc was compiled against, so those
|
---|
| 19 | headers are what matches the library object files.
|
---|
| 20 |
|
---|
| 21 | And this is actually what has been the suggested environment for at
|
---|
| 22 | least the last five years. I don't know why the symlink business keeps
|
---|
| 23 | on living on, like a bad zombie. Pretty much every distribution still
|
---|
| 24 | has that broken symlink, and people still remember that the linux
|
---|
| 25 | sources should go into "/usr/src/linux" even though that hasn't been
|
---|
| 26 | true in a _loong_ time.</screen>
|
---|
| 27 |
|
---|
[bed61bb] | 28 | <para>The essential part is where Linus states that the header files should be
|
---|
[2c094d6] | 29 | <emphasis>the ones which glibc was compiled against</emphasis>. These are
|
---|
[bed61bb] | 30 | the headers that should be used when you later compile other packages, as they
|
---|
| 31 | are the ones that match the object-code library files. By copying the headers,
|
---|
| 32 | we ensure that they remain available if later you upgrade your kernel.</para>
|
---|
| 33 |
|
---|
| 34 | <para>Note, by the way, that it is perfectly all right to have the kernel sources
|
---|
| 35 | in <filename class="directory">/usr/src/linux</filename>, as long as you don't
|
---|
| 36 | have the <filename class="directory">/usr/include/{linux,asm}</filename>
|
---|
| 37 | symlinks.</para>
|
---|
[1987d72] | 38 |
|
---|
| 39 | </sect2>
|
---|
[bed61bb] | 40 |
|
---|