EFI stub

The (U)EFI firmware present in many computers functions as a boot manager, allowing systems to boot by the use of a compatible EFI. By making the Linux kernel itself such a bootloader, called EFI stub, such a configuration will boot without the need of a secondary bootloader. This article Article description::provides instructions on configuring and installing unsigned kernels in the of a computer running in EFI mode. This requires  to be disabled.

Kernel configuration
In order to boot directly from UEFI, the kernel needs to know where to find the root partition of the system to be booted. Enable
 * EFI runtime service support ( CONFIG_EFI ),
 * EFI stub support ( CONFIG_EFI_STUB )
 * Built-in kernel command line ( CONFIG_CMDLINE_BOOL )
 * and add the root partition path (example: ) or its PARTUUID to ( CONFIG_CMDLINE ).

Using  might be preferable. To find out use :

Installation
If an (ESP) does not exist, one needs to be created. Still in the kernel directory, build the kernel and install the modules:

Have the ESP (in this example ) mounted at :

Copy or move the kernel image to the right place adding version number and the suffix:

In the ESP it should then be listed like:

Alternatively the fallback directory could be used additionally to or instead of. Alternatively vmlinuz can be copied (or moved) instead of the bzImage.

Next, update the NVRAM using e.g. efibootmgr.

Microcode loading (Intel)
An efistub compatible method to load microcode without using an initramfs can be found in the article.

Optional: initramfs
See the and  sections of the  article.

Optional: Secure boot
There is a forums post and another explaining in detail how to sign the kernel and enable secure boot.

Troubleshooting

 * Forums topic - BIOS losing the names of the EFI ESPs
 * Older kernels compiled with gcc:10 crashed at boot.
 * Users of can specify the root partition path with the   parameter using :


 * To create a boot entry with efibootmgr and hibernation on swap partition:
 * To create a boot entry with efibootmgr and hibernation on swap partition:

External resources

 * Linux Kernel Documentation on EFI Stub
 * EFI Stub - booting without a bootloader Blog posting which this article is partially based on.
 * EFI bootloaders listing alternative ways to boot an (U)EFI system.
 * EFISTUB on wiki.archlinux.org
 * Gentoo Forums: Suspend and Hibernate with UEFI
 * http://www.kroah.com/log/blog/2013/09/02/booting-a-self-signed-linux-kernel/