The install branch right now suffers from an interesting problem on EFI
systems. The EFI System Partition doesn't necessarily contain GRUB
modules; the way it's set up right now is that the ESP is mounted on
/efi and GRUB modules are in their usual place in /boot/grub. This
means that if prefix is empty then our initialisation code will default
to setting it to the ESP, which is not going to work properly.
It seems to me that the obvious way to deal with this is to try to unify
it with how PC BIOS systems behave: use a UUID to find /boot/grub,
unless the drive where core.img is installed is the same drive as that
containing /boot/grub in which case we can optimise away the costly UUID
search by simply hardcoding the partition number.
In the BIOS case, grub-setup is responsible for filling in the partition
number. There's no grub-setup on EFI, though, and it seems overkill to
create one, so it seems best for grub-install to just set an appropriate
prefix. This means that we need a prefix notation for "partition number
N on the same drive as core.img". As it happens, I created such a
notation a while back to address problems with nested partitions: