OpenBSD (U)EFI bootloader howto


Here's a quick howto of getting started with the new UEFI bootloader support in OpenBSD -current. This does assume the entire disk will be allocated by OpenBSD. Dual-booting in an UEFI setup requires extra steps which are not covered here.

By far the easiest method is to copy the miniroot58.fs to a USB stick and boot from it. This already includes an EFI boot partition so to be sure the BIOS can correctly boot the new bootloader, start by disabling the Legacy boot option in the BIOS.

Now boot from the USB device and you should be greeted by something like:

>> OpenBSD/amd64 EFIBOOT 3.29
boot>

Boot into the RAMDISK and opt for the (S)hell to prepare the disk with a special EFI system partition where the UEFI bootloader will be copied to after the installation.

Assuming the sd0 as being the target disk:

fdisk -i -b 960 sd0

Now run install and select the OpenBSD option at the fdisk question. In the disklabel editor partition as usual, but leave the i partition untouched. This is the EFI partition.

Install the sets as usual but don't reboot yet. Now, format the partition and copy the UEFI bootloader in place:

/mnt/sbin/newfs_msdos sd0i
mount /dev/sd0i /mnt2
mkdir -p /mnt2/efi/boot
cp /mnt/usr/mdec/BOOTX64.EFI /mnt2/efi/boot

That's it! Just reboot off the internal disk into the new UEFI bootloader.

Bonus: on some newer systems such as the Thinkpad X250 there's no inteldrm(4) available yet, so you're stuck with efifb(4). Instead of using the X11 VESA driver I've had better results with wsfb; edit /etc/X11/xorg.conf:

Section "Device"
  Identifier "default device"
  Driver "wsfb"
EndSection