# 10.3 - UEFI - multiboot



## mickey (Apr 29, 2016)

I was wondering if anyone has managed to get FreeBSD's boot1.efi to boot from an entry in the Windows Boot Manager? On MBR based systems, a similar setup used to work by using a 'Real mode boot sector' entry, which obviously seems not appropriate for an UEFI system.

I did a manual installation (via shell) of FreeBSD 10.3-RELEASE amd64 UEFI onto the freebsd-zfs and freebsd-swap GPT partitions that I had already created. Manually copied the boot1.efi file to the ESP partition as /EFI/FreeBSD/boot1.efi. So now FreeBSD is installed nicely alongside Windows 7 and Windows 10.

After some fiddling with the Windows `bcdedit` tool, I also managed to create a second firmware bootmanager entry for FreeBSD, so that it can now be started from the UEFI boot selector (which is available on my mainboard by pressing F8 during POST). Of course it would be much nicer to start FreeBSD from the Windows Boot Manager and not having to race for pressing F8 at the right time. But so far all my attempts to do so ended up with an error screen, telling me some error status (supposedly from \EFI\FreeBSD\boot1.efi).

Did anyone have more success on this matter? After all the Windows Boot Manager *should* be able to execute an EFI executable, as the Windows boot loader (Winload.efi) seems to be an EFI executable by itself.


----------



## wblock@ (Apr 29, 2016)

My newish Dell lets you add another UEFI entry in the BIOS, and set the order of them.  So I copied /boot/boot1.efi to /EFI/BOOT on the EFI partition and used that.  This avoids modifying any of the Windows files.


----------



## mickey (Apr 29, 2016)

wblock@ said:


> My newish Dell lets you add another UEFI entry in the BIOS, and set the order of them.  So I copied /boot/boot1.efi to /EFI/BOOT on the EFI partition and used that.  This avoids modifying any of the Windows files.


Unfortunately my UEFI BIOS Setup only lets you modify the order of boot entries, but not add new ones. My understanding is that `bcdedit` operates upon both the BCD store (presumably stored on the MSR partition) and the UEFI NVRAM settings. So what I did to create a second UEFI boot entry was essentially this:

```
bcdedit /copy {bootmgr} /d "FreeBSD"
bcdedit /set {<obtained-GUID>} device partition=\Device\HarddiskVolume1
bcdedit /set {<obtained-GUID>} path \EFI\FreeBSD\boot1.efi
bcdedit /deletevalue {<obtained-GUID>} default
bcdedit /deletevalue {<obtained-GUID>} timeout
bcdedit /deletevalue {<obtained-GUID>} resumeobject
bcdedit /deletevalue {<obtained-GUID>} displayorder
bcdedit /deletevalue {<obtained-GUID>} toolsdisplayorder
```
So now the corresponding entries look like this:

```
Firmware Boot Manager
---------------------
identifier  {fwbootmgr}
displayorder  {bootmgr}
  {f4254db9-0bae-11e6-bddd-1c872c606d1f}
  {f4254db8-0bae-11e6-bddd-1c872c606d1f}
  {00b21cb4-bb04-11e5-b760-f60506de0419}
timeout  1

Windows Boot Manager
--------------------
identifier  {bootmgr}
device  partition=\Device\HarddiskVolume1
path  \EFI\MICROSOFT\BOOT\BOOTMGFW.EFI
description  Windows Boot Manager
locale  en-US
inherit  {globalsettings}
default  {default}
resumeobject  {00b21cbb-bb04-11e5-b760-f60506de0419}
displayorder  {default}
  {current}
toolsdisplayorder  {memdiag}
timeout  30

Windows Boot Manager
--------------------
identifier  {f4254db9-0bae-11e6-bddd-1c872c606d1f}
device  partition=\Device\HarddiskVolume1
path  \EFI\FreeBSD\boot1.efi
description  FreeBSD
locale  en-US
inherit  {globalsettings}

Firmware Application (101fffff)
-------------------------------
identifier  {00b21cb4-bb04-11e5-b760-f60506de0419}
description  Hard Drive

Firmware Application (101fffff)
-------------------------------
identifier  {f4254db8-0bae-11e6-bddd-1c872c606d1f}
description  Hard Drive
```
When I now press F8 during POST, I get to choose between "Windows Boot Manager" and "FreeBSD" (or alternatively by entering Setup and selecting it there from the list of boot entries).

But for the boot entry to appear in the Windows Boot Manager, one would need an entry similar to the one that is used boot Windows 7 or Windows 10 adopted to load \EFI\FreeBSD\boot1.efi instead of \Windows\system32\winload.efi:

```
Windows Boot Loader
-------------------
identifier  {current}
device  partition=C:
path  \Windows\system32\winload.efi
description  Windows 7
locale  en-US
inherit  {bootloadersettings}
recoverysequence  {00b21cb9-bb04-11e5-b760-f60506de0419}
recoveryenabled  Yes
osdevice  partition=C:
systemroot  \Windows
resumeobject  {00b21cb7-bb04-11e5-b760-f60506de0419}
nx  OptIn
novesa  Yes
```
All my attempts to do so have however been unsuccessful so far.


----------

