The Journey of how computer starts

Prashant Pandey
3 min readJun 21, 2021

I always had a curiosity about how it works under the hood, how the Linux kernel is loaded into the system. Let’s get started on how our computers starts.

Fig: System power up steps

There’s a 4 step procedure for system to boot up:

  1. BIOS startup
  2. MBR/GPT
  3. GRUB
  4. KERNEL

BIOS: the first thing that computers load into the memory from ROM as you hit the switch on button is BIOS (Basic Input Output System), nowadays it is widely known as UEFI (Unified Extensible Firmware Interface). Mostly the BIOS stores at address 0xFFFF0, but it depends on the hardware. Power on self test (POST) and Run time services are two parts of the BIOS.

Complementary metal oxide semiconductor (CMOS) settings defines the preference to search active and bootable devices (such as floppy disk, a CD-ROM, a partition on a hard disk, a device on the network, or even a USB flash memory stick) attached to the system. In case of any error the BIOS will provides feedback to the users by a ‘beep’ sound.

MBR: Master Boot Record (MBR) is a 512-byte sector, located in the first sector on the disk (sector 1 of cylinder 0, head 0) which contains the primary boot loader. After the MBR is loaded into RAM, the BIOS yields control to it. The first 446 bytes are the primary boot loader, which contains both executable code and error message text.

The next sixty-four bytes are the partition table, which contains a record for each of four partitions (sixteen bytes each). The MBR ends with two bytes that are defined as the magic number (0xAA55). The magic number serves as a validation check of the MBR. Modern version of MBR can also be referred as GPT which is based on GUID (globally unique id) partition table. It is used mostly in conjunction with UEFI based boot-loader.

GRUB: GRand Unified Bootloader (GRUB) or Kernel Loader or Boot Manager loads kernel and optional initial ram disk. It also contains the knowledge of filesystem which means it is the stage where the operating system can be loaded. If you install multiple operating system then you’ve to choose which OS to load into the ram in the GRUB menu. It is responsible for loading and transferring control to the OS kernel software. The kernel, in turn, initializes the rest of the operating system. There are popular alternatives of programs that can be installed as boot manager instead of GRUB ex. rEFInd Boot Manager (highly customizable), systemd-boot (text based). You can also configure the boot manager by editing /etc/default/grub file.

Fig: Customizing GRUB configuration

Kernel: It is the core interface between hardware and system processes; It communicates between the them and manage resources efficiently. The kernel is responsible for every communication between computer software and hardware, manage memory (keep track of what is stored where), manage system processes (allocating cpu usage among several key application procedures), device driver management, manage system calls and security (receive and process requests for service from processes).

Fig: Kernel responsibilities

--

--