Explain Booting Sequence or Boot strap Process in Linux

BIOS / SYSTEM Startup / Hardware Initialization / CPU Initialization:

As I mentioned here in the first stage is for Hardware initialization & CPU initialization. Once the System is Powered up by pressing the turning ON button. The First instruction is to Start the execution from BIOS address. BIOS has the list of available or Connected device. Now BIOS will run POST (Power ON Self Test). 

POST:

The post is again a piece of code which will perform the basic test to confirm the availability of the hard for the present booting. Request to each device will be sent for confirmation. If we receive the acknowledgment from the device then it means it is available or connect to the system. If the new hardware is connected to the system then connected device list will be updated on next start up. 

First Boot Device:

Now BIOS has a list of Connected device. It also has the information about the first boot device. First Boot Device contain the MBR information.

MBR (Master Boot Record) / Boot Loader Stage 1:

BIOS will transfer the control to CPU. CPU will load the MBR. Generally Size MBR will in KBytes only.

It will contain the Three basic information:

  1. Primary Boot Loader (PBL) - 446 Bytes
  2. Partition Table - 64 Bytes (Max 4 Partition)
  3. Magic Numbers - 2 Bytes
Primary Bootloader contains the location information about the actual boot loader (GRUB - Boot Loader Stage 2). 

Partition Table Contains the information of Starting & Ending Address of Each Partition. The size of the Partition Table restricts the number of Partitions. 
  • Partition Flag
  • Start CHS
  • Partition Bytes
  • End CHS
  • Start LBA
  • Size
Magic Numbers is used to validate the MBR. It can be used to retrieve the corrupted MBR.


GRUB / Boot Loader Stage 2:

Using MBR details from Primary Boot Loader, CPU load the GRUB into the RAM Memory. GRUB stands for Grand Unified Boot Loader. GRUB will reside immediately after MBR in memory. Now GRUB will load the default kernel image as specified in GRUB configuration files. You can select the version of the kernel if more than one version is available in GRUB configuration file. GRUB also has information about file system unlike LILO (Linux Loader). GRUB will load & execute the kernel & initrd images.

GRUB configuration file will be available at:
/boot/grub/grub.conf

Kernel:

Once Kernel is loaded into RAM. It will continue to remains into RAM till shutdown happens. Kernel will execute the INIT Process & load the root file systems. 

INIT Process:

PID of initrd is 1 as it is the first process executed by the kernel. initrd is the parent process of all another process. Initrd stands for an Initial RAM disk. Initrd is used by the kernel as temporary file system till actual file system will be mounted. 

INIT process will run rc.sysinit script available at /etc/rc.d/rc.sysinit which checks 
  • System Properties
  • Hardware

& mount 
  • Kernel Modules
  • Files System

It will start & stop various process depending on default run level configured in inittab.

To identify the run level we check at:
/etc/inittab

  1. Halt
  2. Single Use
  3. Multi User
  4. Full Mutli User Mode
  5. X11
  6. unsed
  7. Reboot

At last init process run /etc/rc.local command.

Related Post:


Removing Space from Given String & Different Methods to Count Number of Ones in Given Value
Share on Google Plus

About Kapil

"I am Kapil Thakar, an Embedded Engineer cum Blogger wants to learn new things. I love to share my knowledge solutions to the problems. Interested in Blogging, Creative-Writing, SEO, Website Creation, Video Making, Editing, Affiliation Programs, Online Making Money."
    Blogger Comment
    Facebook Comment

0 comments :

Post a Comment

Related Posts Plugin for WordPress, Blogger...