Grub2-efi

From wikinotes

Disk with grub not appearing as a choice from your BIOS? You probably have UEFI instead of a bios. Unless all of your OS's are already installed with EFI (requires guid/gpt), you're in configuration hell.


Install and Setup

This can be used alone if all of your installations have efi entries. This is the ideal situation. Chimera (OSX bootloader) uses MBR, in addition to my win7 install so this is the best route.

## Install dependencies:
sudo pacman -S grub2 dosfstools efibootmgr

## Create 200mb, bootable partition, fstype=ef
cfdisk /dev/sdb

## create filesystem
mkfs.msdos -F 32 /dev/sdb


## add fstab entry
#-------
# fstab
#
/dev/sdb1      /boot/efi    vfat   defaults   0 1
#-------

sudo mount /dev/sdb1


## Install grub2
sudo grub-install --target=x86_64-efi --efi-directory=/boot/efi 
	--bootloader-id=grub --recheck --debug --boot-directory=/boot/efi

sudo grub-mkconfig -o /boot/efi/EFI/grub/grub.cfg


standalone grub-efi

Grub is a winner of a bootloader, but if your UEFI still does not recognize the drive with grub as a bootable option, you can use gummiboot to chainload grub2.

pacman -S gummiboot
gummiboot -path=/boot/efi install


#### /boot/efi/loader/entries/grub.conf
title GRUB
efi /EFI/grub/grubx64.efi

### /boot/efi/loader/loader.conf
default grub


grub-efi + rEFInd

rEFInd is a boot manager rather than a bootloader. grub or something else will still be required to load the kernel, this tool just searches for drives that are bootable. rEFInd is almost the only bootmanager or bootloader that can load both MBR and UEFI. Currently EFI entries can have custom menu entries, but you have to rely on autodetection for BIOS entries.

This is unfortunate, but at least everything is in one menu now.

sudo pacman -S refind-efi
sudo refind-install


sudo pacman -Rs gummiboot


###/boot/efi/EFI/refind/refind.conf
#----------------------------------
scanfor hdbios,internal,manual
uefi_deep_legacy_scan true
#----------------------------------

sudo refind-install
# this should now detect the legacy bios entries for
#    OSX
#    Windows
# in addition to grub-uefi for booting linux


sudo reboot


Since rEFInd scans drives for bootloaders, it can be nice to declutter the menu a bit by removing grub from the mbr of drives you don't mean to boot from.

sudo dd if=/dev/zero of=/dev/sdX bs=446 count=1



future options

grub-efi can't chainload bios operating systems. gummiboot can only load efi entries

grub-bios can chainload both mbr and efi by just pointing at the disk. But grub-bios isn't automatically detected on boot from my Motherboard.

rEFInd can boot both bios entries and UEFI entries. It doesn't actually load kernels though.

So I'm hoping to use rEFInd to point to grub-bios which I can use to chainload anything.

(Edit) This didn't work. However refind seems to boot everything that I need just fine. I only need to figure out how to create a custom menu.