The Funtoo Linux project has transitioned to "Hobby Mode" and this wiki is now read-only.
Difference between revisions of "UEFI Install Guide"
Line 1: | Line 1: | ||
T | |||
=== Grub method === | === Grub method === |
Revision as of 20:36, November 18, 2014
T
Grub method
Unmask Grub 2.02_beta2
Unmask the latest version of GRUB by placing this in your /etc/portage/package.unmask
:
sys-boot/grub
The 2.00 version of GRUB has known issues with UEFI booting. Using 2.02 is essential for having this boot method work reliably.
Emerging GRUB
You will still use GRUB as a boot loader, but before emerging grub, you will need to enable EFI booting. To do this, add the following line to /etc/portage/make.conf:
GRUB_PLATFORMS="efi-64"
Then, emerge grub. You will notice efibootmgr getting pulled in as a dependency. This is expected and good.
Installing GRUB
Now, for the magic of getting everything in place for booting. You should copy your kernel and initramfs (if you have one -- you will if you are following the default install) to /boot. GRUB will boot those. But how do we get UEFI to boot GRUB? Well, we need to run the following command:
root # grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id="Funtoo Linux [GRUB]" --recheck /dev/sda
This command will simply install all the stuff to /boot/EFI and /boot/grub that your system needs to boot. In particular, the /boot/EFI/grub/grubx64.efi file will be created. This is the GRUB boot image that UEFI will load and start.
A more detailed explanation of the flags used in the above command:
--target=x86_64-efi
: Tells GRUB that we want to install it in a way that allows it to boot in UEFI--efi-directory=/boot
: All GRUB UEFI files will be installed in /boot--bootloader-id="Funtoo Linux [GRUB]"
: This flag is not necessary for GRUB to boot. However, it allows you to change the text of the boot option in the UEFI BIOS. The stuff in the quotes can be set to anything that you would like.--recheck
: If a device map already exists on the disk or partition that GRUB is being installed on, it will be removed./dev/sda
:The device that we are installing GRUB on.
Configuring GRUB
OK, now UEFI has the GRUB image it needs to boot. But we still need to configure GRUB itself so it finds and boots your kernel and initramfs. This is done by performing the following steps. Since boot-update doesn't yet support UEFI, we will use boot-update, but then edit our /boot/grub/grub.cfg
to support UEFI booting.
First, you will need to edit /etc/boot.conf
. Format this as you would if you were booting without UEFI. If you are not sure how this should look, below is an example of what it could look like if you are booting from an unencrypted ext4 partition:
/etc/boot.conf
boot {
generate grub
default "Funtoo Linux"
timeout 3
}
"Funtoo Linux" {
kernel vmlinuz[-v]
params += rootfstype=ext4 root=/dev/sda2
}
After you have edited your /etc/boot.conf
file, run boot-update
. If you check your /boot/grub/grub.cfg
now, you should see something like this:
/boot/grub/grub.cfg
set timeout=3
insmod part_gpt
insmod fat
set root=(hostdisk//dev/sda,gpt1)
search --no-floppy --fs-uuid --set 3CFD-6884
if loadfont /grub/unifont.pf2; then
set gfxmode=text
insmod gfxterm
insmod vbe
terminal_output gfxterm
fi
set menu_color_normal=cyan/blue
set menu_color_highlight=blue/cyan
menuentry "Funtoo Linux - vmlinuz-3.16.3" {
insmod part_gpt
insmod fat
set root=(hostdisk//dev/sda,gpt1)
search --no-floppy --fs-uuid --set 3CFD-6884
linux /vmlinuz-3.16.3 video=uvesafb:1920x1080-32,mtrr:3,ywrap rootfstype=ext4 root=/dev/sda2
set gfxpayload=text
}
set default=0
To get your /boot/grub/grub.cfg
to support booting with UEFI, make your /boot/grub/grub.cfg
look like this:
/boot/grub/grub.cfg
set timeout=3
insmod part_gpt
insmod fat
insmod efi_gop
insmod efi_uga
set root=(hostdisk//dev/sda,gpt1)
search --no-floppy --fs-uuid --set 3CFD-6884
if loadfont /grub/unifont.pf2; then
set gfxmode=auto
insmod gfxterm
insmod vbe
terminal_output gfxterm
fi
set menu_color_normal=cyan/blue
set menu_color_highlight=blue/cyan
menuentry "Funtoo Linux - vmlinuz-3.16.3" {
insmod part_gpt
insmod fat
set root=(hostdisk//dev/sda,gpt1)
search --no-floppy --fs-uuid --set 3CFD-6884
linux /vmlinuz-3.16.3 video=uvesafb:1920x1080-32,mtrr:3,ywrap rootfstype=ext4 root=/dev/sda2
set gfxpayload=keep
}
set default=0
The lines that we have added and altered do the following:
insmod efi_gop
andinsmod efi_uga
: Both of these involve adding support for the UEFI framebuffer to GRUB.set gfxmode=auto
: Instead of having the GRUB boot option screen being displayed at the smallest resolution possible, changing this to auto will make it fit the resolution of your display.
Known Issues
- With pure UEFI boot mode, with legacy mode disabled, following error expected:
- video driver not supported, boot hangs, hard reboot required.
- Choose UEFI first, next legacy driver. It depends on motherboard vendor and efi bios version.
- In UEFI bios choose grub option, if your succeeded with above guide, additional menu should appear in Boot Menu, otherwise it boots into EFI shell:
grub:NAME of you hard drive
- In UEFI bios choose grub option, if your succeeded with above guide, additional menu should appear in Boot Menu, otherwise it boots into EFI shell:
- On some systems, installing the packages that are required for UEFI booting with any gcc later than a 4.x.x release may lead to a black screen after the GRUB screen. To fix this, before you begin installing any packages on your system, emerge =gcc-4.6.4-r2 and proceed with the installation as usual. Remember to switch your compiler back to the version of gcc that came with your system after you have finished installing. To do this, use
gcc-config 2
. This problem can also be fixed by following the Efi Stub guide instead of the GRUB one.
Done!
Remember to follow all other steps in the regular Funtoo Install Guide. Assuming you did everything correctly, your system should now boot via UEFI! We will be adding UEFI support to boot-update soon to make this process easier.