First steps in bare-metal programming using UEFI kevinboone.me · 235 points · 48...
HN Best 30 @best30
First steps in bare-metal programming using UEFI kevinboone.me · 235 points · 48 comments · HN thread
TL;DR Kevin Boone's index page for a series of articles on bare-metal programming for PC-type machines with UEFI firmware, aimed at experienced Linux developers with no prior UEFI knowledge. The series covers toolchains, compiling and linking, creating bootable disks, and basic file management, and is meant to be read in order.
- The series targets developers using a Linux workstation to build bare-metal applications for x86-style PCs with UEFI firmware.
- It assumes no prior UEFI knowledge and walks through the software tools needed.
- Topics include compiling and linking, building a bootable disk, and basic file management.
- The author asks that the articles be read sequentially, since each builds on the previous one.
- Commenters note practical pitfalls such as the lack of a C standard library, UTF-16 strings, and the linker silently accepting undefined symbols.
Discussion The thread mixes praise for the series with a long side discussion about UEFI's design. Many commenters found the guide useful and well written, and pointed to alternatives such as edk2-libc, the LLVM libc UEFI port, posix-uefi, uefi-rs, and GNU-EFI references. A large share of the discussion criticises UEFI itself: UTF-16 strings, the FAT/VFAT filesystem requirement, the Windows-style coding conventions it inherited, and whether calling it bare metal is accurate. The mood is mostly appreciative and technically curious, with sharp critical asides about UEFI's legacy and some tangents about LLMs and coding assistants.
- Series is useful, clear and well written (many): Several commenters thank the author and say the guide helped them get started or was a reference for their own bootloader work, such as one building a bootloader in Zig. They appreciate the modest, experience-based tone.
- UEFI design is poor and should be replaced (many): Critics call UEFI an overengineered, poorly designed standard. They single out UTF-16 strings, the FAT requirement, and Windows-style conventions, and suggest coreboot, Device Tree, Open Firmware or U-Boot as saner options.
- Lack of C standard library is a real obstacle with workarounds (some): Commenters point to edk2-libc, LLVM's libc UEFI port, and posix-uefi as ways to get POSIX-like functionality without the usual C library, and note the Rust and C# alternatives.
- Whether UEFI counts as bare metal is debatable (some): One commenter argues that UEFI is not truly bare metal because firmware and SMM sit underneath, while others reply that bare metal refers to how directly code can touch hardware once control passes to it.
- UEFI is still ubiquitous (a few): Replies to a question about whether UEFI is still used say it is near-universal on modern x86 PCs and Windows ARM laptops, with legacy BIOS mostly emulated on top of it.
- LLMs make such low-level projects easier (a few): One commenter describes using an AI model to write a small UEFI application in about seven minutes, while others push back on AI-written projects and ask how to verify they are free of AI code.
Links from the comments
- EDK II C library for UEFI, suggested as a fix for the missing C standard library
- Limited POSIX interface for UEFI apps, with a tool to create bootable GPT/ESP images
- Rod Smith's EFI programming guide, cited as an earlier overlapping resource
- Rust library for UEFI, used by a UEFI IRC client project
- LLVM libc UEFI support page; a commenter was unsure whether it is still maintained
#UEFI #bareMetal #firmware #osDevelopment #bootloader #Linux