Turning the Machinery On

Briefly, the hardware part of the boot sequence can be described like that: The boot process starts with pressing the power button to turn the computer on. Then, after a short self-test of the power supply, a signal is sent to the processor and it starts executing the ROM BIOS code. Then the ROM BIOS performs a short test of the available hardware and if everything is OK, the BIOS starts reading the configuration information in the CMOS (Complementary Metal-Oxide Semiconductor) – i.e. where to start the operating system from (from a floppy, CD or the hard disk). In case the operating system is to be loaded from a hard disk, the BIOS locates its Master Boot Record (MBR) and loads it into memory. Then the partition loader (also called Boot Loader) takes charge and reads the partition table to find the active partition and a boot record there. After that the operating system starts booting. After that brief explanation of the hardware part of the boot process, let’s look in more detail at each of the steps:

  • Switching on the power. When the power supply is switched on, its first task is to perform a self-test to ensure that power is stable – all voltages and current levels are normal. The self-test takes less than a half second and if you didn’t know about it, you would certainly never notice it, unless the computer freezes at this point. If the power supply does not pass the power-self test, this means that either the power supply unit is faulty, or that the voltage and current levels are not normal. So, when you turn on your computer and it just does not make any noise at all, one possible reason is a problem with the power supply. However, this does not necessarily mean that the power supply has gone off – a more prosaic reason can be an unplugged power supply cable.
  • Here comes the CPU. Before the CPU receives the signal and the power is stable, the processor receives continuous reset signals and just waits. After the power supply has made the power self-test, it sends a signal to the processor that the power is OK. The CPU starts operations and the first thing it does is to look in the BIOS ROM for the start of the BIOS boot program. Generally, the start of the BIOS boot program resides right at the end of system memory and usually it is only 16 bytes from the top of ROM memory. Of course, 16 bytes are quite insufficient for the program itself to reside there but they are absolutely enough for a JMP (jump) instruction, which tells the processor the actual address of the ROM BIOS code.
  • The BIOS POST is next. One of the first operations that are performed by the BIOS is the power-on self-test (POST). The purpose of the POST is to determine if there are any fatal errors that prevent the proper booting or operation of the computer. Since at this time the video adapter is not started yet, all alarms about fatal errors are communicated in beeps. These beeps vary from manufacturer to manufacturer and their meanings are looked up in the vendors documentation, so if you hear your computer scream, try to distinguish the signals, look up their meaning in the docs and see if you can troubleshoot it on your own.
  • Looking for the video adapter. If the power-on self-test is passed without errors up to here, the BIOS starts looking for adapters that also need to load their ROM BIOS program in order to be initialized. After the video adapter has been initialized, you will see on screen all other messages about failed hardware. Actually initializing the video adapter takes place after the video test, which is also part of the POST, has been completed successfully, so maybe it is more precise to say that the video adapter is loaded in the middle of the POST.
  • POST continued. Besides checking the central hardware and the video adapter, the POST reads the BIOS identification and displays the data on screen. Another portion of the POST is the memory test, which is skipped if it is a warm-startup (warm startup is when you restart the computer, while cold startup is when you have switched it on). The output of the memory test is displayed on screen – i.e. how much installed memory you have. If you see that the installed memory is less than what you physically have inside the computer box, this could mean that some of your memory might have stopped functioning (i.e. you have 2 blocks of 512MB each, which is 1GB in total but the memory test displays that you have only 512MB, which means that one of the two blocks is not working). Depending on how many blocks of RAM you have, you might be able or you might be not able to continue booting. If you have 2 or more blocks of memory and at least one of them is working, you will be able to go further, though your computer will be slower because of the reduced memory. This memory scenario is an example of a non-critical error.
  • More tests. This stage could easily be grouped with the previous stage because essentially it is still checking the system but in the name of clarity, I have separated it in another stage. This stage can be called “system inventory” because the BIOS checks for disks, drives, and all kinds of peripherals. If the BIOS supports the Plug and Play standard, plug and play devices are also discovered and resources are assigned to them. The hard disk(s), the optical drives and the floppy-disk drive are located as well. When the hardware testing is over, the BIOS displays a summary screen about your system’s configuration. Well, you might not be able to read it because it flashes on screen for a split second but if you don’t see any error messages, which tend to stay forever, this means that the test has passed successfully. Any error messages here will direct you to the cause of failure. For instance, if you see that a hard disk is not found, this could mean that the disk is not physically present, it is not connected properly, it has died completely and so on. You might not be able to learn the exact cause of failure but when you know that there is something wrong with the hard disk, additional tests (or at least a look inside the computer case) will help you troubleshoot the problem.
  • The BIOS reads the CMOS. After the POST has been passed either successfully, or with non-critical errors, the next step the BIOS performs is to read the configuration in the CMOS. The CMOS is a 64 bytes area in memory, which is persistent (i.e. the information there is not deleted when you turn off the computer, as is the case with RAM) because it is fed by the current of a small battery, which resides on the motherboard. Due to its small size, the CMOS can’t contain much information but it has a vital role in the boot sequence because it tells the ROM BIOS where to look for the operating system. The BIOS will try all possible drives (hard disk, floppy, external disks) to boot from and if no boot device is found at all, you will get an error message saying that there is no boot device available. This error message is BIOS-specific and sometimes can sound like “NO ROM BASIC – SYSTEM HALTED”, which in plain English means that the BIOS could not find a drive to boot the operating system from.
  • Reading the MBR. After the CMOS has directed the BIOS to the drive from which to boot the operating system, the BIOS starts reading the very first sector of the specified device. For hard disks, this is the Master Boot Record and it is 512 bytes in size. 512 bytes is a lot of space, compared to the 64 bytes of the CMOS, for example and there is enough room for a partition table, partition loader and signature. The signature is the last two bytes and if is missing, or its value is invalid, the boot sequence stops with a fatal error message because the MBR can’t be loaded into memory and it is not possible to read the partition information.
  • Reading the partition table. The partition table, as the name implies, contains information about the partitions on the hard disk like numbers of bytes per sectors, numbers of sectors per cluster, start and end of the partition, etc. When the active partition is found, the BIOS reads its very first sector for information about the boot record and depending on what is written in the boot record, proceeds further to load the operating system. In case you dual-boot (i.e. you have Windows and Linux installed on your computer), most likely (if everything is in order with the MBR) you will be presented with a screen, where you can choose which operating system to load. If you don’t make a choice within the set timeout, the default operating system will be loaded.
  • Loading the operating system. After you have chosen which operating system to load, the procedure differs depending if it is Windows or Linux, as described next.