UEFI booting — operating system or device?
When we boot our computers, what we want to do is load an operating system. Traditionally, we booted devices and it was up to the operating system to work out how to get the system loaded by booting a device. However, UEFI was supposed to change all of that. With UEFI (or Unified Extensible Firmware Interface) the idea is to directly load an operating system without the steps of device booting.
There is, in the UEFI design, a fallback ability to boot devices. This is needed when the operating system is not yet installed, so that booting the install device can set things up. However, this was intended only as a fallback. The main use of UEFI was to be to directly load an operating system.
I have recently posted about a Toshiba system and an HP system, where the manufacturer did not seem to get the message. Both appear to be cases of backward thinking that sticks to the old idea of booting devices rather than operating systems.
In this post, which I am categorizing as a rant, I’ll discuss the distinction between booting a device and booting an operating system.
Booting a device
The name “booting” comes from the metaphor “pulling yourself up by the bootstraps”. Traditionally, a boot device would be designated. The system, on startup would load a small amount of code from that boot device. It would then run that loaded code which would load more code. In turn, that would load more code. With a few steps, enough code would be in memory to be able to load the operating system.
In early IBM mainframes from the 1960s, the first step of the booting operation (known as IPL or Initial Program Load) would load only 24 bytes into memory. Those 24 bytes were to be input/output commands to load more code. The practice of booting computers (sometimes called “bootstrapping” is actually older than the IBM mainframe.
By the time the IBM PC came out, booting was easier. We had ROM (Read Only Memory), so the PCs came with a ROM preloaded with some basic functions, particularly some basic I/O function — hence the term BIOS (Basic I/O System). There was code in the BIOS for use in booting. However, the idea of booting a device was still followed. The ROM BIOS would load a boot sector (the MBR or Main Boot Record) into memory and jump to it. The idea of booting this way, was that code in the ROM should not determine how operating systems work. Its role was just to get enough loaded so that the operating system itself could take over.
This scheme has served us well, though it went through several stages of evolution as the capacity of disks grew beyond the capabilities of early BIOS code.
UEFI and OS loading
The designers of UEFI recognized that we had outgrown the older booting methods. Modern computers could have larger ROM, and a substantial NVRAM (non-volatile memory). The old metaphor of pulling ourselves up by the bootstrap was no longer appropriate. We could directly load an operating system.
The overall idea is to have a shared partition, the EFI partition (sometimes called the ESP or EFI System Partition), where all operating systems could install their system loaders. Each operating system would create a directory within the EFI partition, and put boot code in that directory. It would then add an entry to NVRAM giving the operating system name and a pointer to the system loader program.
This maintains the flexibility of the old boot system. The computer firmware provides some basic I/O services that can be called by the system loaders. The firmware reads the NVRAM to identify which operating system should be loaded. And it then runs the system loader (in the EFI partition) for that operating system.
Device boot fallback
UEFI does provide a fallback option of booting a device. The directory “\EFI\Boot” in the EFI partition is reserved for that purpose. When booting a device, the firmware loads “\EFI\Boot\bootx64.efi” as the operating system loader program.
The device boot fallback is intended to allow booting a CD or a DVD or a USB device. A vendor could also use it so that when a computer is first booted some preloaded setup software is invoked to configure the initial operating system.
It is unfortunate that some manufacturers are providing firmware that wants to only use the device boot fallback. Yes, Toshiba and HP, I am talking about you. This is not the way that UEFI should be used. The device fallback should only be a fallback for special purposes. It should not be the regular way of booting.