Skip to content

Instantly share code, notes, and snippets.

View bradfa's full-sized avatar
⚔️

Andrew Bradford bradfa

⚔️
View GitHub Profile
@benjaminblack
benjaminblack / initramfs-hook-script-to-copy-kernel-and-initrd-to-esp.md
Last active March 23, 2024 13:03
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 / gist:3812485
Created October 1, 2012 15:24
Send some patches from git
git format-patch --cover-letter --subject-prefix="PATCH v2" -o <my_patch_dir_v2> foo..bar
Edit created files in <my_patch_dir> to add things like "Changes since vX" and to fill in patch 0/X info with title and summary.
git send-email <my_patch_dir_v2>
Only add --cover-letter if I want a PATCH 0/X first email which all following patches reply to.
Only add --subject-prefix if "[PATCH]" isn't the prefix I want.
Add --compose to send-email to spawn text editor to write some nice things if didn't use --cover-letter
@bradfa
bradfa / format_sd.sh
Last active August 2, 2016 15:20
BeagleBone format_sd Script
#!/bin/bash
# Format an SD card for use in a TI development kit to boot u-boot and Linux.
# The layout is a small 32 MB FAT partition and a larger (remainder of device)
# ext4 partition. The FAT partition starts at 1 MB and the ext4 partition
# immediately follows.
# Stop execution on any error condition
set -e