Skip to content
systemcoding.dev
Assembly

BIOS vs UEFI Booting for Hobby OS Developers

Choose between legacy BIOS and UEFI for a hobby OS by comparing the CPU mode at entry, boot media, memory map, graphics and tooling, with a decision table.

5 min read
Summarize in AI
Flat illustration of two options weighed side by side, with the Linux, Intel and GNU logos.

The first design decision for a hobby operating system on x86 is how it starts, and there are two answers. The legacy BIOS jumps to a 512-byte sector in 16-bit real mode, and you build everything above that yourself. UEFI loads a PE executable from a FAT partition and hands it a 64-bit CPU, a memory map, a framebuffer and a set of services. They are close to opposite philosophies, and the choice shapes your first six months of work: what you write in assembly, which tools you use and what hardware your system can boot on. This post compares them on the points that matter for a hobbyist, ends in a decision table and gives a recommendation. For the full UEFI path, there is a separate guide on UEFI boot for OS developers, and this post stays on the choice.

What each one gives you at the first instruction

The BIOS leaves the CPU in 16-bit real mode, with segmented addressing, a 1 MiB address space, no paging, and a boot drive number in dl. Your code sits at 0x7C00, and the only services are software interrupts: int 0x10 for video, int 0x13 for disks, int 0x15 for the memory map and extended functions, and int 0x16 for the keyboard. Before you can run a 64-bit kernel you have to enable the A20 line, build a GDT, enter 32-bit protected mode, set up page tables and enter long mode. That sequence is the classic hobby OS boot path, and each step is a well-documented exercise.

UEFI starts your code, a PE/COFF application with the .efi extension, already in 64-bit long mode on a 64-bit firmware, with paging enabled and an identity-mapped address space. The firmware passes you a pointer to the system table, through which you reach boot services: allocate memory, read files from the FAT-formatted EFI System Partition, query the graphics output protocol for a framebuffer, and get the memory map. The services are function tables called with the Microsoft x64 calling convention, not the System V one your C compiler uses by default on Linux, which is a common first surprise. You exit boot services when you take over the machine.

Comparison

ConcernBIOSUEFI
CPU mode at entry16-bit real mode64-bit long mode (on x86-64 firmware)
Entry format512-byte sector with 55 AAPE32+ .efi file on a FAT partition
First-stage size limit446 bytes of codeNone practical
Disk servicesint 0x13, CHS and LBA readsFile protocol, block I/O protocol
Memory mapint 0x15, E820GetMemoryMap boot service
GraphicsVGA text mode, VBE modes via int 0x10Graphics Output Protocol framebuffer
Partition schemeMBR, with GPT possibleGPT, with a FAT ESP
ToolchainNASM, a linker script, ldA PE-capable compiler (clang --target=x86_64-windows, or gnu-efi)
TestingQEMU with SeaBIOS, defaultQEMU with OVMF firmware image
Secure BootNot applicableSigned binaries required when enabled
Hardware reachOld machines, and new ones via CSMNew machines; CSM is being removed

Where BIOS is better for learning

The BIOS path teaches the machine. Writing a boot sector, switching modes by hand and enabling the A20 line force you to learn the x86 architecture's history and its control registers, and almost every classic tutorial and book on OS development follows it. The tools are small: NASM, ld, and QEMU with no extra firmware download. A boot sector fits in a single file and a short build script, and a failure usually means a wrong byte you can find with a debugger. If your goal is to understand how a PC starts, rather than to ship something quickly, the BIOS path rewards you.

It is also the only option on old hardware and many virtual machines, and the fastest way to get a "hello" on screen.

Where UEFI is better

UEFI removes the work that is the same on every machine. You do not write the mode switch, you do not enable A20, you get a real memory map and a framebuffer without VBE calls and you load a kernel from a file system by name rather than from raw sectors, so a kernel is no longer limited by how many sectors your stage 1 knows how to read. Real machines made in the last decade boot UEFI natively, and most have dropped the legacy compatibility module that BIOS boot depends on. A BIOS hobby OS may not boot on a current laptop at all. If you want your system to run on current hardware, or you want to start with a 64-bit kernel and C from the first hour, UEFI is the practical path.

The costs are tooling and indirection. You need a firmware image to test, OVMF for QEMU, and a toolchain that emits PE executables. A first .efi hello needs an understanding of the system table, the EFI_STATUS conventions and the calling convention. And since the firmware abstracts the hardware, you learn less about the machine at the lowest level.

The hybrid path

Many projects support both. A bootloader such as GRUB or Limine can boot a kernel under either firmware and hand it a standard structure: the Multiboot2 specification and the Limine protocol both define what the kernel receives, including the memory map and framebuffer, independent of how the machine started. Using one removes the choice from your kernel entirely and lets you write the kernel first and your own bootloader later, or never. That is the approach with the fastest route to a working kernel, at the cost of depending on someone else's loader for the early stage.

Decision table

If you want...Choose
To learn real mode, A20, the GDT and the mode switch by doing themBIOS
A small, self-contained first project that fits in a sectorBIOS
To run on a modern PC or laptopUEFI
A 64-bit kernel in C from the start, with a framebufferUEFI
To write the kernel first and ignore firmwareMultiboot2 or Limine with GRUB
To test on a real old PCBIOS
To boot under Secure Boot laterUEFI

A practical recommendation

For a first hobby OS aimed at learning, start with BIOS and a boot sector, get to 32-bit protected mode and a C kmain, and then add a UEFI entry point as a second stage when the kernel can take a boot-info structure from either. The kernel's interface is the memory map and the framebuffer in both cases, so the work transfers. For a project whose goal is the kernel itself, skip the firmware work and use a boot protocol bootloader on both firmwares. And do not try to learn both paths at once: the mental model of "I own everything from 0x7C00" and the model of "I am a guest application in a firmware environment" conflict, and each is easier alone.

Also inKernels
Share

Keep reading

Get new posts by email

We send one email when a new post is published. No spam.

Unsubscribe in one click. No spam, ever.