QBoot is a somewhat simple bootloader designed as a learning experience for myself and others, focusing on code style and readability over performance to help others understand how bootloaders work.
To build the bootloader, you need nasm, fdisk, and dd on BIOS, and zig for both BIOS and UEFI. The latest zig build the bootloader was compiled under is 0.12.0-dev.21+ac95cfe44
For those unaware, to build a zig project you run zig build followed by the build step you would like to run, while in the directory containing build.zig. This generates output in the zig-out folder and maintains a cache in zig-cache for faster recompilation. For example, to run the bios build step, run zig build bios.
The available build steps are:
bios: builds the BIOS version of the bootloader and puts it intozig-out/bios/disk.dd, which is a GPT configured disk made inscripts/make_bios_disk.shrun-bios: does the same asbiosbut runs it using qemu.debug-bios: does the same asbiosbut runs it in bochs, which requiresbochson your system compiled with graphical debugger installed. The OSDev Wiki provides instructions for compiling bochs from source properly, which is often required.uefi: builds the UEFI version of the bootloader and put its intozig-out/uefi/EFI/BOOT/BOOTX64.efirun-uefi: does the same asuefibut runs it using qemu.package-uefi: packages the UEFI build, normally just a file that is run raw in qemu, into a hard disk image with the executable in an EFI bootable partition. This disk is located atzig-out/uefi/disk.ddqemu-system-x86_64is used forruncommands, and is configured to run with 4 processors, 256 MB of RAM, and the time set to the local time. Unfortunately, some bugs with OVMF exist and do not allow for using exception handling using qemu, so some UEFI functionality is only available on real hardware. For burning the disk given bypackage-uefiorbiosto a USB, I recommend using Rufus on Windows orddon Linux.
- Common
- BIOS
- UEFI
- Protocol wrapper(see protocol)
- Matching functionality with BIOS
- Disk building script for use with real hardware(see make_uefi_disk)
- Exit boot services and jump to kernel
- Reasonable API integration with zig STD(f.e. file system integration)
- More easily expandable build system(f.e. refactoring to make new targets easier and more automated)
- Zig host-side tools for build(f.e. zig versions of
dd,mkfs.ext2, etc) - More readable and documented code with proper references to manuals and documents

