# Installing FreeBSD on UEFI



## Z4kW0lf (Dec 25, 2012)

Hello everyone, it's my first post on the FreeBSD forums and also my first try at installing FreeBSD.
I have an AsRock Z77 Pro3 motherboard, which has got UEFI support.
My disk is partitioned as GPT, with this layout:
/dev/sda1 - EFI System Partition, which contains the rEFInd bootloader, the Win7 loader files and the Parabola kernel and initramfs.
/dev/sda2 - Win7 Partition
/dev/sda3 - Microsoft Reserved Partition
/dev/sda4 - Parabola GNU/Linux /boot partition.
/dev/sda5 - Parabola GNU/Linux / partition.

I want to install FreeBSD alongside Parabola and Win7. However, I cannot go back to MBR because I need more than 4 partitions. I have googled a lot and found basically nothing: some say that FreeBSD still has no UEFI support, some say that they've managed to boot on UEFI but not how.
So...*is there a way to install FreeBSD in a GPT partition layout, booting via UEFI?*


----------



## wblock@ (Dec 25, 2012)

FreeBSD 9 and up default to a GPT disk partitioning scheme.

Why not just install FreeBSD in another two or three GPT partitions and try it?  Your boot manager supports multi-booting now, you'll have to figure out how to add another choice to boot from the FreeBSD partition.  As always, multi-booting is fragile and installing a new operating system can overwrite some of the existing partitions.  Back up first, all of it.


----------



## Z4kW0lf (Dec 25, 2012)

To add new GNU/Linux systems, I just move the bzImage of the Linux kernel to a subfolder of the EFI system partition and rename it vmlinuz-distroname.efi. And it works.
It's THAT easy in FreeBSD?
If so, how can I make it boot in UEFI mode from an USB stick? dd from Arch only boots in BIOS, so does with Win32 Image creator and if I just copy everything from the img to the USB key.


----------



## wblock@ (Dec 25, 2012)

Z4kW0lf said:
			
		

> To add new GNU/Linux systems, I just move the bzImage of the Linux kernel to a subfolder of the EFI system partition and rename it vmlinuz-distroname.efi. And it works.
> It's THAT easy in FreeBSD?



I don't know.  I have a couple of systems that can be upgraded to a UEFI BIOS, but haven't done so because it's not clear whether it's possible to go back.

It may have to chain-boot, loading the FreeBSD boot loader... if that's possible with UEFI.


----------



## Z4kW0lf (Dec 25, 2012)

OK. I have installed FreeBSD. Now I have two new partitions:
/dev/sda6 - 64KB freebsd-boot partition.
/dev/sda7 - 10GB freebsd-ufs partition.
However, I still don't know how to make it boot. The rEFInd site does not mention BSD and googling for "refind bsd" does not give any useful resources. I can't browse UFS partitions from Parabola...What should I do?


----------



## wblock@ (Dec 25, 2012)

The installer CD has a shell mode that could be used to copy the kernel.  No idea what the boot manager needs or can do.


----------



## tingo (Dec 26, 2012)

Do you have a key to get a boot menu (often F12) in your UEFI? If so, can you boot from sda6?
If FreeBSD boots - problem solved.


----------



## Z4kW0lf (Dec 26, 2012)

tingo said:
			
		

> Do you have a key to get a boot menu (often F12) in your UEFI? If so, can you boot from sda6?
> If FreeBSD boots - problem solved.


I have a boot menu(F11) but I can only boot rEFInd, any removable drive that I plug in, or the disc in the drive. Or the HDD's MBR, but since it's partitioned as GPT...


			
				wblock@ said:
			
		

> The installer CD has a shell mode that could be used to copy the kernel.  No idea what the boot manager needs or can do.



Ehm...where is the kernel located?:r


----------



## wblock@ (Dec 26, 2012)

/boot/kernel/kernel


----------



## SirDice (Dec 27, 2012)

You can't UEFI boot FreeBSD, not yet at least. The BIOS/UEFI needs to use the fall-back BIOS boot in order to boot FreeBSD.


----------



## Z4kW0lf (Dec 27, 2012)

So...since I am on GPT, there's no hope?


----------



## kpa (Dec 27, 2012)

Is installing FreeBSD on VirtualBox that runs on one of your already installed OSes out of the question?


----------



## SirDice (Dec 28, 2012)

Set your UEFI to boot both ways, I have Windows 7 on GPT with UEFI boot and FreeBSD with BIOS fall-back booting. I have to use the UEFI/BIOS boot selector to boot either one. I haven't been able to get it working with rEFIt/rEFInd.


----------



## tingo (Dec 29, 2012)

I have one machine which has a broken UEFI - it assumes that a GPT partitioned disk must have at least one EFI system partition on it, or it won't boot from that disk.
My workaround: I use a usb memory stick (MBR partitioned) to boot from, then I use the boot menu on that to select the partition to boot from. 
Not ideal, but it works.


----------



## SirDice (Dec 31, 2012)

GPT creates a 'fake' MBR partition. If that MBR partition is marked active I can't UEFI boot Windows anymore. Had to resort to manually editing the partition table to get rid of that active bit (none of the tools allowed me to 'unset' it).


----------

