Wiki homeEdit this page

Using EFISTUB instead of a bootloader

For some UEFI users, the Linux kernel has the ability to act as an EFI executable, which simplifies the boot process by removing the need for a bootloader.

Prerequisites

Install efibootmgr

$ kiss b efibootmgr && kiss i efibootmgr

Mount efivarfs

See Mounting UEFI variables.

Enable EFISTUB support in the kernel

In the kernel configuration, enable CONFIG_EFI_STUB=y.

In menuconfig, this is located at:

Processor type and features  --->
    [*] EFI runtime service support
    [*]   EFI stub support

Then recompile and install the kernel. Keep the kernel’s name as vmlinuz, and not vmlinuz-VERSION otherwise the boot entry will have to be updated for every new kernel update.

Creating a UEFI boot entry

# efibootmgr --disk /dev/sdX \
              --part N \
              --create "KISS Linux" \
              --loader '/vmlinuz' \
              --unicode 'root=/dev/sdYM' \
              --verbose

Where /dev/sdXN is your EFI system partition and /dev/sdYM is your root partition.

Check to see that the entry was added with efibootmgr --verbose.

Find the entry’s boot number XXXX, and the other entry’s boot numbers (YYYY, ZZZZ, and so on), and set it as the first in the boot order with:

# efibootmgr --bootorder XXXX,YYYY,ZZZZ --verbose

Specifying root by PARTUUID

The root partition can also be referred to by its partition UUID:

--unicode 'root=PARTUUID=aaaaaaaa-aaaa-4aaa-aaa-aaaaaaaaaaaa'

The root partition’s UUID can be found using blkid.

Kernel parameters

In the above command, the --unicode option specifies the parameters passed to the kernel. If you require other parameters to boot your system, pass them here.

Removing a UEFI boot entry

Find your entry’s boot number XXXX using efibootmgr --verbose and run:

# efibootmgr --bootnum XXXX --delete-bootnum