gpart rewrites pmbr in a way which breaks Win 7 EFI bootloader
Lawrence Stewart
lstewart at freebsd.org
Fri Aug 10 10:14:17 UTC 2012
On 10/08/2012 12:13 PM, Lawrence Stewart wrote:
[snip]
> Taking my desired HP configuration as the example:
>
> - Win 7 installed as an EFI boot source
>
> - FreeBSD doesn't have EFI boot support, so it has to be installed to
> boot via pmbr bootcode + gpt(zfs)boot in a freebsd-boot GPT partition
>
> - In the HP's firmware config, I choose whether to try boot from EFI or
> "legacy" (BIOS) sources first. Currently I try from EFI first.
>
> - In this arrangement, the firmware starts in EFI mode and will always
> boot Win 7 as it's the only bootable EFI payload installed.
>
> - Using the F9 key on boot, I get a menu to choose the boot source, and
> with FreeBSD installed to boot via pmbr bootcode + gpt(zfs)boot, the
> only way to get FreeBSD to start is to select "Legacy HDD" as the boot
> source, which switches firmware to BIOS and boots from the bootcode in
> the pmbr, which in turn executes gpt(zfs)boot from the freebsd-boot GPT
> partition.
I just wanted to confirm for posterity's sake that as of a few hours
ago, the above set up does actually work. I have Win 7 installed using
GPT + EFI boot. I booted into a FreeBSD 9.1 CD live filesystem and used
"gpart -b /boot/pmbr -p /boot/gptzfsboot -i 6 raid/r0" to install first
stage boot code into the pmbr and second stage boot code into my
freebsd-boot GPT partition. I installed a ZFS-based FreeBSD set up into
it's own GPT partition. I then tweaked the pmbr using my dd + vim trick
to unset the active flag.
I can now boot successfully from Win 7 EFI bootloader or, if I select
"Legacy HDD" from my HP's boot menu, it will happily boot my FreeBSD
install from the kernel living in my ZFS root.
It's good to confirm this actually works as I expected it would, but I
guess we need to make some changes in order to address this issue
completely, including all the edge cases.
Cheers,
Lawrence
More information about the freebsd-fs
mailing list