Difference between pages "Install/Scraps" and "UEFI Install Guide"

From Funtoo
< Install(Difference between pages)
Jump to navigation Jump to search
 
 
Line 1: Line 1:
{{Note|This page contains scraps that were removed from the Install Guide to preserve the Install Guide's simplicity. We need to find new ways to integrate this content. Or in some cases, this is just random stuff I removed that can be thrown away.}}
{{Note|This material has been integrated into the main install guide, but still contains some good content that we might want to move over there.}}


If you have a system with UEFI, you will want to use this documentation along with the [[UEFI Install Guide]], which will augment these instructions and explain how to get your system to boot. You may need to change your PC BIOS settings to enable or disable UEFI booting. The [[UEFI Install Guide]] has more information on this, and steps on how to determine if your system supports UEFI.
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.  


We also offer a [[ZFS Install Guide]], which augment the instructions on this page for those who want to install Funtoo Linux on ZFS. I
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.


New  [[F2FS Install Guide]] is in progress  which will augment the instructions on this page for those who want to install Funtoo Linux on F2FS.
== What Are We Doing? ==


This guide will show you how to set up your UEFI system to load the GRUB boot loader, which will then load your Funtoo Linux kernel and initramfs. This is the "UEFI + GRUB" method as described on the [[Boot Methods]] page.


==== Partitions ====
== First Steps ==


Funtoo Linux fully supports traditional MBR partitions, as well as newer GPT/GUID partition formats. See below to determine which partitioning scheme to use:
To install Funtoo Linux on a UEFI system, first you need to boot SysRescueCD in UEFI mode. To do this, enable UEFI in your BIOS, and if necessary disable legacy booting. After some fiddling, you should be able to boot SysRescueCD and get a black and white text menu instead of the traditional aqua/cyan-colored menu. The black and white menu indicates that you booted SysRescueCD in UEFI mode. Once you've accomplished this, you're ready to continue with your Funtoo Linux installation and partition your drive. See below for details.


===== MBR Partitions =====
{{fancynote|If the <tt>/sys/firmware/efi</tt> directory exists, then you have successfully booted in EFI mode and will be able to configure your Funtoo system to boot in EFI mode. If the directory doesn't exist, fix this first. It is a requirement for setting up EFI booting.}}


* '''Recommended if your system disk is <=2TB in size'''
== Partitioning ==
* Legacy, DOS partitioning scheme
* Only 4 primary partitions per disk; after that, you must use "logical" partitions
* Does not support 2 TB+ disks for booting
* Compatible with certain problematic systems (such as the HP ProBook 4520)
* Dual-boot with Windows for BIOS systems (Windows handle GPT only on true EFI systems, whatever version it is)
* Multiple boot loader options, e.g. GRUB 2, GRUB Legacy, lilo


{{fancynote|Due to the fact that it is more widely supported on PC hardware, it is best to use MBR partitions if possible.}}
To set up your partitions for UEFI booting, you will create a ~500MB FAT32 partition on <tt>/dev/sda1</tt>, and set it to type <tt>EF00</tt> using <tt>gdisk</tt>.  


===== GPT Partitions =====
<console>
Command: ##i##n ↵
Partition Number: ##i##1 ↵
First sector: ##i##↵
Last sector: ##i##+500M ↵
Hex Code: ##i##EF00
</console>


* '''Recommended if your disk is >2TB in size'''
This partition will serve as your Funtoo <tt>/boot</tt> filesystem as well as the partition that the UEFI firmware can read to load GRUB. Then you will set up swap on <tt>/dev/sda2</tt> and your root filesystem on <tt>/dev/sda3</tt>. To create the FAT32 filesystem, type:
* Newer format for Linux systems
* Supports 2 TB+ hard drives for booting
* Supports hundreds of partitions per disk of any size
* Requires legacy BIOS boot partition (~32 MB) to be created if system does not use EFI
* Requires bootloader with support for GPT such as GRUB 2, EXTLINUX, or a patched version of GRUB Legacy


{{fancyimportant|If you have a system disk that is 2TB or greater and want to use the space beyond 2TB, you ''must'' partition using the GPT/GUID format. Otherwise, MBR is recommended as the most reliable boot method.}}
<console>
# ##i##mkfs.vfat -F 32 /dev/sda1
</console>


For a generation 2 Hyper-V system, the [http://www.ubuntu.com/ Ubuntu] desktop install DVD as of version 14.04.1 works well enough. Gentoo CDs don't support EFI boot, and the System Rescue CD lacks appropriate graphics support for Hyper-V as of version 4.4.0.
Your <tt>/etc/fstab</tt> entry for this filesystem will also differ, and will look like this:


It is also possible to install Funtoo Linux using many other Linux-based live CDs. Generally, any modern bootable Linux live CD or live USB media will work. See [[Requirements|requirements]] for an overview of what the Live Media must provide to allow a problem-free install of Funtoo Linux.
<pre>
/dev/sda1 /boot vfat noatime 1 2
</pre>


To begin a Funtoo Linux installation, download System Rescue CD from:
== Kernel ==


Or, use your preferred live media. Insert it into your disc drive, and boot from it. I
=== VFAT ===


===== Filesystem Resources =====
Make sure you add VFAT support to your kernel if you are building it manually.


Advanced users may be interested in the following topics:
=== EFI Framebuffer ===


* [[GUID Booting Guide]]
If you have the following option enabled in your kernel, then uvesafb and efifb will not be able to detect the framebuffer:
* [[LVM Install Guide]]
* [[Rootfs over encrypted lvm]]
* [[Rootfs over encrypted lvm over raid-1 on GPT]]
* '''NEW!''' '''[[ZFS Install Guide]] (Also contains instructions for Rootfs over Encrypted ZFS!)'''


===== Partitioning Recommendations =====
{{kernelop|title=Bus options (PCI etc.)|desc=
    [*] Mark VGA/VBE/EFI FB as generic system framebuffer (NEW)
}}


Below are our partitioning recommendations in table form. For MBR-based partitions, use the MBR Block Device and MBR code columns with <code>fdisk</code>. For GPT-based partitions, use the GPT Block Device and GPT Code columns with <code>gdisk</code>:
If you have that option enabled, ''you must also enable'':


{{TableStart}}
{{kernelop|title=Device Drivers,Graphics support,Frame buffer Devices|desc=
<tr class="active"><th>Partition</th>
    [*]  Simple framebuffer support
<th>Size</th>
}}
<th>MBR Block Device (<code>fdisk</code>)</th>
<th>GPT Block Device (<code>gdisk</code>)</th>
<th>Filesystem</th>
<th>MBR Code</th>
<th>GPT Code</th>
</tr><tr>
<td><code>/boot</code></td>
<td>512 MB</td>
<td><code>/dev/sda1</code></td>
<td><code>/dev/sda1</code></td>
<td>ext2</td>
<td>83</td>
<td>8300</td>
</tr><tr>
<td>swap</td>
<td>2x RAM for low-memory systems and production servers; otherwise 2GB.</td>
<td><code>/dev/sda2</code></td>
<td><code>/dev/sda3</code></td>
<td>swap (default)</td>
<td>82</td>
<td>8200</td>
</tr><tr>
<td><code>/</code> (root)</td>
<td>Rest of the disk, minimum of 10GB.  Note: to compile the <code>debian-sources</code> kernel, as described later on this page, requires a minimum of 14GB free space in <code>/tmp</code>; consider a minimum of 20GB in this case.</td>
<td><code>/dev/sda3</code></td>
<td><code>/dev/sda4</code></td>
<td>XFS recommended, alternatively ext4</td>
<td>83</td>
<td>8300</td>
</tr><tr>
<td><code>/home</code> (optional) </td>
<td>User storage and media. Typically most of the disk.</td>
<td><code>/dev/sda4</code> (if created)</td>
<td><code>/dev/sda5</code> (if created)</td>
<td>XFS recommended, alternatively ext4</td>
<td>83</td>
<td>8300</td>
</tr><tr>
<td>LVM (optional)</td>
<td>If you want to create an LVM volume.</td>
<td><code>/dev/sda4</code> (PV, if created)</td>
<td><code>/dev/sda5</code> (PV, if created)</td>
<td>LVM PV</td>
<td>8E</td>
<td>8E00</td>
</tr>{{TableEnd}}


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.
=== Grub method ===


{{note|These install instructions assume you are installing Funtoo Linux to an hard disk using Master Boot Record partition tables (MBR). If you are installing Funtoo Linux on a machine where another OS is installed, there is an existing Linux distribution on your system that you want to keep or any other scenario (such as differing swap size requirements), then you will need to adapt these instructions to suit your needs.}}
==== Unmask Grub 2.02_beta2 ====


===== Partitioning Using fdisk (MBR) =====
Unmask the latest version of GRUB by placing this in your <code>/etc/portage/package.unmask</code>:


{{important|If you need to create a GPT partition table, see [[Partitioning using gdisk]] or [[Partitioning using parted]].}}
<pre>
sys-boot/grub
</pre>


<code>fdisk</code> is the tool used to create an MBR partition table. MBR is well-supported on PCs and is recommended if your system disk is 2TB or smaller.
The 2.00 version of GRUB has known issues with UEFI booting. Using 2.02 is essential for having this boot method work reliably.


==== Partitioning Using gdisk ====
==== Emerging GRUB ====


===== Notes Before We Begin =====
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>:


These install instructions assume you are installing Funtoo Linux to an empty hard disk using GUID partition tables (GPT). If you are installing Funtoo Linux on a machine where another OS is installed, or there is an existing Linux distribution on your system that you want to keep, then you will need to adapt these instructions to suit your needs.
<pre>
GRUB_PLATFORMS="efi-64"
</pre>


If you are going to create a legacy MBR partition table instead of GUID/GPT, you will use the <tt>fdisk</tt> command instead of <tt>gdisk</tt>, and you will not need to create the GRUB boot loader partition. See the table under [[#Partitioning Recommendations|Partitioning Recommendations]], in particular the
Then, <tt>emerge grub</tt>. You will notice <tt>efibootmgr</tt> getting pulled in as a dependency. This is expected and good.
'''MBR Block Device (<tt>fdisk</tt>)''' and '''MBR Code''' columns. <tt>fdisk</tt> works just like <tt>gdisk</tt>, but creates legacy MBR partition tables instead of the newer GPT/GUID partition tables.


Advanced users may be interested in the following topics:
==== Installing GRUB ====


* [[GUID Booting Guide]]
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:
* [[Rootfs over encrypted lvm]]
* [[Rootfs over encrypted lvm over raid-1 on GPT]]
* '''NEW!''' '''[[ZFS Install Guide]] (Also contains instructions for Rootfs over Encrypted ZFS!)'''


===== Using gdisk =====
<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.


The first step after booting SystemRescueCd is to use <tt>gdisk</tt> to create GPT (also known as GUID) partitions, specifying the disk you want to use, which is typically <tt>/dev/sda</tt>, the first disk in the system:
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.


<console># ##i##gdisk /dev/sda</console>
==== Configuring GRUB ====
You should find <tt>gdisk</tt> very similar to <tt>fdisk</tt>. Here is the partition table we want to end up with:


<console>Command (? for help): ##i##p
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.  
Disk /dev/sda: 234441648 sectors, 111.8 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): A4E5208A-CED3-4263-BB25-7147DC426931
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 234441614
Partitions will be aligned on 2048-sector boundaries
Total free space is 2014 sectors (1007.0 KiB)


Number  Start (sector)    End (sector)  Size      Code  Name
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:
  1            2048          206847  500.0 MiB  8300  Linux filesystem
  2          206848          272383  32.0 MiB    EF02  BIOS boot partition
  3          272384        8660991  4.0 GiB    8200  Linux swap
  4        8660992      234441614  107.7 GiB  8300  Linux filesystem


Command (? for help): </console>
{{file|name=/etc/boot.conf|desc=|body=
boot {
        generate grub
        default "Funtoo Linux"
        timeout 3
}


Above, you'll see that we have a 500 MiB boot partition, a 32 MiB "BIOS boot partition" (also known as the GRUB boot loader partition), 4 GiB of swap, and the remaining disk used by a 107.7 GiB root partition.
"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:


{{fancynote|An alternate boot loader called extlinux can be used instead of GRUB if you desire. See the [[Extlinux|extlinux Guide]] for information on how to do 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:
** 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: <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>.
 
=== 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.
 
[[Category:HOWTO]]

Revision as of 23:55, November 18, 2014

   Note

This material has been integrated into the main install guide, but 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 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.

What Are We Doing?

This guide will show you how to set up your UEFI system to load the GRUB boot loader, which will then load your Funtoo Linux kernel and initramfs. This is the "UEFI + GRUB" method as described on the Boot Methods page.

First Steps

To install Funtoo Linux on a UEFI system, first you need to boot SysRescueCD in UEFI mode. To do this, enable UEFI in your BIOS, and if necessary disable legacy booting. After some fiddling, you should be able to boot SysRescueCD and get a black and white text menu instead of the traditional aqua/cyan-colored menu. The black and white menu indicates that you booted SysRescueCD in UEFI mode. Once you've accomplished this, you're ready to continue with your Funtoo Linux installation and partition your drive. See below for details.

   Note

If the /sys/firmware/efi directory exists, then you have successfully booted in EFI mode and will be able to configure your Funtoo system to boot in EFI mode. If the directory doesn't exist, fix this first. It is a requirement for setting up EFI booting.

Partitioning

To set up your partitions for UEFI booting, you will create a ~500MB FAT32 partition on /dev/sda1, and set it to type EF00 using gdisk.

Command: n ↵
Partition Number: 1 ↵
First sector: 
Last sector: +500M ↵
Hex Code: EF00

This partition will serve as your Funtoo /boot filesystem as well as the partition that the UEFI firmware can read to load GRUB. Then you will set up swap on /dev/sda2 and your root filesystem on /dev/sda3. To create the FAT32 filesystem, type:

root # mkfs.vfat -F 32 /dev/sda1

Your /etc/fstab entry for this filesystem will also differ, and will look like this:

/dev/sda1		/boot		vfat		noatime	1 2

Kernel

VFAT

Make sure you add VFAT support to your kernel if you are building it manually.

EFI Framebuffer

If you have the following option enabled in your kernel, then uvesafb and efifb will not be able to detect the framebuffer:

Under Bus options (PCI etc.):

[*] Mark VGA/VBE/EFI FB as generic system framebuffer (NEW)

If you have that option enabled, you must also enable:

Under Device Drivers-->Graphics support-->Frame buffer Devices:

[*]   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.

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 and insmod 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
  • 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.

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.