Concept behind Multiple Booting Guide
Most of the computers that are used today are of the kinds: Traditional BIOS-MBR type, and UEFI-GPT method (used by advance/latest computers).
- Step-1: Power Supply:
Normal not much important.
- Step-2: Bootstrapping:
When the computer is switched on, Computer has no idea where is the OS and what to load on to the CPU. Hence, we use a special program called as Bootstrap Loader.
In simple terms this locates the Kernel and Loads it to the main memory.In some cases, even the simple Bootstrap Loader Loads a more Complex Bootstrap Loader.
- Step-3: The Role of BIOS in booting process:
(Now from here something real starts). When the computer boots up initially or is reset then the Instruction Register gets loaded with some default address which is basically a jump address that transfers control the bootstrap Loader and the job of BIOS starts.
BIOS stands for Basic Input Output System:
The Functions that BIOS perform are:
- CMOS is checked for custom settings
- Device Drivers are checked and Power-on self-test (POST) is Performed.
- All the Settings are Displayed.
- Find Bootable Devices that are available and are having a valid OS
- Bootstrap Loader continues performing subsequent steps.
CMOS is a small memory RAM chip that is present in the motherboard. The contents of this CMOS doesn’t get erased when computer is shut down . The CMOS contains the information of about where we should look for finding a valid bootable file. Nowadays, the modern computer manufactures are protecting the CMOS, so that users don’t modify the CMOS settings easily.
Its normally a misconception that people have is that when they modify the boot order they change the BIOS setting but in reality they modify the CMOS settings is the place where you modify the boot order etc. Once the POST check is completed successfully.
BIOS will check the CMOS settings to find what is the boot order. BootOrder is the order of preference of devices/sources according to which the the BootStrap Loader will find the source of Loading the OS on to the Main Memory.The various sources of Booting the OS are Hard-disk, Network, USB Drivers, CD etc. Any of the Source can be used to load the OS on to the Main Memory given that the OS image is correctly (without any corruption is present those sources) present on those devices.
The BootOrder can be modified as per requirements.
If trying to install Dual Boot then we can create a boot-able pen drive by burning the required Linux OS (Open source so free) file onto the USB stick and Loading that OS on the partition of the Disk that we may create for installing a new OS.
BootStrap Loader will check as per the order in CMOS and will load the first source where ever it finds a bootable source.
- Step-4: MBR and GRUB:
Pay attention here, it is really important.
Considering Normal Boot from the Hard Disk the BIOS will always initially look at a fixed address of the Hard Drive which is usually the starting Sector of the hard-drive.In simple, terms the it means the BIOS loads the Oth block of the Hard-disk. This sector contains the MBR (Master Boot Record).MBR contains all the details of the partitions. Followed by MBR is the Partition Tables . This Partition tables contains the information about the various partitions of the Hard-disk and also stores information about where each of the partitions starts.
The above step is same for all the OS be it Windows / a series Loaded Linux Systems.Usually when we load a UNIX on the system then the default MBR is replaced by the GRUB. In simple terms, GRUB is a secondary boot Loader.
GRUB stands for GRand Unified Bootloader.
Now suppose our Hard-Disk has 4 partitions and in each partition we are having a different OS. And here each of the partitions would be starting with a block called as as boot-block (in UNIX) or called a Boot sector (in NTFS). This block would be having information about where each of the OS is present in the memory.
Followed by Volume control Block which stores information about size of that partition and number of blocks allocated to that partition. In UFS(Unix File System), it is called as Super Block and in NTFS it is called as Master File Table.
Figure – MBR Details
Bootstrap Loader, Boot Loader, BIOs are not same things they should not be confused with each other.
BootStrapping is a whole process BIOS and Boot Loader are a part of this, where BIOS performs the tasks which I have previously explained and BootLoader is anything that is laded on the main memory before the actual OS or Kernel is Loaded in to the main memory.
The GRUB usually has 3 stages names 1, 1.5 and 2. The stage 1 is simple and calls the stage 1.5 performs the task explained below. The Stage 2 actually Loads the Kernel.
Normally partitions doesn’t not start any before sector 63. So partitions start from sector number 63. So, in this free space the GRUB 1.5 is stored. This free space between MBR and the starting point of the partitions is called as MBR GAP.
Grub Stage 1.5 is present in this MBR GAP and it usually contains the drivers for reading file systems. So grub stage 1 will load grub stage 1.5 to the RAM, and will hand over the control to GRUB 1.5 stage.
Now grub stage 1.5 will load the file system drivers and once the file system drivers are loaded, it can now access /boot/grub/grub.conf file which contains other details about kernel path and initrd path etc.
Now this is the point where you are presented with a beautiful TUI (Terminal user interface), where you can select your operating system kernel and press enter to boot it. Thus after the above step we choose the OS that we want use of all the installed OS in our Machine.
Step-5: Loading The Kernel:
Kernel is the core part of the OS . OS and Kernel should not be confused as Kernel is just a core part of the OS and OS is a complete set of operations and utilities. Normal OS loading will continue depending on the OS we choose from the GRUB (given that we have already installed multiple OS). If we don’t choose any of the OS from GRUB screen then a default OS is loaded.
Attention reader! Don’t stop learning now. Practice GATE exam well before the actual exam with the subject-wise and overall quizzes available in GATE Test Series Course.
Learn all GATE CS concepts with Free Live Classes on our youtube channel.