Ever wondered how your modern PC get to the Login screen with a mere press of a button? Are you curious of what happens behind the scenes of bootup or do you want to get called up by your friends when they face an error while booting up their PC? If yes, you're at the right place.
Boot up is not just a short-hand for
Powering on a PC, it's actually a long and vital process. It's involves an extensive list of things that takes place to get a fully-functional session of an operating system. In this blog, we'll look upon the entire boot process from BIOS to Bootloader.
Once, all the units gets power, CPU looks for a program called BIOS or UEFI(in modern systems).
BIOS stands for
Basic Input and Output System. Even though it hasn't evolved much, it has certainly changed it's residence many time from
NOR flash. It resided in
CMOS SRAMin it early days but as SRAM was volatile, it's contents got flushed after turning OFF the computer.
BIOS then took it's place in
UV-ROM(erasable by UV rays) and finally ended up in
flash memorybacked up by a CMOS battery.
POST(Power-on self-test) wherein it sends a signal to all devices and check's if they're up and running. If there's some error, it beeps and shows an error. The number of times it beeps signals the type of error. For example, if there's a RAM failure in a certain Dell laptop, it will beep 3 times signaling the error. You can know more about beep codes and corresponding errors here.
Now, once the BIOS is done testing the hardware, it hands over the control to the Operating system's
BIOS looks for the Operating System to boot and load for which it has to select a
Boot Device. This can be HDD, SSD, USB, CD or DVD drive.
MBR partitioning system, we have the bootloader in the first sector of the hard disk called
MBR sector is 512 bytes long and has primarily 3 partitions:
1) 446 byte for
2) 64 byte for
Partition Table(4 tables of 16 bytes each)
3) 2 byte for
Magic Number(Validation of MBR)
The main task of 446-byte long primary bootloader, also referred to as the stage-1 bootloader, is to find the
secondary bootloader. It finds it by looking through the partition table.
Now, once the Stage-2 bootloader is loaded, it actually loads the operating system.
It does this by loading the
optional initial RAM disk(initramfs). The kernel starts the
init system(systemd mostly) which starts other services leading all the way to login screen.
For Linux, we have
GRUB bootloader, Windows uses
Windows Boot Manager and Macs use
UEFI/GPT-based systems use something called
EFI executablewhich doesn't have to be present in the first sector of the disk.
All these processes hardly take a few seconds. The evolution in the tech-world has made the computer boot up process lightning fast!