Difference between pages "Help:Funtoo Editing Guidelines" and "UEFI Install Guide"

From Funtoo
(Difference between pages)
Jump to: navigation, search
({{File}})
 
(Partitioning)
 
Line 1: Line 1:
This guide is meant to serve as a reference for those who are interested in helping improve the Funtoo wiki.  
+
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.
  
== {{Kernelop}} ==
+
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.
To display kernel options, we encourage you to use the <tt>kernelop</tt> template. To use the <tt>kernelop</tt> template, create an entry similar to the following example:
+
<pre>
+
{{kernelop|title=foo,bar|desc=
+
kernel options pasted from "make menuconfig"
+
<&#47;pre>}}
+
</pre>
+
  
Adding this entry will give you the following output:
+
== What Are We Doing? ==
{{kernelop|title=foo,bar|desc=
+
kernel options
+
}}
+
  
Here's a more concrete example:
+
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.
{{kernelop|title=File systems|desc=
+
<M> Second extended fs support         
+
[ ]  Ext2 extended attributes         
+
[ ]   Ext2 execute in place support   
+
<M> Ext3 journalling file system support
+
}}
+
  
Examples of usage:
+
== First Steps ==
* [[Fglrx]]
+
* [[Acpid]]
+
* [[Microcode]]
+
  
== Displaying Source Code ==
+
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.
  
To display source code, use the <tt>&#60;syntaxhighlight&#62;</tt> tag, which has the ability to perform syntax highlighting on the source code for easier reading:
+
'''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.'''
<pre>
+
<syntaxhighlight lang="python">
+
import system
+
</syntaxhighlight>
+
</pre>
+
  
This will produce the following output:
+
== Partitioning ==
  
<syntaxhighlight lang="python">
+
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>.
import system
+
</syntaxhighlight>
+
  
 +
<console>
 +
Command: ##i##n ↵
 +
Partition Number: ##i##1 ↵
 +
First sector: ##i##↵
 +
Last sector: ##i##+500M ↵
 +
Hex Code: ##i##EF00
 +
</console>
  
Note that the language should be specified in the <tt>lang</tt> attribute. For a list of supported languages, see [http://www.mediawiki.org/wiki/Extension:SyntaxHighlight_GeSHi#Supported_languages this list].
+
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:
  
== Displaying Files ==
+
<console>
To display the contents of a file that is not source code, use the <&#47;pre> tag. The <&#47;pre> tag preserves formatting. Example file contents:
+
# ##i##mkfs.vfat -F 32 /dev/sda1
 +
</console>
  
<pre>
+
Your <tt>/etc/fstab</tt> entry for this filesystem will also differ, and will look like this:
foo
+
 
bar
+
pre>
oni
+
/dev/sda1 /boot vfat noatime 1 2
 
</pre>
 
</pre>
  
 +
Make sure you add VFAT support to your kernel if you are building it manually.
  
Examples of usage:
+
== Boot Loader ==
* [[UEFI Install Guide]]
+
* [[MediaWiki]]
+
* [[Clang]]
+
  
== &#60;tt&#62; and &#60;code&#62; ==
+
=== Emerging GRUB ===
To emphasize filenames, commands, and other technical "jargon," use the  <tt>&#60;tt&#62;</tt> or <tt>&#60;code&#62;</tt> option. To use these, follow the example below:
+
<pre>
+
The <tt>/etc/fstab</tt> file is an important one. Another important file is <code>/boot/grub/grub.cfg</code>.
+
</pre>
+
  
This example produces the following output (notice the difference between the fonts?): <br> The <tt>/etc/fstab</tt> file is an important one. Another important file is <code>/boot/grub/grub.cfg</code>.
+
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>:
  
== &#60;console&#62; ==
+
{{File
To display console output, use the <tt>&#60;console&#62;</tt> tag:
+
|/etc/portage/make.conf|<pre>
 +
.....
 +
GRUB_PLATFORMS="efi-64"
 +
</pre>}}
  
For a root console:
+
Then, <tt>emerge grub</tt>. You will notice <tt>efibootmgr</tt> getting pulled in as a dependency. This is expected and good.
<pre>
+
 
<console>
+
=== Installing GRUB ===
###i## run a command as root
+
</console>
+
</pre>
+
Produces:
+
<console>
+
###i## run a command as root
+
</console>
+
  
{{Fancyimportant|The <tt>##i##</tt> text tags the rest of the line as being ''user input'' ("i" is for "input"). It is then highlighted in a noticeable color so it stands out from text that is not typed in by the user.}}
+
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:
  
Examples of usage:
 
* [[Rootfs over encrypted lvm]]
 
* [[Boot-Update]]
 
* [[Fonts]]
 
For a non-root console:
 
<pre>
 
 
<console>
 
<console>
$##i## run a command as user
+
# ##i##grub-install --target=x86_64-efi --efi-directory=/boot /dev/sda
 
</console>
 
</console>
</pre>
+
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.
Produces:
+
=== Configuring GRUB ===
<console>
+
 
$##i## run a command as user
+
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 not use boot-update directly and will create a <tt>/boot/grub/grub.cfg</tt> file manually that looks like this:
</console>
+
{{File
Examples of usage:
+
|/boot/grub/grub.cfg|<pre>
* [[Zope HOWTO]]
+
set timeout=3
* [[Benchmarking]]
+
set gfxmode=auto
 +
insmod efi_gop
 +
insmod efi_uga
 +
 
 +
menuentry "Funtoo Linux genkernel - kernel-debian-sources-x86_64-3.2.35-2" { 
 +
    insmod part_gpt
 +
    insmod fat 
 +
    set root=(hostdisk//dev/sda,gpt1) 
 +
    search --no-floppy --fs-uuid --set __REPLACE_UUID_OF_SDA1__
 +
    linux /kernel-debian-sources-x86_64-3.2.35-2 real_root=/dev/sda3
 +
    initrd /initramfs-debian-sources-x86_64-3.2.35-2 
 +
    set gfxpayload=keep
 +
}
 +
set default=0
 +
</pre>}}
 +
 
 +
Note the <tt>search</tt> line where it says '''<tt>__REPLACE_UUID_OF_SDA1__</tt>''' above. You will need to run '''<tt>blkid /dev/sda1</tt>''' and use the UUID value that is displayed. For example, on my system, I need to use '''<tt>C34B-19CF</tt>'''. You can also change the <tt>menuentry</tt> line text in quotes to say whatever you want, and the <tt>linux</tt> and <tt>initrd</tt> lines should reference your kernel versions in <tt>/boot</tt>. As above, use the path <tt>/</tt> instead of <tt>/boot</tt> as the path should be relative to the root of the VFAT filesystem.
 +
 
 +
== 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
 +
 
 +
=== 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:Wiki Development]]
+
[[Category:HOWTO]]

Revision as of 09:07, 18 February 2014

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.

Contents

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.

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:

# mkfs.vfat -F 32 /dev/sda1

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

pre> /dev/sda1 /boot vfat noatime 1 2 </pre>

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

Boot Loader

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:

# grub-install --target=x86_64-efi --efi-directory=/boot /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.

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 not use boot-update directly and will create a /boot/grub/grub.cfg file manually that looks like this:

set timeout=3
set gfxmode=auto
insmod efi_gop
insmod efi_uga

menuentry "Funtoo Linux genkernel - kernel-debian-sources-x86_64-3.2.35-2" {  
    insmod part_gpt
    insmod fat  
    set root=(hostdisk//dev/sda,gpt1)  
    search --no-floppy --fs-uuid --set __REPLACE_UUID_OF_SDA1__
    linux /kernel-debian-sources-x86_64-3.2.35-2 real_root=/dev/sda3
    initrd /initramfs-debian-sources-x86_64-3.2.35-2  
    set gfxpayload=keep
}
set default=0

Note the search line where it says __REPLACE_UUID_OF_SDA1__ above. You will need to run blkid /dev/sda1 and use the UUID value that is displayed. For example, on my system, I need to use C34B-19CF. You can also change the menuentry line text in quotes to say whatever you want, and the linux and initrd lines should reference your kernel versions in /boot. As above, use the path / instead of /boot as the path should be relative to the root of the VFAT filesystem.

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

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.