User Tools

Site Tools


Looks like there's some interest in how I boot into Linux, so here's how to do that.

Booting into Linux directly from EFI, without a bootloader or initrd

A 64-bit EFI, by default, will try to boot from its EFI partition, from the file


We put our kernel image at this position, EFI will run the image directly and the kernel starts the boot process.

Since we have no bootloader to tell the kernel what its command-line parameters are, we need to compile these in. Relevant kernel configs are:


This will produce a file executable by your EFI.

CONFIG_CMDLINE="root=PARTUUID=abcdef12-3456-7890-abcd-ef0123456789 rootfstype=btrfs quiet"

And this is what the kernel will boot, insert your parameters here. Since so little is known about the system when the kernel starts, you can't just use /dev/sda1 or similar to specify the root partition, you'll have to use the PARTUUID. (You can, but the device order is not guaranteed and any info inside the partitions, like LABEL, isn't known yet). You can get that using:

# blkid                                                                                              
/dev/sda3: LABEL= (...) PARTUUID="abcdef12-3456-7890-abcd-ef0123456789"

Should you ever need to boot with a different command line (e.g. for rescue purposes), you can use an EFI shell.

Now, compile your kernel and copy the image to your EFI partition, for example like this (when the EFI system partition is mounted as /boot):

# cp /boot/vmlinuz-4.4.0-gentoo-r1 /boot/efi/boot/bootx64.efi

And that's it. More can be found in the Gentoo or Arch Wikis.

If bootx64.efi is occupied

Should you run a Windows as another OS, its bootloader will already be at the bootx64.efi spot. In this case, copy the kernel image to a path of your liking, for example /boot/efi/kernel.efi. You can register this file as something to be available to boot with:

# efibootmgr -c -l '\efi\kernel.efi' -L 'My Linux Kernel'

When you update your kernel, you can simply overwrite /boot/efi/kernel.efi without the need to re-register it.

You can get the boot order by running efibootmgr without any arguments, and control it with -o, for example:

# efibootmgr -o 0000,0003,0001,0002,0005,0004

Bonus: If you want to reboot into Windows once (so you can skip mashing that key to get to your bios' boot menu), you can use:

# efibootmgr -n <your_windows_boot_id>
efidirectboot.txt · Last modified: 02.02.2016 19:09 by root