UEFI Releated Notes

Moving on to UEFI from a BIOS setup would needs to have a properly prepared partitioning scheme, and different files put to the right place.

Prepare disk layout with GPT

First, start fdisk on the relevant block device:

sudo fdisk /dev/nbd0

Then create an EFI System Partition. The size of it shall be 550MiB

Command (m for help): g
Created a new GPT disklabel (GUID: 42D5590B-A500-F44E-BD1E-1B0EAA62EEB3).

Command (m for help): n
Partition number (1-128, default 1):
First sector (2048-20971486, default 2048):
Last sector, +sectors or +size{K,M,G,T,P} (2048-20971486, default 20971486): +550M

Created a new partition 1 of type 'Linux filesystem' and of size 550 MiB.

Command (m for help): t
Selected partition 1
Partition type (type L to list all types): 1
Changed type of partition 'Linux filesystem' to 'EFI System'.

Now create the partition that will hold the system. Use the rest of the disk in this example.

Command (m for help): n
Partition number (2-128, default 2):
First sector (1128448-20971486, default 1128448):
Last sector, +sectors or +size{K,M,G,T,P} (1128448-20971486, default 20971486):

Created a new partition 2 of type 'Linux filesystem' and of size 9.5 GiB.

Command (m for help): t
Partition number (1,2, default 2):
Partition type (type L to list all types): 24

Changed type of partition 'Linux filesystem' to 'Linux root (x86-64)'.

Once that's done, quit from fdisk.

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

Now you should have /dev/nbd0p1 as the EFI System partition, and /dev/nbd0p2 as the partition for your linux to come.

Create EFI partition

First, format the EFI system partition

sudo mkfs.fat -F32 /dev/nbd0p1

Create system partition

Now you need to make sure you have some sort of linux root filesystem at /dev/nbd0p2: Refer to Arch Linux Installation

Configure boot loader

We'll use grub for this purpose:

# mkdir /efi
# mount /dev/nbd0p1 /efi
# pacman -S grub efibootmgr
# grub-install --target=x86_64-efi --efi-directory=/efi --removable --bootloader-id=GRUB
# grub-mkconfig -o /boot/grub/grub.cfg

List menu entries in firmware

Add menu entry for Linux into firmware

Assuming your EFI is on /dev/sda1 - efibootmgr --create --disk /dev/sda --part 1 --loader "\EFI\systemd\systemd-bootx64.efi" --label "Linux Boot Manager" --verbose