Close or Esc Key

Arduino Projects   |   Raspberry Pi   |   Electronic Circuits   |   AVR   |   PIC   |   8051   |   Electronic Projects

How Computer Boots Up?

Table of Contents:

How Computer Boots up?

Have you ever given it a thought that when you press the power button on your laptop or PC, what happens behind the logo of Windows XP/Vista/Seven or Linux? From the pressing of the power button to the appearance of the login screen there are more than hundred components/peripherals that are initialized and thousand lines of code is executed during the process of booting. But what is booting? We will look inside the machine, that actually what all happens. So let us start…

 
What is Booting?
Booting is a process or set of operations that loads and hence starts the operating system, starting from the point when user switches on the power button.
 
What is Booting Sequence?
Basically documents related to booting are generally confusing as they are often related to some specific operating system that is Linux machine or Windows machine. But I will keep it as general as possible. General Booting sequence comprises of the following steps:

 

·         Turn on the Power button.
·         CPU pins are reset and registers are set to specific value.
·         CPU jump to address of BIOS (0xFFFF0).
·         BIOS run POST (Power-On Self Test) and other necessary checks.
·         BIOS jumps to MBR(Master Boot Record).
·         Primary Bootloader runs from MBR and jumps to Secondary Bootloader.
·         Secondary Bootloaders loads Operating System.
These are the tasks that are carried during booting process. Now let us discuss them in detail.
 
As soon as we turn the power button, the reset signal is sent and the registers in the CPU are set to their pre defined value.  The first and foremost is the reset vector as shown in the figure (example is taken of 4GB RAM). It should be noted that RAM contains the garbage value at this time, and the instructions/data stored at any memory location is due to the memory map of the chipset. Memory map maps the location (address) to flash memory containing values or instructions.  It is ensured that the instruction stored at this reset vector location is jump to system BIOS, as BIOS takes up further process of powering up the system.
 How Computer boots up
 
BIOS-Basic Input Output System
As we have seen that at power up CPU is reset and its registers are set to the default value, which is an address pointing or directing to the hardware containing BIOS. Generally the hardware is EEPROM containing the BIOS. The tasks performed by BIOS are categorized as follows:
·         POST- Power on Self Test is the foremost routine which checks and tests the basic hardware. If it fails then it displays error.
·         Initialization of the hardware devices by letting them run their individual BIOS( eg. video card have their own inbuilt BIOS code).
·         Searching for the Master Boot Record and reading it.
·         Copying the boot sector code to RAM and then switching the control to it.
 
Boot Sectors
A sector is a part of the hard disk having length of 512 bytes. A sector is termed as boot sector because of its location and because this sector is responsible for the further boot process of the system. This boot sector is generally called Master Boot Record. The MBR is a 512-byte sector, which is located in the first sector on the disk (sector 1 of cylinder 0, head 0). As soon as BIOS gets the boot sector, it tends to copy MBR to RAM and switches the execution authority to it.
·         In the MBR the first 446 bytes are the primary boot loader, which is also referred as PBL.
·         The next sixty-four bytes are the partition table, which has the record for each of the partitions.
·         The MBR ends with two bytes that should be 0xAA55. These numbers act as validation that this sector is the boot sector or Master Boot Record.
How PC boots up2