Compiling Kernel   «Prev  Next»

Lesson 10 Compiling the kernel:
ObjectiveDescribe common post-installation procedures

Post Installation Kernel Compiling

With both the kernel and modules built and installed, you are ready to let the system use the new kernel.
However, until you reboot you are still using the old kernel, so now is the time to make sure you have done everything correctly.
If you implemented certain kernel components as modules, specifically those required at boot time, you will need to provide access to them through a ramdisk. [1] The ramdisk holds an image of the modules, and the kernel loads that image into memory before any other components.
However, ramdisks store their data in random access memory, as opposed to on disk. This is useful during installation.

Creating a ramdisk

The mkinitrd command will examine a given kernel's module library, intelligently select any modules that might be needed at boot time (usually SCSI drivers or software RAID modules), create a ramdisk image, and pack the modules into the ramdisk.
The mkinitrd command takes two arguments: the first is the ramdisk filename to manufacture and the second is the kernel version for which the ramdisk is relevant. The ramdisk should be stored in a location accessible at boot, namely the /boot directory.
To create a ramdisk, named initrd-2.2.14.img and stored in /boot, use:

mkinitrd /boot/initrd-2.2.14.img 2.2.14
When the system reboots, the kernel notices you have a ramdisk for the new kernels version.
It then loads the images in that file and continues to boot.
There are no restrictions on what to name the initial ramdisk image, but meticulous naming helps in the long run.

Saving your kernel configuration

As a precaution, you might want to move your kernel configuration to the /boot partition.
Though this is not required, moving your configuration could save you from future configuration problems.
Essentially, you put the kernel configuration in the same location as the kernel, so you can always recreate that kernel from the configuration file.
Simply copy your Linux kernel configuration file into the /boot directory and name it appropriately:
The next lesson describes the LILO map installer.

cp /usr/src/linux/.config /boot/config-2.2.14

[1]Ramdisk: Ramdisks are block devices like hard disks and CD-ROM drives.