Understanding BIOS and UEFI
BIOS and UEFI are important computers components. They are shipped into the motherboard and help in loading operating systems. But... what is BIOS, what is UEFI, how they work ?

Table of contents
Introduction
BIOS is a firmware. Firmwares are low level sofwares shipped with computers motherboard. The goal of the firmware is to initialize computers hardwares and load operating systems.
The firmware, most of the time comes with a graphical interface allowing users to edit some motherboard settings and the boot order devices for loading the operating system. Those settings are stored in a low-power consumption
memory called CMOS and powered by a battery located on the motherboard.
Nowadays, newly manufactured computers are shipped with UEFI (Unified Extended Firmware Interface) in addition to BIOS. UEFI is not a firmware, but a software extension that runs with BIOS and brings more modern features to the boot process.
Unlike BIOS, UEFI has the ability to read from modern block devices like SSD (Solid State Drive), partitions like LVM, RAID... or block devices formated with the GUID Partition Table (GPT).
BIOS (Basic Input/Output System)
- Located inside the motherboads ROM (Read Only Memory)
- The ROM content is fixed during manufacturing and can’t be modified
- The BIOS contains a set of functions for:
- detecting devices connected to the motherboard and their characteristics. Ex: type of RAM, storage devices, CPU frequency…
- testing and configuring detected devices (done during the first phase of computer initiation called bootstrap or POST : Power-On Self-Test)
- doing diagnosis in order to verify the integrity of critical componants like I/O ports, CPU, RAM, keyboard…
- Loads operating systems from MBR (Master Boot Record), and therefore, from disks partitioned in the MBR format
- MBR is the 1st sector of a hard drive (512 octets) and also a disk partitioning format
- Disks using the MBR partitioning format can't be bigger than 2TB
- BIOS can't therefore load operating systems from disks bigger than 2TB
- MBR size (512 octets) is very small, so a full OS binary won't fit into it
- An intermediate smaller program, called the bootlader will be placed in the MBR instead, and will be responsible for loading the OS from one partition of the disk. For Linux operating systems, the kernel will, most of the time, be loaded from the
/boot
directory - BIOS can't also load OS from SSD (Solid State Drive) disks
UEFI (Unified Extended Firmware Interface)
- Loads operating systems from an EFS (EFI File System) partition of any size. A full OS binary can therefore be directly placed in the EFS partition instead of using a bootloader (like when using BIOS/MRB for booting an OS). The EFS partition has to be formated in vFAT (Virtual File Allocation Table)
- On Linux systems, the EFS partition is mounted in the
/boot/efi
directory, and will generally contains another EFI folder containning OS specific directories like debian, ubuntu, windows... Below an example of the/boot/efi
directory tree for an UEFI debian system:
root@debian:~# ls -R /boot/efi
/boot/efi/:
EFI
/boot/efi/EFI:
debian
/boot/efi/EFI/debian:
BOOTX64.CSV fbx64.efi grub.cfg grubx64.efi mmx64.efi shimx64.efi
- UEFI loads OS from disks with GPT (GUID Partition Table) partitioning format (sometimes known as GPT disks) which is a more modern patitioning format compared to MBR
- UEFI can also load OS from MBR disks, when using the CSM (Compatibility Support Module) mode
- The efibootmgr tool, can be used to change some of the system UEFI settings like setting the default disk from which to boot, or changing the boot devices priority order. It is able to do that while the operating system is running by writing config data to the UEFI NVRAM
- The UEFI NVRAM data are exposed to the system via the
/sys/firmware/efi/efivars
pseudo filesystem - UEFI supports the new SSD disks NVMe (Non-Volatile Memory express) controller and therefore is able to boot operating systems from SSD disks (unlike BIOS)
What happens during computer startup
Execution of Power Good
The power pack makes sure the voltage is correct and report it to the motherboard with the PG (Power Good or PW-OK) signal, which will have a voltage value greater than zero (PG = x Volt, with x > 0).
The motherboard then initialize the CPU. In case the power pack detects a problem with the power voltage, the PG signal sent to the motherboard will have the voltage value zero (PG = 0 Volt).
Execution of pheripheral’s extensions ROMs
Some peripherals require a particular initialization. So they come with specific executables for that purpose. In order to initialize those peripherals, the BIOS needs the address of the extension ROM. The location of that address depends on the peripheral’s type.
For peripherals of type PCI/PCI express, the address is located in the configuration registers of the peripheral. Once the BIOS got the extension ROM address, it copies the address in RAM and the ROM is then executed. At the end of the execution, the peripheral is initialized and the BIOS comes back into play.
On-screen configurations display
The BIOS sends to the screen, informations it has on peripherals connected to the motherboard. The user can then update some of them, like the CPU frequency, the order in which storage equipments will be scanned in order to find a boot zone, etc.
Load of the Operating System
The BIOS looks for a boot zone on storage equipments connected to the motherboard (in the priority order set in BIOS settings). The boot zone generally is the first sector of a storage equipment (the 512 first octets) called MBR (Master Boot Record).
Content of the MBR (from last octets to first octets)
Last 2 octets
The last 2 octets of MBR : 55AA
(hexadecimal). This is a marker indicating to the BIOS that the sector is executable.
Nexts 64 octets
Represents the partitions table of the disk.
The partitions table give us following information about each partition of the disk:
- the physical location of the partition (first sector, last sector)
- the size of the partition
- the type of the partition
Inside the 64 octets, 16 octets are used for the description of each partition of the disk. There can only be 64/16=4 primary partitions on disks of type MBR. In addition to primary partitions, there are also extended partitions and logical partitions for disks partitioned with the MBR format:
- Only 1 extended partition allowed
- MBR disks can therefore have: 3 primary partitions and 1 extended partition or 4 primary partitions
- Logical partitions can only be created inside the extended partition
- Logical partitions table is part of the first sector (512 octets) of the extended partition
- Number of logical partitions inside the extended partition is unlimited, allowing the creation of more than 4 partitions
Nexts 446 octets
For the boot program (executable, startup routine). Once the BIOS knows that the sector is executable thanks to the marker 0x55AA
, it loads the boot program in memory and runs it. The boot program (first stage bootloader) then launches the second stage bootloader.
The bootloader
The bootloader executable located in the MBR (Master Boot Record) is a first stage bootlader. The MBR size is 512 octets (very small), so the first stage bootloader contains just enough information to locate and load a second stage bootloader.
The second stage bootloader is more elegant and provides users, access to a menu that allows them to customize the way of loading operating systems. GRUB (Grant Unified Bootloader), the most commonly used bootloader uses an intermediate step in the boot process (the 1.5 stage).
The goal of the 1.5 stage is to understand the filesystem on which the GRUB’s text-format configuration file resides, in order to load it properly. Stage 1.5 of GRUB understands filesystems like ext2/3/4, fat, minix, reiserfs, xfs... and can therefore load GRUB configuration file from those filsystems. That GRUB configuration file will be used by the second stage bootloader, allowing users to customize the way of loading operating systems with GRUB.