Installing Linux-2.4.19

Estimated build time:           0.02
Estimated required disk space:  142 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 as some packages need the kernel header files, we're going to unpack the kernel archive now, set it up, and copy the header files to where they will be found by these packages.

The kernel headers are copied by running the following commands:

ln -s /static/bin/pwd /bin/pwd &&
make mrproper &&
make include/linux/version.h &&
make symlinks &&
mkdir /usr/include/asm &&
cp include/asm/* /usr/include/asm &&
cp -R include/asm-generic /usr/include &&
cp -R include/linux /usr/include &&
touch /usr/include/linux/autoconf.h &&
rm /bin/pwd

Command explanations

ln -s /static/bin/pwd /bin/pwd: In the kernel source, the path to the pwd program is hard-wired as /bin/pwd, so we create a temporary symlink to account for that. At the end we remove it again.

make mrproper: This ensures that the kernel tree is absolutely clean. The kernel team recommends that this command be issued prior to each kernel compilation and that you shouldn't rely on the source tree being clean after untarring.

make include/linux/version.h and make symlinks: This creates the include/linux/version.h file and the platform-specific include/asm symlink.

mkdir /usr/include/asm , cp include/asm/* /usr/include/asm and cp -R include/asm-generic /usr/include: These commands copy the platform-specific assembler kernel header files to /usr/include/asm and /usr/include/asm-generic.

cp -R include/linux /usr/include: This command copies the cross-platform kernel header files to /usr/include.

touch /usr/include/linux/autoconf.h: This creates an empty autoconf.h file. As we do not yet configure the kernel, we have to create this file ourselves for those few kernel header files that make use of it, to avoid compilation failures.

Why we copy the kernel headers and don't symlink them

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.

Contents of Linux

Last checked against version 2.4.18.

Support Files

The linux kernel and the linux kernel headers

Descriptions

linux kernel

The Linux kernel is at the core of every Linux system. It's what makes Linux tick. When a computer is turned on and boots a Linux system, the very first piece of Linux software that gets loaded is the kernel. The kernel initializes the system's hardware components: serial ports, parallel ports, sound cards, network cards, IDE controllers, SCSI controllers and a lot more. In a nutshell the kernel makes the hardware available so that the software can run.

linux kernel headers

These are the files we copy to /usr/include/{linux,asm} in Chapter 5. They should match those which glibc was compiled against and therefore should not be replaced when upgrading the kernel. They are essential for compiling many programs.

Linux Installation Dependencies

Last checked against version 2.4.17.

Bash: sh
Binutils: ar, as, ld, nm, objcopy
Fileutils: cp, ln, mkdir, mv, rm, touch
Findutils: find, xargs
Gcc: cc1, collect2, cpp0, gcc
Grep: grep
Gzip: gzip
Make: make
Gawk: awk
Modutils: depmod, genksyms
Net-tools: dnsdomainname, hostname
Sed: sed
Sh-utils: basename, date, expr, pwd, stty, uname, whoami, yes
Textutils: cat, md5sum, sort, tail