Last Updated on by ICT Byte
- We can distinct boot process in linux in 6 different stages
- These includes
- BIOS
- MBR
- GRUB
- Kernel
- Init
- Run Level Programs
BIOS
- Acronym for Basic Input Output System
- BIOS loads and executes MBR boot loader
- When computer is started, integrity test is carried put by BIOS. It does integrity test of HDD or SSD
- Then, searches, loads and executes boot loader program. Boot loader programs are on MBR
- MBR sometimes can be CD ROM, pen drive etc which have live installation of linux.
- BIOS provides control of system to boot loader program after boot loader program is detected.
- BIOS loads and executes MBR boot loader.
MBR
- Acronym of Master Boot Record
- Located in /dev/sda or /dev/hda, according to hardware. This means MBR is in 1st sector of bootable disk
- Has information about GRUB. (In old systems – LILO)
- Has size less than 512 bytes, with components
- Primary boot loader info (1st 446 bytes)
- Partition table info (64 bytes)
- MBR validation check (last 2 bytes)
- MBR loads and executes GRUB boot loader
GRUB
- GRUB is Grand Unified Bootloader
- You can choose one if you have multiple kernel images installed in your system, else default will load
- GRUB displays in screen and waits few seconds where you can choose the kernel, else default kernel image is loaded.
- GRUB configuration file can be found in /boot/grub/grub.conf
- It contains kernel and initrd image
- GRUB loads kernel and initrd image
- Initrd is Initial RAM Disk
Kernel
- Kernel is core of OS
- Complete control over anything is there with Kernel
- Executes /sbin/init program
- Init was the first program to be executed by Kernel which contains which has process id (PID)
- Kernel uses initrd as temporary root file system until the time when Kernel is booted and real root file is mounted. Necessary drivers are also there with initrd. These drivers help to access hardwares and harddrive partitions.
Init
- System executes run level programme
- Available run level are
- 0 : Halt
- 1 : Single User Mode
- 2 : Multiuser with no NFS
- 3 : Full Multiuser Mode
- 4 : Unused
- 5 : X11
- 6 : Reboot
- Identifies default initlevel and loads required programs [initlevel is obtained from /etc/inittab)
- Identifies default run level (By executing “grep initdefault/etc/inittab” on system)
- Most of the time 3 or 5 is set as default run level
Runlevel Programs
- Above mentioned runlevel have their own directories
– Run level 0 – /etc/rc0.d/
– Run level 1 – /etc/rc1.d/
– Run level 2 – /etc/rc2.d/
– Run level 3 – /etc/rc3.d/
– Run level 4 – /etc/rc4.d/
– Run level 5 – /etc/rc5.d/
– Run level 6 – /etc/rc6.d/
– In the /etc/rc.d/rc*.d/ directories, we can see program starting wuth S and K
– S : Programmes start with s are needed while system startup
– K : Programmes start with K are needed while system shutdown
– Startup programs are executed while system start ups amd while shutdown, there is kill program
BIOS | Basic Input / Output System | Executes MBR |
MBR | Master Boot Record | Executes GRUB |
GRUB | Grand Unified Boot Loader | Executes Kernel |
Kernel | Executes /sbin/init |
Init | Executes Run Level PRograms |
Run Level | Executed From /etc/rc/rc*.d/ |