Configure boot settings in UEFI

Main source for trouble-shooting is Arch-Wiki UEFI. It describes the commands:

  1. bcfg within UEFI shell
  2. Linux command efibootmgr

1. Highly recommended to install the UEFI-shell, which is in package edk2-shell. On Asrock copy

cp -p /usr/share/edk2-shell/x64/Shell_Full.efi /boot/shellx64.efi

So name of the shell should change to shellx64.efi, at least on Asrock system A300M.

Create UEFI boot entry where boot entry says: Run UEFI-shell with parameter fs0:\\archlinux-fallback.nsh.

efibootmgr -c -d /dev/nvme0n1 -l /shellx64.efi -L Shellx64_u -v -u "fs0:\\archlinux-fallback.nsh"

This script, executed by UEFI-shell, is as follows: cat archlinux.nsh

vmlinuz-linux root=UUID=dac919c6-2f0f-466b-ada8-692ce6d16d91 rw  cryptdevice=/dev/disk/by-uuid/70260d27-bc13-44dd-9b30-168c2be7c72f:nvme0n1p2 ip=192.168.178.20:192.168.178.20:192.168.178.1:255.255.255.0:ryzen:eth0:none initrd=\initramfs-linux.img

This UEFI-shell script is very similar to a GRUB entry. Important to note is that vmlinuz-linux is directly “executable” via UEFI-shell. vmlinuz-linux takes arguments which tell where to find root directory, initial RAM disk, and possibly any information for entering decrypt password for an encrypted boot device.

2. Instead of

efibootmgr -c -d /dev/nvme0n1 -l /shellx64.efi -L Shellx64_u -v -u "fs0:\\archlinux-fallback.nsh"

one could also configure UEFI boot entry as below, although more complicated, but better understanding what exactly is done behind the scenes:

printf "fs0:\\\archlinux-fallback.nsh" | ~klm/c/2ndzero | efibootmgr -c -d /dev/nvme0n1 -l /shellx64.efi -L Shellx64 -v -@ -

C program 2ndzero adds hex 00 every second character. Below program adds 0x00 after each character:

/* Read stdin and insert hex zero after every character */
#include <stdio.h>

int main (int argc, char *argv[]) {
        int c;

        while ((c = getchar()) != EOF) {
                putchar(c);
                putchar('\0');
        }

        return 0;
}

3. Some useful efibootmgr examples. Show all UEFI boot variants:

efibootmgr -v

Looking in hex into boot configuration:

xxd /sys/firmware/efi/efivars/Boot0005-8be4df61-93ca-11d2-aa0d-00e098032b8c

Create an UEFI boot entry with just an UEFI-shell:

efibootmgr -c -d /dev/nvme0n1 -l /shellx64.efi -L uefi_shell -v

Delete an UEFI boot entry, in this case number six:

efibootmgr -B 6

Delete entry #6:

efibootmgr -B -b 6

Delete entry #2:

efibootmgr -B -b 2

Rearrange order of boot entries, and mark entry #9 as active:

efibootmgr -o 5,9,a

SSD Speed on Dell XPS 13 9350 with Samsung EVO 970 Plus

In continuation of blog-post SSD Speed on Dell XPS 13 9350, here are performance measurements for a Samsung EVO 970 Plus in Dell XPS 13.

Caveat from Dell xps 13 9350 and Samsung 970 evo M.2 nvme Compatability?:

However, be aware that although the XPS 13 9350 uses a PCIe x4 configuration for its NVMe interface, the lanes are run in power saving mode, not max performance mode, and this cannot be changed by the user. 4 lanes in power saving mode is roughly equivalent to 2 lanes in max performance mode, so the result is that your sequential read and write speeds will max out at 1.8 GB/s, even though the 970 Evo can do much more than that.

Installing the new Samsung EVO 970 Plus.

Mounted in laptop:

Read speed of unencrypted disk:

Once again read speed, this with a LUKS encrypted disk: