Hello,
the
/boot/boot1.efi bootloader is only capable of booting FreeBSD, as far as I know. But that doesn't really matter on UEFI (more on that later). The easiest way to achieve this is to create 800k efi partition and clone the
/boot/boot1.efifat content there:
Code:
gpart add -t efi -s 800k /dev/<your_device>
dd if=/boot/boot1.efifat of=/dev/<your_new_efi_partition>
The
boot1.efifat is actually an image of 800k FAT filesystem with
boot1.efi stored as /EFI/BOOT/BOOTX64.EFI. So you can also manually create a FAT filesystem and copy the
boot1.efi there:
Code:
gpart add -t efi -s 300m /dev/<your_device>
newfs_msdos -F 32 -L efi /dev/<your_new_partition>
mount -t msdosfs /dev/<your_new_partition> /mnt
mkdir -pv /mnt/EFI/BOOT
cp -v /boot/boot1.efi /mnt/EFI/BOOT/BOOTX64.EFI
umount /mnt
but I strongly suggest the former method.
balanga said:
What I can't work out from the Wiki is if the EFI partition should be the first one on the disk...
As far as I know, it doesn't have to. There can even be more of these partitions on your device.
balanga said:
" The path to the loader may be set by an EFI environment variable, with a default of /EFI/BOOT/BOOTX64.EFI."
But where is this environment variable set?
It is set in your motherboard NVRAM. There are tools to manipulate it. Linux has it's efibootmanager, grub-install does it for efi target (making use of efibootmanager), I'm unsure which tool to use in FreeBSD. However, the default EFI bootloader resides on efi-type partition with FAT filesystem as '/EFI/BOOT/BOOTX64.EFI' by standard. So a good motherboard should find such a bootloader on it's own and you shouldn't be required to do anything. If your motherboard doesn't find the loader or if you want to name it differently or put it into another directory, you must teach your motherboard where to find it.
I'm afraid I can only tell you how to do it via the efibootmanager at the moment. Say your efi partition is
/dev/ada0p1 (which will probably be /dev/sda1 in Linux). Boot some efi-enabled Linux installation media and then:
Code:
efibootmgr -c -d /dev/sda -p 1 -l '\EFI\BOOT\BOOTX64.EFI' -L FreeBSD
Note: the backslashes are correct here.
Note2: /dev/ada0 doesn't have to be /dev/sda in some Linux distributions, it can also change over reboots. You need to make sure which device to use.
It will create a new entry in your NVRAM stating where to find the specific bootloader. This way you may teach your motherboard as many loaders on as many FAT partitions as you like (there can be more bootloaders on one partition, more bootloaders on more partitions, ...). A potential scheme like this shouldn't be a problem:
Code:
/dev/ada0
|- /dev/ada0p1 (efi, FAT32) |- /EFI/FREEBSD/boot1.efi
|- /EFI/GENTOO/grub.efi
.....
|- /dev/ada0p5 (efi, FAT32) |- <some Windows boot stuff>
.....
/dev/ada1
|- /dev/ada1p1 (efi, FAT32) |- <some super exotic stuff>
...
You can teach your motherboard to boot all this.