efibootmgr
Gentoo EFI Booting Without a Bootloader
Direct‑to‑Firmware Linux Engineering for Minimalist Power Users
A surgically clean Gentoo setup where GRUB has been thrown overboard and replaced by a custom‑compiled kernel with a built‑in command line, initramfs, LUKS, and LVM - All injected directly into UEFI.
Minimalism on steroids. No middlemen. No magic. Just pure control, raw performance, and a system that boots as if it were hard‑coded into the machine itself.
The combination that completely eliminates GRUB which must be enabled directly in the kernel
- Note that when CONFIG_CMDLINE_BOOL is activated [Y] in kernel the commandline will appears below and its here you will enter the commandline from grub we going to extract soo
Enter arguments here that should be compiled into the kernel image and used at boot time
1) If the boot loader provides a command line at boot time, it is appended to this string toform the full kernel command line, when the system boots. │ 2) However, you can use the CONFIG_CMDLINE_OVERRIDE option to change this behavior and add the GRUB_DEFUALT command directly without problem. 3) Add the kernel commandline from GRUB_CMDLINE_LINUX_DEFAULT if you used sys-boot/grub:2 earlier
Optional: If you use sys-boot/grub:2 as I did before I moved over to efibootmgr you can get the values from GRUB_CMDLINE_LINUX_DEFAULT
- Output should be something similiar as shown
Compile Kernel so we are up to date
Create initramfs - I prefer to use use genkernel over dracut here for the sake of simplicity
Now it´s time to copy our kernel image and initramfs image to EFI partition we just created
Its crucial to set the boot drive correct and also it´s partitions number, you can find it with findmt
Now we must Register the kernel and initramfs and boot partitions number in UEFI
- Notice: You will see the output from the efibootmgr command once you create it
bash
efibootmgr --create \
--disk /dev/sdb \
--part 2 \
--label "Gentoo 6.19.6" \
--loader '\vmlinuz-6.19.6-gentoo-x86_64' \
--unicode 'initrd=\initramfs-6.19.6-gentoo-x86_64.img'
Output from the verify command should be similiar to
Boot0003* Gentoo 6.19.6 HD(2,GPT,525cbfeb-c4bb-43c9-9070-75931eb00100,0x1000,0x1dc000)/\vmlinuz-6.19.6-gentoo-x86_6469006e0069007400720064003d005c0069006e0069007400720061006d00660073002d0036002e00310039002e0036002d00670065006e0074006f006f002d007800380036005f00360034002e0069006d006700
dp: 04 01 2a 00 02 00 00 00 00 10 00 00 00 00 00 00 00 c0 1d 00 00 00 00 00 eb bf 5c 52 bb c4 c9 43 90 70 75 93 1e b0 01 00 02 02 / 04 04 40 00 5c 00 76 00 6d 00 6c 00 69 00 6e 00 75 00 7a 00 2d 00 36 00 2e 00 31 00 39 00 2e 00 36 00 2d 00 67 00 65 00 6e 00 74 00 6f 00 6f 00 2d 00 78 00 38 00 36 00 5f 00 36 00 34 00 00 00 / 7f ff 04 00
data: 69 00 6e 00 69 00 74 00 72 00 64 00 3d 00 5c 00 69 00 6e 00 69 00 74 00 72 00 61 00 6d 00 66 00 73 00 2d 00 36 00 2e 00 31 00 39 00 2e 00 36 00 2d 00 67 00 65 00 6e 00 74 00 6f 00 6f 00 2d 00 78 00 38 00 36 00 5f 00 36 00 34 00 2e 00 69 00 6d 00 67 00
Check the boor order efibootmgr|grep BootOrder
Note: The output is BootOrder: 0003,0004,0000 so our new Gentoo 6.19.6 that is Boot0003 gonna boot 1th Note: You can verify the BootXXXX numbers with efibootmgr command
BootCurrent: 0000
Timeout: 0 seconds
BootOrder: 0003,0004,0000
Boot0000 USB 3.0 Device USB 3.0 Device 000000004BA8 PciRoot(0x0)/Pci(0x14,0x0)/USB(17,0)4eac0881119f594d850ee21a522c59b21180000049535048
Boot0001 USB 3.0 Device USB 3.0 Device 000000004BA8 PciRoot(0x0)/Pci(0x14,0x0)/USB(17,0)4eac0881119f594d850ee21a522c59b21180000049535048
Boot0002* \EFI\BOOT\grub.efi PciRoot(0x0)/Pci(0x14,0x0)/USB(18,0)/HD(2,MBR,0xd2447f09,0xe58d88,0x10000)/\EFI\BOOT\grub.efi0000000049535048
Boot0003* Gentoo 6.19.6 HD(2,GPT,525cbfeb-c4bb-43c9-9070-75931eb00100,0x1000,0x1dc000)/\vmlinuz-6.19.6-gentoo-x86_6469006e0069007400720064003d005c0069006e0069007400720061006d00660073002d0036002e00310039002e0036002d00670065006e0074006f006f002d007800380036005f00360034002e0069006d006700
Boot0004* Seagate Expansion Desk NAABL96K PciRoot(0x0)/Pci(0x14,0x0)/USB(16,0)4eac0881119f594d850ee21a522c59b21180000049535048
Misc
Put new entry first in boot order (replace 0003 with your new boot number)
Safety net — don't remove GRUB yet
- On reboot — select new UEFI entry manually via F9/F10/F12 on HP EliteDesk
- Verify that it boots correctly with LUKS prompt
- Check afterwards:
Delete all old entries that are bothering you