As an old fart with MBR hardwired into my brain, I'm not sure I
understand how booting from a GPT partitioned disk works now.
So, I had to (note: "had to", not "wanted to") install Windows 8.1 on my
machine. I had a dual boot Gentoo/Windows7 before that. So I did a
backup, wiped the Windows7 partition, and then ran the W8.1 install
(from a USB flash drive.)
Windows complained that it can't install into MBR partitioned disks on
EFI systems. So I booted Gentoo again, and converted my disk to GPT
(with sys-apps/gptfdisk.) I backed up my MBR partition table before of
course (with dd). I wasn't sure whether I needed an EFI BIOS boot
partition (ID ef02), so I created one just to be safe by shrinking my
swap partition by 100MB and giving that space to a new ef02 partition.
This new partition ended up as /dev/sda5 and I formatted it with a FAT32
filesystem.
So far so good. Now what happens with grub-install? I wasn't sure
whether I needed to do:
grub-install /dev/sda5
or:
grub-install /dev/sda
So I did both. Note: I'm using grub-0.97-r13 and Gentoo ships it with
GPT support.
I tested it, and it booted OK. So far so good.
Now I installed Windows 8.1. It took the free space of the Windows 7
partition I had wiped, and created a bunch of new ones, including an EFI
boot partition (ID ef00).
After that, grub didn't show up anymore. So I booted from a sysrescuecd
USB stick into my Gentoo, and ran this again:
grub-install /dev/sda5
grub-install /dev/sda
Now the system boots into grub again, unless I press F11 at the POST
screen and tell my EFI firmware to load the "Windows Boot Loader" instead.
I'm very, very confused by all this. The EFI boot partition (ef00)
created by Windows is not empty; it contains the Windows EFI boot
loader. The EFI BIOS boot partition I created myself (ef02) is still
empty; grub-install /dev/sda5 didn't seem to put anything in it.
So what the hell does grub-install do? How is my system able to boot
into grub at all? And, most importantly, how do I boot Windows 8 from
grub now?