Note on dual boot / chain loading with FreeBSD 14.3 LUA loader

Hi all!

Just a quick note since I could not find any documentation on this very useful, simple feature. First some context:
* Laptop dual booted with Linux/Ubuntu (was also Win10, but I removed this recently)
* single SSD storage device
* UEFI BIOS + GPT partitioning
* EFI partition to support UEFI boot
* UEFI boot entries pointing to Grub and FreeBSD EFI loader files
Also (but not really relevant):
* BSD partition (UFS in my case)
* Linux partition (ext4 in my case)

Clearly I can use efibootmgr to tweak the bootNextID and this works OK. But clunky however and needs root each time... so I wanted a simple means to swap between BSD and Linux using the boot menus.

This is trival with the FreeBSD LUA loader. Simply put the Grub loader path into a loader variable called chain_disk. I used the loader local config file to do this:
$ cat /boot/loader.conf.local
# add option to chain load Ubuntu
chain_disk="disk0p1:/EFI/ubuntu/grubx64.efi"

You can find this path by dropping into the loader shell (option 3) and using the tools there:
OK lsdev
... list of partitions appears here...
OK ls <partition name>/EFI/ubuntu
... list of loader files appear here ...

Grub is installed for Linux in the EFI partition and supports BSD via chain loading also:
$ cat /boot/grub/custom.cfg
menuentry "FreeBSD loader" {
search.fs_uuid E495-BC6D root
chainloader /EFI/freebsd/loader.efi
}

you can find the EFI partition UUID from Linux like this:
$ ls -l /dev/disk/by-uuid
... list of partitions appears here with UUIDs ...

hope that helps!
 
Back
Top