Introduction To Booting Process In Linux
Booting Process In Linux is a method of starting the computer system when it is powered on. You might have observed in any programmable electronics system like computer, mobile, etc. that it takes some time after you powered on. Suppose you have pressed the power switch to turn it on and it takes some time to be available for you to interact with the system. Basically, this time is noting but the booting process.
This booting is nothing but the full verification and validation of the computer system. So that the machine will be ready for the user. Here we will discuss the Linux OS booting system. We all are knowing that there are different Operating Systems are available. But mostly we can say that all the Operating System booting processes nearly equivalent. Since the Linux OS is very famous & important to learn for everyone as it is open-source. Here we will only discuss on Linux Operating System Booting process.
Booting Process Stages In Linux OS
Every time when you power on your Linux System, it goes through a series of stages before it displaying a login screen that prompts for your username or password. There are 4 distinct stages that every Linux distribution goes through in a typical boot-up process. It basically takes 4 stages to start your Linux Kernel or Operating System. But the real application will be available after a series of 6 stage processes. So let us discuss all these 6 booting processes that I am going to explain boot process in Linux.
- BIOS: Basic Input Output System.
- MBR: Master Boot Record.
- GRUB: Grand Unified Bootloader.
- Kernel: Linux Core Operating System.
- Init: Executes The Run Level System Application Init.
- Run-Level: Main Application Software starts execution.
BIOS In Linux Booting Process
The BIOS is the first stage of the Linux Booting Process. The BIOS stands for Basic Input Output Operating System. It is the very first program that is stored in nonvolatile memory like ROM or flash memory. It allows you to set up and access your computer system at a very basic level. The advanced version of BIOS is UEFI. The main purpose or objective of BIOS is:
- POST: It performs the POST nothing but the Power On Self Test. It Checks for System Integrity and ensures the proper functioning of computer hardware with its inbuild self-diagnostic program.
- BIOS Drivers: The BIOS drivers are stored in non-volatile memory, its main function is to supply the basic computer hardware information.
- BIOS Setup Utility Program: It is a CMOS setup configuration software. It is used to configure the hardware settings and also the device settings, time and date, computer password etc. The Non-volatile Memory is used to store the settings of memory, type of Disk, and also the information about the computer system. These informations are not stored in the BIOS chip.
- Bootstrap Loader: It Searches, loads, and executes the MBR program from ROM to RAM. It looks for boot loader in Floppy, CD-ROM, or Hard Drive as per the priority set. You can also press a key like F8, F2 or F12 depends on your System OEM. It does it during the BIOS startup to change the boot sequence. After the successfull detection and loaded into the executable memory, it gives the control to it. We can say that the BIOS loades and executes the MBR.
MBR In Linux Booting Process
The MBR is the second stage of the Linux Booting Process. It is extended for Master Boot Record. It is always stored at the first sector of the Bootable Disk. Basically, the MBR path is “
/dev/hda“, or “
/dev/sda” in Linux System. The advanced version of MBR is called GPT.
The MBR is a small program with less than 512 bytes in size. The main functions of MBR are to store the 3 components data records, such as:
- Primary Boot-Loader Information in first 446 bytes.
- Partition Table information in next 64 bytes.
- MBR Validation check information status in last 2 bytes.
GRUB In Linux Booting Process
GRUB is extended for Grand Unified Bootloader In Linux Booting Process. It is an advanced version of an older Linux loader called LILO. This is also called Primary Boot Loader (PBL) in Linux Booting Process. The main function of the GRUB is:
- To select the type of Kernel Image should be loaded if you have multiple OS in your computer system.
- To display a splash screen and waits for few seconds. if you don’t enter anything, it loads the default kernel image that is specified in the grub configuration file.
- This Configuration file is available in
/boot/grub/menu.listpath that contains the kernel and Initial RAM Disk (initrd) image to load and execute it.
Kernel In Linux Booting Process
Initially, the Kernel loads in the Read-Only Mode.
- Mounts the root file system as specified in the “root=” in menu.list.
- Loads the actual root file system.
- Fetches details from the drivers.
- Mounts the Root filesystem in Read Only Mode and validates the rootfile system if it requires.
- Switches the root filesystem into the actual filesystem in Read Only Mode.
- Loads the Ethernet, RAID, SCSI devices.
- Setup hostname from
- Checks the Kernel filesystem.
- Remounts the filesystem in r,w mode.
- Reads fstab and mount then up.
Init In Linux Booting Process
The Init is available in “
sbin/init” path. This is the first program that is being executed. The main functions of init are:
- It Executes the “
fsck” if it is requires.
- This coordinates the rest of the boot process and configures the environment for the user.
- It becomes the parent or grandparent of all the processes that starts automatically on the system.
- It checks the Run Level in the path of “
/etc/inittab” file to decide the Linux run level.
- The Init identifies the default initlevel from “
/etc/inittab” and uses that to load all the appropriate programs.
- It Execute the ‘
grep initdefault /etc/inittab’ on the system to identify the default Run level sets in the system.
Run-Level In Linux Booting Process
When the Linux system is booting up, you might have seen the various service settings displays on the screen. The run level is a state of init of the whole system that defines what system services are operating.
|0||It Shuts down the system|
|2||Multi-user mode without networking|
|3||multi-user mode with networking|
|5||X11 with Multi-user mode without networking|
|6||Reboots the system to restart it|
- It determines what are the programs should execute after the Operating System boots up.
- The runlevel defines the state of the machine after boot.
- The system executes the default init level setting programs as per the user configuration available in the below directories:
- Run level 0 – “
- Run level 1 – “
- Run level 2 – “
- Run level 3 – “
- Run level 4 – “
- Run level 5 – “
- Run level 6 – “
- Run level 0 – “
there are also symbolic links available for these directories under “
/etc/” directly. So the “
/etc/rc0.d” is linked to “
You can go to the “
/etc/rc.d/rc*.d/” directories to see that some of the files start with S and K. The programs start with S are used during startup (Start). The programs that start with K are used during shutdown (Kill). You can look at the numbers right next to the S and K in the program names. Those are the sequence numbers in which the programs will be started or killed. The above 6 stages of the Linux process are used for a complete startup of any Linux system.
Then finally the “
/etc/rc.d/rc.local” will be executed to prompt for User login. Now your system is ready for the user to do any task or run any application program.