Linux Booting Prodecure
Now we are going to review boot process in Linux Operating System. How Operating system goes through distinctive phase of booting states. Understanding the boot procedure, will help you with seeing how the hardware and software is cooperating with each other, furthermore will give you the obliged information to begin troubleshooting a booting issue you have. Linux booting procedure can be partitioned to multiple stages. We will be examining each of these stages in detail, in their particular areas.
The following are the 6 high level stages of Linux boot process.
BIOS (Basic Input/Output System)
When we control on, the processor looks at the end of system memory for the Basic Input/Output System or BIOS program and runs it. When BIOS sees all is well it will start scanning for an operating system Boot Sector on a valid master boot part. When the boot loader program is identified and loaded into the memory, BIOS gives the control to it. Thus, in basic terms BIOS loads and executes the MBR boot loader.
MBR (Master Boot Loader)
It is the first sector of the Hard Disk with a size of 512 bytes. The first 446 bytes are the primary boot loader, 64 bytes for partition table and 2 bytes for MBR validation timestamp. MBR contains the information of operating system, So, in basic terms MBR stacks and executes the GRUB boot loader.
GRUB (Grand Unified Bootloader executes Kernel)
If you have multiple kernel images installed on your system, you can choose which one to be executed. Loads a GUI interface i.e. splash image located at /grub/splash.xpm.gz with list of available kernels where you can manually select the kernel also. Grub configuration file is /boot/grub/grub.conf (/etc/grub.conf is a link to this). In simple terms GRUB just loads and executes Kernel and initrd images.
Kernel
A linux kernel is in responsible of taking care of Process management, Memory Management, Users, Inter process communication and so on. It is loaded configures hardware and memory allocated to the system. At that point kernel mounts the root partition as indicated in grub.conf as read-only. Kernel executes the/sbin/init program.
Init
Executes the system to boot into the run level as specified in /etc/inittab. Init identifies the default initlevel from /etc/inittab and uses that to load all appropriate program.
There are different run level’s in linux.
Run-Level Usage 0 System Halt/Shut Down 1 Single User Mode 2 Multiuser Mode Without Networking 3 Full Multiuser Mode 4 Unused 5 GUI/X11 6 Reboot
Runlevel
At the point when the Linux system is booting up, you may see various services beginning. Those are the runlevel programs, executed from the run level directory as defined by your run level.
A no. of runlevel scripts are defined inside /etc/rc.d/rcx.d
Run level 0 – /etc/rc.d/rc0.d/ Run level 1 – /etc/rc.d/rc1.d/ Run level 2 – /etc/rc.d/rc2.d/ Run level 3 – /etc/rc.d/rc3.d/ Run level 4 – /etc/rc.d/rc4.d/ Run level 5 – /etc/rc.d/rc5.d/ Run level 6 – /etc/rc.d/rc6.d/
In light of the chose runlevel, the init process then executes startup scripts situated in sub-directories of the /etc/rc.d directory. Under the /etc/rc.d/rc*.d/ directories, you would see programs that begin with S and K. Programs begins with S are used during startup. Programs begins with K are used during shutdown. K for Kill.
Enjoy it!