Kernel booting process in linux

Linux Boot Process Explained Step by Step in Detail

In this article I will give you an step by step overview of Linux boot process with some flowchart diagrams which can help you understand better.

step by step linux boot process explained in detail

Stages of Linux Boot Process (flowchart)

Linux Boot Process Explained Step by Step in Detail

1. BIOS Stage

  • When the machine is powered on BIOS is the first one to be called to verify if the hardware is present in the machine and if it is functioning.
  • This is done by performing a Power On Self Test (POST)
  • After a successful test, BIOS checks the MBR (Master Boot Record) in the hard disk to check if it refers to the location of the boot loader.

Linux boot process explained in detail

2. Boot Loader Stage

The boot loader will be installed if an operating system is installed on the system.

Two of the most common boot loaders are

  • The boot loader will present the user with a list of menu entries, each of which corresponds to different operating system
  • The boot loader will then start to boot the operating system
  • When you select the the option to start Linux, it decompresses the Linux kernel in memory
  • After that Linux kernel (which you selected to boot from) loads initrd (Initial ramdisk)
  • The initrd is used by the Linux kernel as a temporary filesystem in the memory
  • It contains tools and kernel modules which will continue the boot process including mounting a virtual root file system temporarily.
  • Instead of using initrd, some Linux filesystem will also use initramfs.
  • It serves the same purpose of initrd, it is just that it is a successor of initrd
  • linuxrc is an executable file that is next spawn, it probes the mass storage hardware and finds a suitable kernel module to drive the mass storage hardware
  • This is required to prepare the real root filesystem to be mounted by the Linux kernel

Linux boot process explained in detail

3. Kernel Stage

  • In the kernel stage of the Linux boot sequence, the Linux kernel based on the result of linuxrc can then mount the real root file system
  • The real root file system in Linux is referenced as «/» and it is where all other sub directory and files visible when Linux is running exist
  • The kernel will then spawn the init process, this process always has the process identifier (PID) as «1» because it is the first background process or daemon started by the kernel upon boot
  • All other background daemons are spawned from the init process
  • So the init process will load other system daemons depending upon the configuration of different runlevel
Читайте также:  Загрузка файла команда linux

For example:

Linux boot process explained in detail

Lastly I hope the Linux Boot process explained using flowchart in this article was helpful. So, let me know your suggestions and feedback using the comment section.

Didn’t find what you were looking for? Perform a quick search across GoLinuxCloud

If my articles on GoLinuxCloud has helped you, kindly consider buying me a coffee as a token of appreciation.

Buy GoLinuxCloud a Coffee

For any other feedbacks or questions you can either use the comments section or contact me form.

Thank You for your support!!

Источник

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.

How Linux Kernel Boots?

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:

  • Select from multiple kernels.
  • Switch between sets of kernel parameters.
  • Provide support for booting different operating systems.

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:

  • GRUB – A near-universal normal on Linux systems, with BIOS/MBR and UEFI versions.
  • LILO – One of the primary Linux bootloaders. ELILO could be a UEFI version.
  • SYSLINUX – It may be organized to run from many alternative styles of filesystems.
  • LOADLIN – Boots a kernel from DOS.
  • System-boot a straightforward UEFI boot manager.
  • coreboot – A superior replacement for the computer BIOS which will embody a kernel.
  • Linux Kernel EFISTUB A kernel plug-in for loading the kernel directly from associate EFI/UEFI System Partition.
  • EFI Linux – A UEFI boot loader meant to function as a model and reference for different UEFI boot loaders.
Читайте также:  Restart cinnamon linux mint

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.

  • Upon finding the boot code, the BIOS hundreds and executes it. This is often wherever GRUB begins.
  • The GRUB core hundreds.
  • The core initializes. At now, GRUB will currently access disks and filesystems.
  • GRUB identifies its boot partition and hundreds of configurations there.
  • GRUB offers the user an opportunity to vary the configuration.
  • GRUB executes the configuration after a timeout or user action.
  • In the course of execution of the configuration, GRUB might load further code within the boot partition. a number of these modules are also preloaded.
  • To load and execute the kernel GRUB executes boot commands.

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.

Источник

Оцените статью
Adblock
detector