Created attachment 159109 [details]
Include gpt functionality
boot1.efi currently selects the first partition it can find that has a valid UFS partition. I would like it to honor the gptboot(8) bootme/bootonce flags and pick the partition that gptboot would have picked.
The patch is a bit nasty (because of the UEFI API or me not finding the right function)
* The code has not been tested with CDROM or different block sizes
* common/gpt.c needs to be changed as the BSS is too big for the tianocore
* It is kind of random which disk is picked. It looks at the first one
We observe the same problem with NanoBSD built from 11-stable r312663. Which is an issue for us since we are unable to switch between the code images when using the efi loader, forcing us to use gptboot instead. The patch given earlier does not apply cleanly on r312663.
I tried really hard to get feedback (mails, irc, etc) but there didn't seem to be any interest in it. Right now I have no deployments that require nanobsd/gpt booting so feel free to rebase the patch yourself.
I'll take a look at this. I've recently committed a change to switch from installing boot1.efi to loader.efi on the ESP, so hopefully this issue will go away soon.