Linux Booting Process :
Linux boot processs completes in 6 stages :
- System startup(Hardware )
- Boot loader Stage 1 (MBR loading)
- Boot loader Stage 2 (GRUB loader)
- Kernel
- INIT
- Runlevel
Stage 1 : System startup
- Run POST (Power On Self Test) operation.
- Selecting first Boot device.
Selecting first Boot device: Once the POST is completed BIOS will have the list of devices available.It will select the first boot device and gives back the control to Processor(CPU).
When the system is booted, processor looks at the end of system memory for the Basic Input/Output System or BIOS program and runs it.Once the control goes to BIOS it will take care of two things
Stage 2 : Boot loader Stage 1 (MBR loading)
- Primary boot loader code(446 Bytes)
- Partition table information(64 Bytes)
- Magic number(2 Bytes)
Once the BIOS gives control back to CPU, it will load the MBR into the first sector of the boot disk.MBR is a small part of Hard Disk with just a size of 512 Bytes, I repeat its just 512 Bytes.
Which will be equal to 512B (446+64+2)B.
Primary Boot loader code: This code provides boot loader information and location details of actual boot loader code on the hard disk. This is helpful for CPU to load second stage of Boot loader.
Partition table: MBR contains 64 bytes of data which stores Partition table information such as what is the start and end of each partition, size of partition, type of partition(Whether it's a primary or extended etc). As we all know HDD support only 4 partitions, this is because of the limitation of its information in MBR. For a partition to represent in MBR, it requires 16 Bytes of space in it so at most we will get 4 partitions.
Magic Number: The magic number service as validation check for MBR. If MBR gets corrupted this magic number is used to retrieve it.
Once your CPU knows all these details, it will try to analyse them and read the first portion of MBR to load Second stage of Boot loader.
Once your CPU knows all these details, it will try to analyse them and read the first portion of MBR to load Second stage of Boot loader.
Stage 3 : Boot loader Stage 2 (GRUB loader)
MBR loads and executes the 2nd stage boot loader GRUB into memory.GRUB located in the first 30 kilobytes of hard disk.
GRUB read its configuration and displays the GRUB boot menu (where the user can manually specify the boot parameters) to the user. GRUB loads the user-selected (or default) kernel into memory and passes control on to the kernel. If user do not select the OS, after a defined timeout GRUB will load the default kernel in the memory for starting it.
Stage 4 : Kernel
- Mounts the root file system as specified in the “root=” in grub.conf
- Kernel executes the /sbin/init program
- Since init was the 1st program to be executed by Linux Kernel, it has the process id (PID) of 1. Do a ‘ps -ef | grep init’ and check the pid.
- initrd stands for Initial RAM Disk.
initrd is used by kernel as temporary root file system until kernel is booted and the real root file system is mounted. It also contains necessary drivers compiled inside, which helps it to access the hard drive partitions, and other hardware.
Stage 5 : Init
The /sbin/init program (also called init) coordinates the rest of the boot process and configures the environment for the user.
When the init command starts, it becomes the parent or grandparent of all of the processes that start up automatically on the system. First, it runs the/etc/rc.d/rc.sysinit script, which sets the environment path, starts swap, checks the file systems, and executes all other steps required for system initialization.
The init command then runs the /etc/inittab script, which describes how the system should be set up in each init runlevel . Among other things, the/etc/inittab sets the default runlevel .
Stage 6 : Runlevels Programs
Starts the services according to the run levels.
Starts the services according to the run levels.
The content writer has invested enough time over the research of the topic and has after that written everything very nicely and carefully. ACTIVATION CODE WHEN TRY TO LAUNCH
ReplyDeleteNETFLIX