Changes between Version 3 and Version 5 of Ticket #4028
- Jun 2, 2011, 5:40:01 PM (9 years ago)
- Property Patch 0 → 1
v3 v5 1 Attached is a 512 byte PMBR boot loader that looks for the UUID of a Haiku GPTpartition and boots it, falling back to MBR partitions if said UUID isn't found or if the (primary) GPT is corrupted or non-existent. 1 Attached is a partition and boots it, falling back to MBR partitions if said UUID isn't found or if the (primary) GPT is corrupted or non-existent. 2 2 3 Its usefulness is in being a generalised IPL that supports both partitioning styles, allowing it to be used transparently and even allowing disks to be converted from one partitioning style to the other with ease, should the need for more partitions or volumes over 2TiB arise (for instance when cloning an older disk to a newer, more capacious one). 3 Its usefulness is in being a , should the need for more partitions or volumes over 2TiB arise (for instance when cloning an older disk to a newer, more capacious one). 4 4 5 5 It also paves the way for Haiku to create and support booting from multiple volumes larger than 2TiB, which we're in the very privileged position of enjoying efficiently in the near future due to BFS. Another use case is taking a disk from a Intel EFI machine, plugging it on a BIOS machine and boot just fine; and vice-versa. … … 7 7 As mentioned, if there are valid partitions defined in the MBR, and the primary GPT becomes corrupt, it can fall back to loading the MBR partition with the active flag set, if one is defined. 8 8 9 Currently there's no provision for falling back to the GPT copy that lives in the end of the disk, due to the 512 bytes constraint; supporting this would require either some major refactoring of the code or disabling the support for booting from MBR using calls to int13h other than function 4200h, "LBA Read from Disk". 9 Currently there's no provision for falling back to the GPT copy that . 10 10 11 It was tested on emulators and on my actual, proper computer. Loading Windows, Haiku and FreeBSD was tested (UUID must be changed accordingly, of course); for the GPT boot, the number of sectors to load from the partition is adjustable (needed by FreeBSD's "gptloader" on a freebsd-boot UUID partition), probably needed by Haiku as well since stage1 is 2 sectors big), but beware that int13h 4200h only supports up to 127 (0x7f) sectors, or a loader of almost 64KiB; so don't specify a larger number. This is not checked on the code, again because of space constraints. 11 The number of sectors loaded depends on the boot style. Booting from a MBR partition assumes that the Partition Boot Record is one sector long, whereas booting from a GPT partition assumes a partition exclusive for a system loader and will either copy its entirety into memory starting from address 0x7c00, or will copy up to circa 545KiB, whichever is smaller. Thus, it remains compatible with the FreeBSD gptloader and should work for loading Bootman from an exclusive Haiku boot manager partition as well. 12 13 It should be easy to adjust the UUID signature as needed. It lives at offset 0x1a0 (416), leaving plenty of space before the 32-bit disk signature at offset 0x1b8 (440), so compatibility with Microsoft Windows and other OSs is maintained.