Introducing PhipsBoot – My x86 Relocatable Bootloader
Today, I’d like to introduce you to PhipsBoot. 🎉 I started working on it in September 2023 or so, but polished it just recently. A lot of knowledge from my previous blog post about x86 Kernel Development & Relocatable Binaries went into this project.
PhipsBoot is a relocatable x86_64 bootloader written in Rust and assembly that loads a kernel into 64-bit mode. It abstracts a lot of boot-related x86_64 complexity away. It is more a proof-of-concept than a production-ready bootloader.
The main advantage of PhipsBoot is seen when loaded by GRUB via Multiboot2 in legacy BIOS boot systems, where it can be relocated in physical memory even though the kernel binary is a static ELF. However, PhipsBoot also supports Multiboot1 and XEN PVH entries.
This project combines a lot of toolchain and binary knowledge and experience I collected and gained in recent years about legacy x86_64 boot. The main contribution IMHO is how the binary is assembled and that the thing boots with all the properties described below, but not the high-level functionality itself.
I am especially proud of the well-commented structure of the assembly files. For example the whole page-table mappings are done IMHO very nicely even though it is assembly language. Also, I think it turned out quite cool how I configured the linker script. I hope this can be a learning resource for others!
Further: This project is a solution for a niche use-case, especially in 2024.
Please find more information on GitHub: https://github.com/phip1611/phipsboot
0 Comments