onsdag 26 december 2012

Howto: Install rEFInd bootloader in gentoo linux.



# My hardware
Asus P8Z77-M PRO
Intel Core i5 3570K 3,4Ghz (Ivy Bridge)
Crucial 32GB (4x8192MB) CL9 1600Mhz Ballistix Sport

I follow this guide for refind http://www.rodsbooks.com/refind/installing.html#linux
 (Installing rEFInd Manually Using Linux)

I create gpt partitions with gparted live-cd (http://gparted.sourceforge.net/livecd.php )  and install gentoo with systemrescueCD  (http://www.sysresccd.org/SystemRescueCd_Homepage ) .

# IMPORTANT.
If systemrescuecd not find your uefi bios. You must put efi.shell on a usb with fat32.
wget https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2/EdkShellBinPkg/FullShell/X64/Shell_Full.efi
Rename Shell_Full.efi to shell.efi and put it in your usb.

You could also finish the install with refind and then wget efi.shell to /boot/efi and chroot back in with uefi support.
And then create boot command with efibootmgr.

# IMPORTANT.
Refind find most of the settings automatic if you have bzImage or vmlinuz in kernel name.
(check my config at the end)
You have to call your kernel bzImage-3.6.8-blabla or vmlinuz-3.6.8 with this guide.
(No need for .efi at the end of kernelname)

# IMPORTANT.
Modprobe efivars before chroot.
modprobe efivars

# Tools we need are.
efibootmgr wget unzip

# 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"

# Guide starts here ---------------------------------------------

# I create a fat32 partition and i made it 500mb

# When its time to mount your partitions to /mnt/gentoo.

Create you other dirs for gentoo and /boot/efi and mount them
mkdir -p /boot/efi
mount /dev/sda1 /mnt/gentoo/boot/efi

# When your ready to install refind efi to /boot/efi/EFI/refind
mkdir -p /boot/efi/EFI/refind

# I wget refind to my / with this command. Choose the version you want to use.
wget http://sourceforge.net/projects/refind/files/0.5.0/refind-bin-0.5.0.zip

unzip refind-bin-0.5.0.zip
cd refind-bin-0.5.0
and cd to refind dir inside refind-bin-0.5.0

cp -r icons /boot/efi/EFI/refind/icons
cp refind.conf.sample /boot/efi/EFI/refind/refind.conf
cp refind_x64.efi /boot/efi/EFI/refind/refind_x64.efi

cd /boot/efi/EFI/refind
and edit refind.conf

# The only settings i have is this and remove # at those lines.
timeout 4
UPDATE=in refind 6.5 are
"scan_all_linux_kernels" not disabled, do that if you not want to have double entrys of your kernel.Like this.
#scan_all_linux_kernels

#scanfor internal,external,optical,manual
add manual for one entry.

#showtools shell,exit,reboot,shutdown

# Add this to your config at the bottom (change to your needs).
Put stuff you need in options line - quiet elevator=noop.

menuentry "Gentoo" {
                icon   \EFI\refind\icons\os_gentoo.icns
loader \vmlinuz-3.6.8
  options "ro root=/dev/sda2"
}

menuentry Gentoo { icon EFI/refind/icons/os_gentoo.png loader \vmlinuz-linux.efi initrd \initramfs-linux.img options "ipv6.disable=1 rootfstype=ext4 root=/dev/mapper/vgroup-root cryptdevice=/dev/disk/by-uuid/07c22f21-1269-4fad-b4b2-8cbbf1daeece:lvm:allow-discards" }

# IMPORTANT.
DONT FORGET TO CP YOU KERNEL TO /boot/efi.
NOT TO /boot/efi/EFI

# IMPORTANT.
Everytime you upgrade your kernel you have to copy it manually to /boot/efi and change refind.conf to reflect the new kernel.

# Create /etc/mtab
grep -v rootfs /proc/mounts > /etc/mtab

# Now its time to add refind to efibootmgr with this command.
Taken from https://wiki.archlinux.org/index.php/UEFI_Bootloaders#Using_rEFInd.
Change /sdabcd for your needs and -p 12345 for your partition.
I use /dev/sda1.

efibootmgr -c -g -d /dev/sda -p 1 -w -L "rEFInd" -l '\EFI\refind\refind_x64.efi'

# Check if ok with command.
efibootmgr

Output .

BootCurrent: 0000
Timeout: 0 seconds
BootOrder: 0000,0001,0003,0004
Boot0000* rEFInd

Reboot.

When you login. Your screen should look like this.
http://www.rodsbooks.com/refind/

croutch












Inga kommentarer:

Skicka en kommentar