Friday, August 19, 2011

Linux Boot Process

As soon as we boot out linux system, after bios execution , Stage1 boot loading take place. In stage1 boot loading the code inside Master Boot Record of booting disk execute. MBR consist 512 bytes which include 446 bye booting instruction, 64 byte partition table and 2 byte magic number.

The 446 bye of mbr, load 2nd stage of boot loader. For example if you are using GRUB as boot loader, the GRUB is so big that it can't fit in 446 byte. So mbr load 2nd stage of boot loader.

What is 1.5 stage of boot loader ?

Unlike LILO GRUB can load a Linux kernel from an ext2 or ext3 file system. It does this by making the two-stage boot loader into a three-stage boot loader. Suppose your kernel is on partition formatted by ext2 or ext3, then GRUB first load e2fs_stage1_5 then proceed to stage 2.

With stage 2 loaded, GRUB can, upon request, display a list of available kernels, /boot/grub/grub.conf get diaplayed. You can select a kernel and insert kernel parameters if required.Here, you can use a command-line shell for greater manual control over the boot process.

After stage2 specify kernel and root filesystem, kernel uncompress and loaded after that root filesystem mounted. If your kernel executes and root file system (/) get mounted properly. Next stage will be of system initialization.

Remember that kernel panic error may panic you if your root filesystem not mounted properly.
init is the first user space process run after kernel loading. Setting for init process present in /etc/inittab, wrong configuration of /etc/inittab may also disturb you.