Linux boot process

BIOS

Based on the boot order given in the bios, the device from where the boot sector has to be
loaded is determined.

MBR

Bios loads and executes the first 512 bytes off the bootable device. The MBR points to the boot loader.

GRUB
At this point you will be presented with the options of selecting the OS to boot. The grub

config file is /boot/grub/menu.lst

Grub can load an os directly or chainload another bootloader. The latter is not preferred

since we need to maintain a second bootloader. This can be used when you need to load an OS

which is not supported by GRUB

Set the root device where the os is located.

root (hd0,0)

Load the kernel image

kernel /vmlinuz-2.6.18-128.4.1.el5 ro root=/dev/VolGroup00/LogVol00 rhgb quiet

Load the kernel modules using initrd image , if needed

initrd /initrd-2.6.18-128.4.1.el5.img

To load an unsupported OS

Set GRUB’s root device to the partition by the command

grub> rootnoverify (hd0,0)

Set the active flag in the partition by the command

grub> makeactive

Load the boot loader by the command

grub> chainloader +1

`+1′ is the offset. +1 indicates that GRUB should read one sector from the start of the partition.

INITRD

In  the first boot-up phase, the kernel starts up and mounts an initial root file-system from the contents of /dev/initrd (e.g. RAM  disk  initialized  by the boot loader).  In the second phase, additional drivers or other modules are loaded from the initial  root  device’s  contents. After loading the additional modules, a new root file system (i.e., the normal root file system) is mounted from a different device.

The boot loader loads the kernel program and the initrd’s content into the memory.

Ram disk(/dev/initrd) is initialized by the boot loader before kernel startup. On kernel startup, the kernel uncompresses and copies the content of initrd into the ram device(/dev/ram0) and frees memory used by initrd.

The kernel then rw mount the ram device(/dev/ram0) as initial root file system.

The executable file linuxrc load the necessary modules from the ramdisk. Once linuxrc terminates,the normal file system is mounted.

If the normal root filesystem has the /initrd directory, the ram disk(/dev/ram0) is moved to that.(this will be read-only) The already running processes from /dev/ram0 will continue to run. If the /initrd directory is not present, the ram disk is unmounted.

The usual boot sequence (e.g. invocation of /sbin/init) is performed on the normal root file system.

INIT process

The init process is the last step in the boot procedure and identified by process id “1”. Init is responsible for starting system processes as defined in the /etc/inittab file. Init typically will start multiple instances of “getty” which waits for console logins which spawn one’s user shell process. Upon shutdown, init controls the sequence and processes for shutdown. The init process is never shut down. It is a user process and not a kernel system process although it does run as root.

System Login Prompt

The /etc/inittab will initialize the scripts in the specified run levels.} else {