EFI stub

From Funtoo
Revision as of 14:49, September 28, 2014 by Causes (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Introduction

EFI stub allows you to boot Linux kernel directly from UEFI. It is simple and fast alternative to using separate boot loader.

Configure kernel

Configure kernel to use UEFI stub.

Under Processor type and features:

[*] EFI runtime service support
[*]   EFI stub support

[*] Built-in kernel command line
(root=/dev/sda3 rootfstype=ext4 net.ifnames=0) Built-in kernel command string

Make UEFI boot partition

Create a 500MB partition on /dev/sda1 using gdisk.

root # gdisk /dev/sda
Command: n ↵
Partition Number: 1 ↵
First sector: 
Last sector: +500M ↵
Hex Code: EF00

Format the partition to FAT32.

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

Copy kernel to boot partition

Kernel filename has to end with .efi for UEFI to detect it.

root # cp arch/x86/boot/bzImage /boot/linux.efi

Make UEFI boot entry

UEFI boot entry can be made with sys-boot/efibootmgr

root # emerge -av efibootmgr
root # efibootmgr -c -d /dev/sda -p 1 -L "Funtoo Linux" -l "\linux.efi"