We don't want extra stuff
We want to boot Linux without installing a boot loader
- We need to create an entry in the UEFI NVRAM entries list.
- We can use the bcfg tool for that. But we need a unified kernel image(something with
.efi
). - We use the
objcopy
utility to do generate the unified kernel image. - Finally, we need to setup Pacman hooks to have the unified kernel image every time we upgrade linux.
Depending on your partition scheme, you might need to change the paths in the steps.
lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
nvme0n1 259:0 0 476.9G 0 disk
├─nvme0n1p1 259:1 0 529M 0 part
├─nvme0n1p2 259:2 0 100M 0 part /boot
├─nvme0n1p3 259:3 0 16M 0 part
├─nvme0n1p4 259:4 0 298.8G 0 part
├─nvme0n1p5 259:5 0 581M 0 part
└─nvme0n1p6 259:6 0 176.9G 0 part /
/etc/fstab
UUID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx / ext4 rw,relatime 0 1
UUID=xxxx-xxxx /boot vfat rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 2
-
Install
binutils
package, as we need theobjcopy
utilitypacman -S binutils
-
Get PARTUUID using lsblk command
lsblk --output=PATH,PARTUUID
-
Create a file with your kernel command line parameters
cat <<EOF > kernel-command-line.txt root=PARTUUID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx rw EOF
-
Create and place
linux.efi
at/boot/EFI/Linux/linux.efi
objcopy \ --add-section .osrel="/usr/lib/os-release" --change-section-vma .osrel=0x20000 \ --add-section .cmdline="kernel-command-line.txt" --change-section-vma .cmdline=0x30000 \ --add-section .splash="/usr/share/systemd/bootctl/splash-arch.bmp" --change-section-vma .splash=0x40000 \ --add-section .linux="/boot/vmlinuz-linux" --change-section-vma .linux=0x2000000 \ --add-section .initrd="/boot/initramfs-linux.img" --change-section-vma .initrd=0x3000000 \ "/usr/lib/systemd/boot/efi/linuxx64.efi.stub" "linux.efi" mkdir -p /boot/EFI/Linux/ cp linux.efi /boot/EFI/Linux/
-
Use the
bcfg
command in UEFI Shell v2 (i.e., from the Arch Linux live iso).bcfg boot add 0 fs2:\EFI\Linux\linux.efi "Arch Linux"
-
Create the hook file
/etc/pacman.d/hooks/90-update-efistub.hook
with content[Trigger] Operation = Install Operation = Upgrade Type = Path Target = usr/src/*/dkms.conf Target = usr/lib/modules/*/build/include/ Target = usr/lib/modules/*/modules.alias [Action] Description = Updating linux efistub... When = PostTransaction Depends = linux Depends = binutils Depends = util-linux Exec = /etc/pacman.d/scripts/efistub-update NeedsTargets
-
Also create the corresponding script
/etc/pacman.d/scripts/efistub-update
with content
note: You might need to change the path according to your setup /boot/EFI/Linux/linux.efi#!/bin/bash -e SCRIPT_TMPDIR=$(mktemp -d) ROOT_PARTUUID="$(findmnt --noheadings --output PARTUUID --target /)" trap "{ rm -rf $SCRIPT_TMPDIR; }" EXIT HUP INT QUIT TERM STOP PWR pushd "$SCRIPT_TMPDIR" > /dev/null cat <<EOF > kernel-command-line.txt root=PARTUUID=$ROOT_PARTUUID rw EOF objcopy \ --add-section .osrel="/usr/lib/os-release" --change-section-vma .osrel=0x20000 \ --add-section .cmdline="kernel-command-line.txt" --change-section-vma .cmdline=0x30000 \ --add-section .splash="/usr/share/systemd/bootctl/splash-arch.bmp" --change-section-vma .splash=0x40000 \ --add-section .linux="/boot/vmlinuz-linux" --change-section-vma .linux=0x2000000 \ --add-section .initrd="/boot/initramfs-linux.img" --change-section-vma .initrd=0x3000000 \ "/usr/lib/systemd/boot/efi/linuxx64.efi.stub" "linux.efi" rm --force /boot/EFI/Linux/linux.efi cp linux.efi /boot/EFI/Linux/ popd > /dev/null
-
Make the script executable
chmod +x /etc/pacman.d/scripts/efistub-update
Need to add intel-microcode as described here - https://gist.github.com/CarbonChauvinist/0d83f80037469aa4ef6cbf0619e865ee#file-efistub-dell-precision-5510-L7-L8