Open In App

How Linux Kernel Boots?

Many processes are running in the background when we press the system’s power button. It is very important to learn the booting process to understand the working of any operating system. Knowing how the kernel boots is a must to solve the booting error. It is a very interesting topic to learn, let us start with the basics. A simplified read of the boot method is given below:

Stages of Linux Boot Process:

  1. The machine’s BIOS (Basic Input/Output System) or boot microcode hundreds and runs a boot loader.
  2. Boot loader finds the kernel image on the disk and loads it into memory, to start the system.
  3. The kernel initializes the devices and their drivers.
  4. The kernel mounts the basis filesystem.
  5. The kernel starts a program referred to as init with a method ID zero
  6. init sets the remainder of the system processes in motion.
  7. For some purpose, init starts a method permitting you to log in, typically at the top or close to the top of the boot sequence.

Booting Process

Startup Message:

Traditional UNIX operating system manufactures several diagnostic messages upon boot that tell you regarding the boot method. The messages come back initially from the kernel and so from processes and low-level formatting procedures that init starts. However, these messages aren’t pretty or consistent, and in some cases, they aren’t even terribly informative. Additionally, hardware enhancements have caused the kernel to start a lot quicker than before the messages flash by therefore quickly, it may be tough to check what’s happening. As a result, most current Linux distributions do their best to cover boot medical specialty with splash screens and different varieties of filler to distract you whereas the system starts.

Kernel Initialization and Boot Options:

  1. CPU examination
  2. Memory examination
  3. Device bus discovery
  4. Device discovery
  5. Auxiliary kernel system setup
  6. Root filesystem mount
  7. User-space begin.

The first 2 steps aren’t too exceptional, however, once the kernel gets to devices, the question of dependencies arises. As an example, the disk device drivers might rely on bus support and SCSI system support. In general, you won’t need to worry regarding the dependencies, except that some necessary parts are also loadable kernel modules instead of a part of the most kernel.

Kernel Parameters:

When the Linux kernel starts, it receives a group of text-based kernel parameters containing some further system details. The parameters specify many alternative kinds of behavior, like the number of diagnostic outputs the kernel ought to manufacture and device driver–specific choices. The Ro parameter instructs the kernel to mount the basis filesystem in read-only mode upon user area begins. This normal read-only mode ensures that fsck can safely check the basis filesystem before attempting to do something serious. When the check, the bootup method remounts the basis filesystem in read-write mode.

Boot Loader Tasks:

Bootloaders have become significantly advanced since the origin of the Linux kernel, with options like command-line history and menu systems, however, a basic want has perpetually been flexibility in kernel image and parameter choice. One stunning development is that some wants to have really diminished. As an example, as a result of being able to perform associate emergency or recovery boot from a USB device, you seldom need to worry about manually getting into kernel parameters or going into single-user mode. Current bootloaders supply a lot of power than ever, which may be notably handy if you’re building custom kernels or simply wish to tweak parameters.

Boot Loader Overview:

Introduction and Work of Few Bootloaders mentioned above:

1) GRUB:   

GRUB stands for Grand Unified Boot Loader. One of GRUB’s most vital capabilities is filesystem navigation that enables straightforward kernel image and configuration choice.

2) LILO (LInux LOader):

It was the first bootloader developed for Linux, still some users use it today. If we compare it to the GRUB bootloader it is quite simple and primarily used with BIOS system. To install it on Linux system one can install it using package manager like apt or yum. After installation it can be easily configured by editing its configuration file located at `/etc/lolo.conf`.

3) SYSLINUX:

It is lightest among other bootloaders; it can perform booting from removable media such as CDs or USB drives. Its key feature is that it supports different filesystems, a command-line interface and the ability to boot from multiple devices.  For example, to install SYSLINUX on a USB drive we can configure SYSLINUX setting by editing its configuration file located in `/syslinux/syslinux.cfg`.

Conclusion: 

It is very important to know how Linux kernel boots and to know that one must know how to solve boot problems. The Linux boot process has several stages that include BIOS, boot loader, kernel initialization, device and driver initialization. While kernel is responsible for specifying various behaviors and device drivers-specific option whereas bootloader is responsible for providing flexible kernel image and parameter selection. We discussed the most common boot loader and overall, we can conclude that it is important for system administrators, developers and single users using Linux operating systems.

Article Tags :