I am in the process of writing a simple OS bootloader (first booting in legacy mode). After understanding the boot process (MBR loading the VBR, etc) I began looking into the specifications for different filesystems to understand how they handled this old style of booting.
This is necessary because the Volume Boot Record (VBR) is, by design, located on disk in the first sector of the "active" partition. In other words, the first sector's worth of bytes (normally 512 bytes) is not actually filesystem data structures, but boot code for the operating system.
First, I looked at FAT for its simplicity. To my surprise I found references to the "Boot Sector" built right into the specification. Specifically, when you format a disk with the FAT filesystem one is able to "reserve" some number of sectors at the beginning for special blocks of code, like the VBR. In this case, all filesystem data structures are displaced by this number of reserved blocks. Great! This is exactly what I was looking for.
However, I was not able to find something similar in other filesystems (specifically ext). These other filesystems must support the "legacy" style of booting (e.g. space for the VBR to bootstrap the OS) because they were available well before the UEFI boot specification.
0x0000:0x7c00
, it relocates itself, determines the "active" partition and loads its VBR (first sector) it at the same address,0x0000:0x7c00
. This VBR was the first stage of the bootloader specific to the installed OS. Of course, this is how it was originally done, and the process has evolved over the last 40 years. You certainly do not need a VBR, especially if your installed bootloader, like GRUB, overwrites the MBR with its own code specific to its boot scheme