On 22 Nov 2017, at 08:23, Warner Losh <[email protected]<mailto:[email protected]>> 
wrote:

Greetings,

A quick google search yielded no results. So I thought I'd ask here. If anybody 
would know, it will be someone in this group. I have a question, but first some 
background. I hope it's both complete enough to understand my question, but 
brief enough to not waste people's time.

I'm implementing real EFI boot manager support in FreeBSD. To date, we've been 
using a rather ad-hoc methods to locate ZFS pools to boot from. For the most 
part, this works well in practice. However, there's some ambiguity. We boot the 
first pool we find that works, while there may be scenarios where this isn't 
desired. This is the same issue we have with UFS, only not as bad because 
there's generally more UFS volumes to choose from. At work, we have systems 
that boot off a ping/pong set of partitions that confuse the 'guessing' code , 
which is why I'm down this rabbit hole.

FreeBSD will be moving from booting off the 'default' location 
(\EFI\BOOT\BOOTxxx.EFI) to have a specified location in a EFI Boot Manager Load 
Option 
(HD(1,GPT,d0b70a0e-b3e3-11e3-a8cc-002590e4d0ec,0x28,0x80)\EFI\FREEBSD\LOADER.EFI,
 for example). The plan is to actually specify two paths. The second one would 
be for the kernel. So on the same example system, it might be 
HD(2,GPT,d0b74ba3-b3e3-11e3-a8cc-002590e4d0ec,0xa8,0x6f3fff78)\boot\kernel\kernel
 to specify the kernel exactly so boot1/loader don't have to guess what the 
user wants.

While the EFI Boot Manager isn't going to grok zpools or the like, LOADER.EFI 
can and does. It would be nice to have a standard way of doing this. UEFI has 
an extensible media type for situations like this. VendMedia(uuid, data) is how 
it's encoded. The data is a series of hex bytes. This seems to be a good match 
for zpools, though I'm not ZFS versed enough to know what would be good for the 
data (though the pool name seems like a must).

So, my question: has anybody walked down this path yet? Is there a standard way 
to specify ZFS boot environments and/or paths within a pool as a UEFI DEVICE 
PATH?

Thanks for any help you can give... I hope for a 'here's a doc' answer that has 
it all defined, but I'm also cool with creating the doc, though I'd likely need 
a lot of help to get the details right if I had to go that path.


Actually there is. In illumos case we do provide zfs-bootfs property for kernel 
(boot -B zfs-bootfs=pool/dataset), and there the pool can be represented by 
GUID and dataset by its object ID, and we can translate both back to names of 
course.

In loader we set zfs-bootfs property in: 
https://github.com/illumos/illumos-gate/blob/master/usr/src/boot/sys/boot/zfs/zfs.c#L708

and the kernel code to translate the object ID is in: 
https://github.com/illumos/illumos-gate/blob/master/usr/src/uts/common/fs/zfs/zfs_vfsops.c#L1275

I think the idea is pretty good, it is very likely we will ned up sharing it:D

rgds,
toomas


------------------------------------------
openzfs-developer
Archives: 
https://openzfs.topicbox.com/groups/developer/discussions/T41d7b9e4338abde1-M0fd07cc2747f03217e51949d
Powered by Topicbox: https://topicbox.com

Reply via email to