5.9. Installing Linux Kernel

5.9.1. Installation of 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 need the kernel header files, we're going to unpack the kernel archive now and set it up so that we can compile package that need the kernel.

Create the kernel configuration file by running the following command:


yes "" | make config

Ignore the warning Broken pipe you might see at the end. Now run the following commands to set up all the dependencies correctly:


make dep

Now that that's done, we need to create the $LFS/usr/include/linux and the $LFS/usr/include/asm symlinks. Create them by running the following commands:


cd $LFS/usr/include &&
ln -s ../src/linux/include/linux linux &&
ln -s ../src/linux/include/asm asm

5.9.2. Command explanations

yes "" | make config: This runs make config and answers "Y" to every question the config script asks the user. 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 compilg 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.

ln -s ../src/linux/include/linux linux and ln -s ../src/linux/include/asm asm: These commands create the linux and asm symlinks in the $LFS/usr/include directory that point to the proper directories in the Linux source tree. Packages that need kernel headers include them with lines like #include <linux/errno.h>. These paths are relative to the /usr/include directory so the /usr/include/linux link points to the directory containing the Linux kernel header files. The same goes for the asm symlink.

5.9.3. Contents

The Linux kernel package contains the Linux kernel.

5.9.4. Description

The Linux kernel is at the core of every Linux system. It's what makes Linux tick. When you turn on your computer and boot 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.