Linux Boot Loader

Grub is boot loader used to handle loading of multiple OS on machine.  Grub get installed to MBR of boot device which bios detects having MBR.  Grub will present a menu to choose OS to boot.  Once grub gets installed to MBR making changes to grub.conf file does not need reinstall of grub to MBR. 

Here is nice video on Linux Boot Process.

Once OS selected if its windows then Grub will give control to windows OS loader.
If its Linux then Grub loads kernel and initrd.  kernel vmlinux is small in size and its meant to start init but it does not have all modules and neither has file system setup yet.  initrd is ram file system and has modules which are then inserted into kernel.  Now kernel itself can talk to disk and load actual file system and so as it does that.  Now it unloads initrd. 

grub will call head.S which sets up the stack and head.S will call decompress_kernel and then call startup_32.  it calls then start_kernel (process 0) in main.c which will then call kernel_thread to call init process (process 1).

kernel now starts init.  init is first user space program and now its multitasking.
vmlinuz is written in c but its image is loaded by grub and executed.  On uncompressing kernel takes process further to set up processes using start_kernel in main.c and create init process.

One more reference for linux boot process from IBM article.  

Comments

Popular posts from this blog

vim plugin management - pathogen

VIM - html and javascript