Skip to content

Instantly share code, notes, and snippets.

View bradfa's full-sized avatar
⚔️

Andrew Bradford bradfa

⚔️
View GitHub Profile
@bradfa
bradfa / initramfs-hook-script-to-copy-kernel-and-initrd-to-esp.md
Created December 22, 2021 18:10 — forked from benjaminblack/initramfs-hook-script-to-copy-kernel-and-initrd-to-esp.md
Initramfs hook script to copy kernel and initrd.img to EFI System Partition

If the Linux kernel is compiled with the EFI stub loader (grep CONFIG_EFI_STUB /boot/config-*), then an EFI BIOS can boot the kernel directly, without the need for a bootloader like GRUB. This only requires that the kernel and the initrd exist on the EFI partition. The EFI boot menu and boot order can be managed with the command-line utility efibootmgr.

Copying the kernel image and initrd onto the EFI partition the first time is simple; the problem is keeping them up-to-date as the system is updated. In particular, lots of software packages can trigger the initrd to be rebuilt. The most recent kernel image and initrd need to be copied to the EFI partition every time they are updated.

The Debian Linux Kernel Handbook documents initramfs hooks, stating that "Packages for boot loaders that need to be updated whenever the files they load are modified must also install hook scripts in /etc/initramfs/post-update.d

@bradfa
bradfa / Exact Steps: Modern MSP430 GCC Build.md
Last active February 24, 2024 00:44 — forked from 0/msp430-elf.md
Building a GCC cross-compiler for the MSP430.