A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.geeksforgeeks.org/linux-unix/how-linux-kernel-boots/ below:

How Linux Kernel Boots? - GeeksforGeeks

Many processes are running in the background when we press the system's power button. It is very important to learn the Linux boot process to understand the workings 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:

Key Steps in the Linux Startup Proces:

  1. The machine’s BIOS (Basic Input/Output System) or boot microcode hundreds or UEFI initializes hardware and runs a Power-On Self-Test (POST) or 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 Step 1. BIOS/UEFI and Power-On Self-Test (POST)

When we press the power button of your system than the your Linux machine than BIOS (Basic Input/Output System) or UEFI (Unified Extensible Firmware Interface) initiates the boot process.Here’s how it works:

Power-On Self-Test (POST):

Storage Initialization:

Bootloader Search:

Feature BIOS UEFI Storage Support MBR (max 2TB) GPT (supports >2TB) Boot Mode Legacy boot Secure Boot support Boot Speed Slower Faster Interface Text-based Graphical Step 2. Role of Boot Loaders in the Linux Boot Process

What is a Boot Loader?

A boot loader is a crucial component in the Linux boot process that initializes the system by loading the Linux kernel and passing necessary boot parameters. It is the first software that runs once the system's BIOS/UEFI firmware completes the Power-On Self-Test (POST) and finds a bootable disk.

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 Linux Boot Loaders 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`.

Step 3. Linux Kernel Initialization and Boot Parameters

Once the boot loader (GRUB, LILO, SYSLINUX) loads the Linux kernel into memory, the kernel initialization process begins. The Linux kernel is responsible for hardware detection, memory management, device driver loading, and starting system services.

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 in Linux Booy Process:

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.

Common Kernel Boot Parameters

  1. ro (Read-Only Mode)
  2. rw (Read-Write Mode)
  3. quiet
  4. splash
  5. nomodeset
  6. init=/bin/bash
  7. noapic / nolapic
  8. maxcpus=1
  9. pci=noacpi
  10. fsck.mode=force
  11. loglevel=3

Initrd (Initial RAM Disk) and Initramfs

Before mounting the actual root filesystem, the Linux kernel loads an initial, temporary filesystem called initrd or initramfs.

Step 4. Init System (SysVinit, Upstart, systemd) and Runlevels in the Linux Boot Process

When the kernel is initialized, the subsequent Linux boot process action progresses into the init system, which handles system services, processes, and sessions. The init system takes care of provisioning all required background services such as networking, logging, and the system daemons in the right sequence.

Types of Init Systems in Linux

There are three major init systems used in different Linux distributions:

SysVinit (System V Init)

Upstart

systemd (Modern Standard in Linux Boot Process)

Runlevel Programs in SysVinit

The SysVinit system defines six different runlevels, each associated with a specific system state. Depending on the runlevel, Linux executes different startup and shutdown programs located in different directories.

Runlevels and Their Directories:

Programs prefixed with "S" (Start) execute during system startup and programs prefixed with "K" (Kill) execute during system shutdown.

Step 5. Reaching the User Login Prompt in the Linux Boot Process

After all the system services are loaded, the last part of the Linux boot phase is reached, which is displaying the user login prompt.

CLI vs GUI Login in Linux Boot Process

For CLI (Multi-User Target):

For GUI (Graphical Target):

Step 6. 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.

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.



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4