lördag 7 september 2013

Howto: Install grub2 with "uefi" in gentoo linux.


I used refind bootloader as my boot-tool in a very long time. But i had very much trouble with it in the end
and switch over to grub2 instead. And i never had any boot problem at all since then.

I create  my partitions with  http://gparted.sourceforge.net/livecd.php and i use GPT partitions.
You must go to advanced mode and change to gpt before you create your partitions.
I have like this:
bios_grub 50M = vfat = Set bios_grub flag after creation of the partitions.
/boot/efi 512M = vfat = Set boot flag after creation of the partitions.
/
/home

# Before chroot
modprobe efivars


# EFI kernel settings

CONFIG_EFI=y
CONFIG_FB_EFI=y
CONFIG_FRAMEBUFFER_CONSOLE=y
CONFIG_EFI_PARTITION=y
CONFIG_EFI_VARS=y
CONFIG_EFI_STUB=y

Optional- I not use these two
CONFIG_RELOCATABLE=y
CONFIG_CMDLINE="root=/dev/sda3"

Install gentoo the way you do and when you chrooted in and are to install grub2.

Set:
grep -v rootfs /proc/mounts > /etc/mtab

Set GRUB_PLATFORMS in /etc/portage/make.conf (optional). If unset, grub will guess which platform you want. It guesses "pc" for x86 / amd64.

# UEFI on amd64
GRUB_PLATFORMS="efi-64"

# UEFI and PC
GRUB_PLATFORMS="efi-64 pc"

echo 'LABEL=efi-boot /boot/efi vfat defaults 0 2' >> /etc/fstab
root #
mount /boot/efi
root #
mkdir -p /boot/efi/{EFI/BOOT,GRUB}

emerge --ask sys-boot/grub

grub2-install --target=x86_64-efi --efi-directory=/boot/efi --boot-directory=/boot/efi

grub2-mkconfig -o /boot/efi/GRUB/grub.cfg

 ----------------------------------------------------------------------------------------------------------------------

 "OBS" Grub2 has change name to grub.

If you already sit with grub2 and want to switch to new grub instead just remove GRUB2DIR in /boot/efi/GRUB2.

mkdir -p /boot/efi/grub

And install 
emerge --ask sys-boot/grub
grub2-install --target=x86_64-efi --efi-directory=/boot/efi --boot-directory=/boot/efi

grub2-mkconfig -o /boot/efi/GRUB/grub.cfg

Done

 ----------------------------------------------------------------------------------------------------------------------------
sources
http://wiki.gentoo.org/wiki/GRUB2#UEFI.2FGPT
http://wiki.gentoo.org/wiki/GRUB2_Quick_Start



croutch

Inga kommentarer:

Skicka en kommentar