Changes

Jump to: navigation, search

UEFI Install Guide

6,425 bytes removed, 4 years ago
Grub method
{{Note|This material has been integrated into the main [[Funtoo Linux Installation]] guide, so please look at that guide if you are installing Funtoo Linux. Editors: this page still contains some good content that we might want to move over there.}} This tutorial will show you how to install Funtoo on a UEFI system. UEFI, also known as the [[Wikipedia:Unified Extensible Firmware Interface|Unified Extensible Firmware Interface]], is a new firmware interface that is used on some newer computers as a replacement for the traditional PC BIOS. It has an integrated boot loader, so setting up booting is different.
This tutorial is meant to be an "overlay" over the Regular Funtoo Installation. Follow the normal installation and only follow steps in this tutorial when dealing with partitioning and configuring the boot loader (GRUB). All steps are otherwise identical to the regular installation process.
If you have that option enabled, ''you must also enable'':
{{kernelop|title=Device Drivers,Graphics support,Frame buffer Devices,Support for frame buffer devices|desc=
[*] Simple framebuffer support
}}
This is the preferred method of using the EFI framebuffer, the efifb and uvesafb drivers will be used as a fallback if the above is not compatible.
 
== Boot Loader ==
=== EFI Stub method ===
Instead of bothering with the installation of GRUB, you can consider using the UEFI firmware of your computer to boot your kernel.
 
==== Kernel Configuration ====
To prepare your kernel to boot with EFI stub, make sure that the following options are built in to your kernel:
{{kernelop|title=Processor type and features|desc=
[*] EFI runtime service support
[*] EFI stub support
[ ] EFI mixed-mode support
 
[*] Built-in kernel command line
(kernel options that you want to pass go here)
}}
{{note|Commands that you would normally pass, such as, <code>video{{=}}uvesafb:1920x1080-32,mtrr:3,ywrap</code>, should be put here. In other words, anything that you would normally add to <code>/etc/boot.conf</code> after <code>params +{{=}}</code> should be added to the built-in kernel command line as well.}}
 
If your system requires an initramfs to boot, do not worry, you can build that in to the kernel. One thing that you should know, however, is that the kernel only takes plaintext and <code>.cpio</files> for initramfs source files. Therefore, if you use an application to generate an initramfs for you, make sure that it does not use gzip compression:
{{kernelop|title=General setup|desc=
[*] Initial RAM filesystem and RAM disk (initramfs/initrd) support
(/path/to/initramfs/file.cpio)
}}
 
==== Building and installing the kernel ====
After you have configured your kernel, build it, install it to <code>/boot</code>, and then create a copy of the image to store in the EFI boot directory:
<console>
###i## pwd
/usr/src/linux
###i## make -jn
###i## make -jn install modules_install
###i## mkdir -vp /boot/EFI/Boot
###i## cp -v /boot/ vmlinuz-x.x.x /boot/EFI/Boot/bootx64.efi
<console>
When you have finished all of this, you should be able to reboot.
 
=== Grub method ===
==== 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 <tt>/etc/portage/make.conf</tt>:
 
<pre>
GRUB_PLATFORMS="efi-64"
</pre>
 
Then, <tt>emerge grub</tt>. You will notice <tt>efibootmgr</tt> 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 <tt>/boot</tt>. GRUB will boot those. But how do we get UEFI to boot GRUB? Well, we need to run the following command:
 
<console>
# ##i##grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id="Funtoo Linux [GRUB]" --recheck /dev/sda
</console>
This command will simply install all the stuff to <tt>/boot/EFI</tt> and <tt>/boot/grub</tt> that your system needs to boot. In particular, the <tt>/boot/EFI/grub/grubx64.efi</tt> 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:
* <code>--target=x86_64-efi</code>: Tells GRUB that we want to install it in a way that allows it to boot in UEFI
* <code>--efi-directory=/boot</code>: All GRUB UEFI files will be installed in ''/boot''
* <code>--bootloader-id="Funtoo Linux [GRUB]"</code>: 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.
* <code>--recheck</code>: If a device map already exists on the disk or partition that GRUB is being installed on, it will be removed.
* <code>/dev/sda</code>: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 <code>/boot/grub/grub.cfg</code> to support UEFI booting.
 
First, you will need to edit <code>/etc/boot.conf</code>. 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:
 
{{file|name=/etc/boot.conf|desc=|body=
boot {
generate grub
default "Funtoo Linux"
timeout 3
}
 
"Funtoo Linux" {
kernel vmlinuz[-v]
params += rootfstype=ext4 root=/dev/sda2
}
}}
 
After you have edited your <code>/etc/boot.conf</code> file, run <code>boot-update</code>. If you check your <code>/boot/grub/grub.cfg</code> now, you should see something like this:
 
{{file|name=/boot/grub/grub.cfg|desc=|body=
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 <code>/boot/grub/grub.cfg</code> to support booting with UEFI, make your <code>/boot/grub/grub.cfg</code> look like this:
{{file|name=/boot/grub/grub.cfg|desc=|body=
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:
* <code>insmod efi_gop</code> and <code>insmod efi_uga</code>: Both of these involve adding support for the UEFI framebuffer to GRUB.
* <code>set gfxmode=auto</code>: 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:
*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: <code>grub:NAME of you hard drive</code>
* 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 <code>gcc-config 2</code>. This problem can also be fixed by following the [[Efi Stub guide]] instead of the GRUB one.
=== Done! ===
Bureaucrats, Administrators, wiki-admins, wiki-staff
6,213
edits

Navigation menu