- Boot Loader
- init (/sbin/init)
BIOS: BIOS stands for Basic Input Output system, it is a coral ROM read only memory that placed on the motherboard of your computer. When you start up your computer, it has no idea what to do so ROM which is on your computer that is the first thing that is run whenever you start up, also the BIOS is OS independent. BIOS handle a number of important tasks the first one is
Boot OS: Other one is booting the OS needs to get things going the BIOS by itself can’t get your OS running inside the BIOS there is a list of devices that it will check in order to see If there is a Master Boot Record (MBR) is present or not.
The MBR is a first sector of a disk that designates that it is a bootable device. For that it will check some list of devices, let’s see a picture for it.
It will first check Removable devices that might be a device like floppy drive; it will check the hard drive, if there is no MBR found then it will check other devices.
Once the BIOS find the MBR it will give the instruction to Boot and execute the first 512 bytes Boot sector. But if BIOS doesn’t found MBR then the system stops and BIOS acknowledge you that there is nothing that I can Boot from.
MBR: Now the MBR is run and Boot Loader starts. MBR is a first sector of a drive i.e 0 Track sector which is on your storage device, so generally your Boot Loader may reside in the MBR. But more often there are also file and other parts of the Boot Loader that are also located on disk. Normally we use Multi-Level Boot Loader. After the BIOS it comes to MBR and MBR looks through its list and searching for a valid Primary Partition.
Boot Loader: Very common Boot Loader is LILO i.e Linux Loader and GRUB (Grand Unified Boot Loader)
LILO: It is divided into two parts “Installer and Runtime Module”. The Installer module places the runtime module on MBR and Runtime module has a information about all OS installed. When runtime module is executed it select the OS to load and transfer control to Kernel.
GRUB: More common ones you’ll see these days is GRUB. The configuration file for GRUB is /etc/grub.conf but it is a soft link of /Boot/grub/grub.conf
There is also a task that takes place as the Boot Loader start up work it might create a ramdisk, we call it initrd image it stands for “initial ramdisk” .
Kernel: Now it comes to Kernel. If you want to see where the kernel was actually located when your computer start up you can go to the /Boot/vmlinuz, here Z denotes that the Linux kernel is compressed. The first thing that will happen is it uncompresses itself. There are some builds up Linux where it not compress but most of the time you will find a compressed in that directory. Then the kernel runs init.
Init: Once the kernel loaded it finds init into sbin directory and then executes it. Now the init process check for /etc/inittab file and set the path. Then it run all the Boot scripts which is resides into /etc/rc.d . Whenever your System turn on just check this file /etc/inittab in the last you will see id:5:initdefault: But Upstart is a event-based replacement for /sbin/init daemon, which handles starting of tasks during Boot.
RunLevel: There are 7 layers of it.
- 0 – Halt1 – single user mode
- 2 – multiuser mode but without networking
- 3 – Multiuser mode with networking
- 4 – Unused but you can edit it and create your own Runlevel
- 5 – X11 graphical mode
- 6 – Reboot
After this it login to preferred RunLevel and we come to the Login prompt. Here getty script takes place for authentication.
Congratulation now you have learned the Linux Boot Process with Details.