Hi. Looking at this Haiku guide on Uefi booting, there appeared some questions.
ESP (EFI System Partition) Size.You recommend 32 MB, telling it’s “more than enough”. It depends on many factors if that would be enough at all. The Uefi documentation frees itself of the responsibility to even advice “common” size, that’s true. It’s left to the choice of OS vendors. This is how it explains it:
Note, there is a “multiple OS” mentioning. That’s the point. When you format (in GPT) a raw disk, you create an ESP as part of Haiku installation. But this ESP is not for Haiku only! And given the stage of Haiku, it’s well reasonable to expect many people using it alonside with other OSes, - a multiboot environment. There are chances, that the ESP creation could be made by Haiku. Then OSes installed after it, may use the same ESP. 32 MB could be not enough then. For many reasons. And not all are reasonable, but still they are real. A good example of a not so reasonable one. Linux. It has taken the worst ever possible approach of doing UEFI. It embedded an UEFI OS Loader into its kernel (what a surprize!). Meaning that you need to put the whole linux image into an ESP and a bunch of other linux stuff. Knowing how bloated linux images are, you do realize that 32 MB might be problematic… There are other, saner reasons - ESP can hold a lot of data, resources from more than 1 vendor. Chapter 12 (2.4.errata.B) is a good source of hints on this.
I’ve seen in many places, that setting ~100MB of the ESP size is quite good. It’s still a tiny portion of a rather smallish 256 GB hard disk, not to mention larger ones, that are more common nowadays.
Finally the second, which especially makes me wonder. When I see attempts to interact with UEFI on the OS development level (communities, hobbyists), I always see using this BOOT{MACHINE_TYPE}.EFI approach. As if it is the only one. Again, maybe you do so just because UEFI support is too fresh and unpolished yet, but I wanted to say on this. The approach, when you put your OS Loader (OSL) in the \efi\boot\boot{machinetype}.efi is the last resort for the FW. It’s intended to be used normally only for removable devices (even here, it’s not the only option). And for persistent, non-removable storage, where an OS could reside, this approach is the last resort of the UEFI Boot Manager to boot something (a so called “default boot behavior”):
When no valid load options worked out, nothing, only then it may try that. It’s left to the implementation what set of media to try. Just read carefully section 3.4.1.2 (2.4.errata.b):
“Optionally” may occur. Or may not. This is already a sufficient reason to get rid off of this approach for the installation disk, since it makes running (installing) Haiku less successful. But also, it has other dangers. For example if you will install another OS alongside and after Haiku, it might overwrite Haiku’s BOOTXXX.EFI file.
It’s so easy to see from the specification, the right way to do stuff - you create your own folder under \efi\boot, in this example, let it be “haiku”, and put the OSL there, - voila! This is how it should work.
\efi
\boot
\haiku
\haikuldr.efi
See section 12.3.1.3 “Directory Structure” (2.4.errata.b), they wrote that down clearly.
During the installation, your installer creates the needed load option, asking UEFI Runtime Services - any UEFI compatible OS not only should preserve UEFI RTS, but also - may make use of them! This is one of the best examples of what it can be used for. This way, Haiku will appear in the Boot Manager menu and users can see/set/edit its load option as well (e.g. changing the order). It’s a normal way, whereas BOOTXXX.EFI approach is for an “exceptional” case and the quote above shows - it is even “optional”!