Linux Kernel Installation

Home / Linux Kernel Installation

Linux Kernel Installation

December 9, 2015 | Article | No Comments

Installation of Linux Kernel image is divided into two step. First step deals with the installation of kernel modules and static vmlinuz (kernel image). The way to do it is copying the static vmlinuz and all loadable kernel modules to their appropriate locations. The second step deals with the modification of the boot loader configuration file (GRUB, LILO, etc).

Installing Image and Modules

The ‘make’ command builds all the loadable kernel modules in some temporary directory. All we need to do is copying all those modules to the correct location. The location would be same whether you are in 32-bit system or 64-bit system (at least for now). In our case, it would be /lib/modules/<kernel version>/.

However, one can ignore copying these manually and use a command to do it. The process can be automated by simply calling a command from make. Of course you need to do it in the end of compilation on certain kernel (on the root directory tree).

make modules_install

For installing the static kernel (i.e. vmlinuz), the image should be placed to a location where bootloader program can find and boot it. Usually it is /boot.

The process is also can be automated by giving command:

make install

The static image vmlinuz is copied from certain directory to /boot directory. To make it clear, compilation will compile kernel based on your processor architecture (or if you specify other processor) and store it on the corresponding root directory. For x86 and x86_64, the image will be created as $KERNELDIR/arch/i386/boot/vmlinuz.

Boot Loader Configuration

Remember the process of booting: BIOS -> Boot Loader -> Kernel -> Init.

Boot Loader is in the second step which will search the kernel images and boot it. Some boot loader will search for the kernel images in the /boot directory.

There are two popular bootloaders we use: GRUB (Grand Unified Bootloader) and LILO (Linux Loader).

Configuring Grub

The version we use is Grub2. To use grub2 to boot our new linux kernel, we need to edit grub configuration. However you are not necessary to edit the file manually. Just run the command to make grub update the list, with root privilege of course:


Configuring LILO

Linux Loader is considered old but still used on several distribution.

To add new kernel image to LILO entry, you can use following template and modify it to your need. You should append it to LILO configuration file, which is /etc/lilo.conf:

  append=" resume=/dev/sda2"

So here is the explanation:

The image is vmlinuz which located on /boot directory.

The entry would be labeled as “linux”. You should make this unique.

The root file system is /dev/hda3. Make sure you have a kernel which can read the file system. Especially if your root file system is not usual such as XFS, ZFS, ReiserFS, etc.

The initial ramdisk is initrd-2.4.2-2.img which is located on /boot. You can ignore this if your kernel doesn’t need initial ramdisk.

Append is used to add several argument to kernel. On that entry, we add capability to hibernate and sleep. For that capability kernel need a swap partition to read and write a temporary data. Therefore we specify /dev/sda2 which is a swap partition.

Practical Sample

  1. Install Kernel on Ubuntu
  2. Step by Step of Linux Kernel Compilation

About Author

about author


A man who is obsessed to low level technology.

Leave a Reply

Your email address will not be published. Required fields are marked *

Social Share Buttons and Icons powered by Ultimatelysocial