Installing Linux Kernel

Installation of the Linux Kernel

We won't be compiling a new kernel image yet. We'll do that after we have finished the installation of the basic system software in this chapter. But because certain software needs the kernel header files, we're going to unpack the kernel archive now and set it up so that we can compile the packages that need the kernel.

The kernel configuration file is created by running the following command:

patch -Np1 -i ../linux-2.4.5.patch &&
make mrproper &&
yes "" | make config &&
make dep &&
cd $LFS/usr/include &&
cp -a ../src/linux/include/linux . &&
mkdir asm &&
cp -a ../src/linux/include/asm/* asm

Command explanations

make mrproper: This will ensure that the kernel tree is absolutely clean.

yes "" | make config: This runs make config and answers with the default answer to every question the config script asks the user (it does this by simply doing the equivalent of hitting the Enter key, thus accepting the default Y and N answers to the questions). We're not configuring the real kernel here, we just need to have some sort of configure file created so that we can run make dep next that will create a few files in $LFS/usr/src/linux/include/linux, like version.h, among others, that we will need to compile Glibc and other packages later in chroot.

make dep: make dep checks dependencies and sets up the dependencies file. We don't really care about the dependency checks, but what we do care about is that make dep creates those aforementioned files in $LFS/usr/src/linux/include/linux we will be needing later on.

cp -R ../src/linux/include/linux . and mkdir asm && cp -a ../src/linux/include/asm/* .: These commands copy the kernel headers in the $LFS/usr/include directory.


The Linux kernel package contains the 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 such as 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.