Install Initrd on an UEFI boot system

This page is about intalling a gerneric Kernel with Initrd as further boot option near the huge smp kernel. The latter is already installed in the UEFI partition and is reachable under /boot/efi/EFI/Slackware/ when the UEFI partition is mounted.
It is assumde that /dev/nvme0n1p1 is the UEFI partition and /dev/nvme0n1p3 is the Linux root partition

Further sources and docs:

  1. The source code of the Slack eliloconfig script on /usr/sbin/eliloconfig

Backup the boot dir and make sure that the UEFI partition is mounted at the right place:

cp -a /boot /boot.bak
cd /boot
mkdir efi
mount /dev/nvme0n1p1 /boot/efi

Create the usual initrd.gz with mkinitrd_command_generator.sh. See Use Generic Kernel with an Initrd Most of the reste is borrowed from the eliloconfig source.

# /boot/elilo-x86_64.efi and /boot/efi/EFI/Slackware/elilo.efi
# are identical, so we use it as well:
mkdir -p /boot/efi/EFI/SlackInitrd
cp -a /boot/elilo-x86_64.efi /boot/efi/EFI/SlackInitrd/elilo.efi

# Copy over the generic Kernel. cp -a doesn't work for symlinks, therefore:
cp /boot/vmlinuz-generic /boot/efi/EFI/SlackInitrd/vmlinuz
touch -r /boot/vmlinuz-generic /boot/efi/EFI/SlackInitrd/vmlinuz

# We need the initrd which we just created:
cp -a /boot/initrd.gz /boot/efi/EFI/SlackInitrd

# We borrow the conifg file from the huge kernel...
cp -a /boot/efi/EFI/Slackware/elilo.conf /boot/efi/EFI/SlackInitrd

… and we add the initrd line to the config file:

--- efi/EFI/Slackware/elilo.conf        2018-01-02 14:12:06.000000000 +0100
+++ efi/EFI/SlackInitrd/elilo.conf      2018-01-12 11:47:05.000000000 +0100
@@ -4,5 +4,6 @@
 #
 image=vmlinuz
         label=vmlinuz
+       initrd=initrd.gz
         read-only
         append="root=/dev/nvme0n1p3 vga=normal ro"

Now we check with efibootmgr the current BootOrder and under BootCurrent the currently running system.
Then we tell the UEFI system that we have a new boot opiton:

efibootmgr -c -d /dev/nvme0n1 -p 1 -l "\\EFI\\SlackInitrd\\elilo.efi" -L "SlackInitrd"

After that we make sure that it worked and checkBootOrder again with efibootmgr

FIXME How can a timeout be set?