Skip to content

UEFI GPT Booting

Lucas Holt edited this page Jan 17, 2024 · 7 revisions

Complications with MidnightBSD booting on modern hardware.

MidnightBSD 2.x has support for booting off GPT partitions in a UEFI system. There are some caveats, though.

The installer does not copy the bootloader to your system EFI partition. You need to do this manually.

You can boot MidnightBSD with CSM enabled in the BIOS without doing this step. When using CSM, the mnbsd-boot partition is used instead.

Windows / MidnightBSD dual boot with 2 SSDs

For example, say you have an AMD Ryzen 3950x with a 6900XT. You want to dual-boot MidnightBSD and Windows 11 on the system using 2 SSDs.

Install Windows 11 first.

Install MidnightBSD with GPT.

Boot into MidnightBSD.

We mount the EFI partition on /boot/efi similarly to Linux.

mkdir /boot/efi
echo '/dev/ada0p1 /boot/efi msdosfs rw,noatime 0 0' >> /etc/fstab
mount /boot/efi

Install the MidnightBSD UEFI loader.

mkdir /boot/efi/EFI/midnightbsd
cp /boot/boot1.efi /boot/efi/EFI/midnightbsd/bootx64.efi

NOTE: for older installs (e.g. MidnightBSD 2.x)

mount -t msdosfs /dev/partition-name /mnt
cp /boot/loader.efi /mnt/efi/boot/bootx64.efi
umount /mnt

You must also register this with efibootmgr or using another tool in windows.

You can do this much easier in Windows 11. Download a tool called Hasleo EasyUEFI.

Create a new menu entry for MidnightBSD that points to EFI/midnightbsd/bootx64.efi

Install rEFInd by using the EasyUEFI tool. Upload it to EFI/refind. Create a menu entry pointed at the rEFInd x64 boot file. Set that as the FIRST entry in the boot manager editor screen in EasyUEFI.

Now rEFInd will find MidnightBSD and Windows and let you choose between them.

This also allows you to disable CSM on some motherboards in UEFI. By doing this, you can enable rebar/SAM to get full speed out of your AMD, nvidia or Intel graphics adapter in Windows.

Linux/BSD setup option Here are instructions from a blog post on doing this in Linux/FreeBSD env.

Create the boot variable.

efibootmgr -c -l /boot/efi/EFI/midnightbsd/bootx64.efi -L "MidnightBSD"

Check the variable number for the new boot variable and activate it.

efibootmgr efibootmgr -a 15

Change the boot order to leave Debian and GRUB in charge.

efibootmgr -o 14,15

More resources on rEFInd

General YouTube videos about installing it. (doesn't focus on BSD, though)

https://www.youtube.com/watch?v=xRZab8yrSOQ&t=238s

https://www.youtube.com/watch?v=WCK9WS7_KmE

https://www.youtube.com/watch?v=bg0BV5ZJCZU

Clone this wiki locally