# Does Freebsd support direct UEFI booting?



## justinnoor (Dec 13, 2018)

The Freebsd Handbook, section 12.2 on the boot process, contains a note that seems to state that Freebsd does not support direct UEFI booting. 

The concern is that on our two Freebsd machines, the BIOS are set for UEFI.

The note reads:



> FreeBSD provides for booting from both the older MBR standard, and the newer GUID Partition Table (GPT).  GPT partitioning is often found on computers with the Unified Extensible Firmware Interface (UEFI). However, FreeBSD can boot from GPTpartitions even on machines with only a legacy BIOS with gptboot(8). Work is under way to provide direct UEFI booting.



Can anyone shed some light on this? Thanks in advance.


----------



## k.jacker (Dec 13, 2018)

That means that you can boot in legacy mode, which is to install a freebsd-boot partition (instead of EFI) and a fake MBR (called a protective (p)MBR).
This applies only to GPT partitioning schemes.
One can then switch the to CSM booting in the BIOS/UEFI and boot in legacy mode.
Assuming your EFI partition is ada0p1 on a drive, then the following will install the legacy bootcode:

```
# gpart delete -i1 ada0
# gpart create -t freebsd-boot -s 512k ada0
# gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot
```


----------



## Emrion (Dec 13, 2018)

> I’m currently running two Freebsd machines that are booting directly with UEFI


Seems you answered to your own question.

A default installation makes an efi partition and a freebsd-boot one. The first is used if the machine starts with efi, the second if it starts under legacy BIOS.

```
gpart show
=>      40  41942960  ada0  GPT  (20G)
        40    409600     1  efi  (200M)
    409640      1024     2  freebsd-boot  (512K)
    410664       984        - free -  (492K)
    411648   4194304     3  freebsd-swap  (2.0G)
   4605952  37335040     4  freebsd-zfs  (18G)
  41940992      2008        - free -  (1.0M)
```

So you can boot either in efi and legacy BIOS.


----------



## justinnoor (Dec 13, 2018)

Emrion said:


> Seems you answered to your own question.



Lol. I was concerned about my BIOS settings. They are set for UEFI. But I get it now. Thank you.


----------

