Solved EFI Dualbooting FreeBSD/OpenBSD with Full encryption

Hello everyone,

I have been interested in FreeBSD and decided to give it a try, I am just a newbie! I have been using OpenBSD for a while on a rather recent laptop, and wish to dual boot it with FreeBSD as this OS does provide all the drivers I need (notably for my WiFi and Video Cards).

I have been used to set full device encryption under OpenBSD, and use GPT/EFI for my disk. I did found a nice guide about dualbooting FreeBSD/OpenBSD with full encryption, which worked like a charm. However the method described there (using boot0, to then chain to the respective bootloader and decrypt the respective partition) only applies to MBR scheme.
Thus, my consoles have the old-school 640x480 VGA resolution which is quite unpleasant.

Would there be a way to dualboot both systems using EFI/GTP scheme ? Preferably using BSD-available bootloaders.
I plan to use UFS for each system (GELI encryption for FreeBSD), with bsdlabels on each partition (even though not need with GPT, but OpenBSD uses them, so I am willing to keep things as symetric as possible)

Many thanks in advance
 
Hi again,

I finally worked it around using GRUB2. In case any one is interested in the future, here are the steps I followed:
- Install FreeBSD, using GPT.
I booted onto the install media, and went up to the disk partitionning, where I opened a shell.
I created an EFI partition, a bsdlabel slice for FreeBSD, and another one for OpenBSD.
Within the FreeBSD slice, I created a partition for the boot folder, a swap one, and a system one. I encrypted the system one using GELI. I attached it and created the filesystems on each of my partitions, copied the boot folder to the boot partition and filled the fstab file and loader.conf in the same manner as in the guide I posted.
After mounting the system FS, I returned to the graphical interface et completed the installation
- Copy the FreeBSD EFI launcher on the efi partition,
as it will be overwritten by OpenBSD
- Install OpenBSD :
I followed the guide I posted, excepted that I chose Whole GPT installation on the mounted softraid disk.
- Boot onto the FreeBSD install media,
rename the OpenBSD EFI launcher, as copy back the FreeBSD EFI launcher, giving him the default name (BOOTX64.EFI)
- Boot onto FreeBSD and install GRUB2
pkg install GRUB2 for EFI, then grub-install GRUB2 to the EFI partition. Be sure to select the x86-64-EFI target (check the options in the man page). In order to place all GRUB2 modules on the EFI partition, I specified to grub-install the path to the mounted EFI partition as both the boot folder location and the EFI partition (cf man page)
On the EFI partition, rename the GRUB EFI launcher as the default name (BOOTX64.EFI)
- Manually write the GRUB2 menu configuration,
with two entries, that chainloads either the FreeBSD EFI or the OpenBSD EFI

Notes : while searching, it turned out that I could use GRUB to directly load the FreeBSD kernel, as it supports FreeBSD GELI encryption. However, this was not an option with OpenBSD encryption. Hence I prefered to keep things symmetrical and chainload in both case
 
Back
Top