firmware-boot-chainlisted
Install: claude install-skill Midstall/claude-for-hardware
# Firmware Boot Chain
## Overview
A boot chain is a relay of stages, each responsible for setting up just enough state to hand control to the next: ROM to firmware (SBI/UEFI), firmware to bootloader, bootloader to OS. Every handoff has a contract: where the next stage lives, what registers/tables it expects, and what memory is already set up.
**Core principle:** Each stage owns a contract with the next. Most boot failures are a broken contract at exactly one handoff, so isolate which handoff fails before theorizing about the stage itself.
## When to Use
- Writing or porting firmware (RISC-V SBI, UEFI services, ACPI table provision)
- Chaining a bootloader (Limine, GRUB, U-Boot) into an OS kernel
- A stage loads but the next never starts, or starts and immediately faults
- Adding measured boot / TPM PCR extension to the chain
- Discovering peripherals from a device tree or ACPI at firmware time
## Map The Handoffs First
Write down the relay before debugging:
```
ROM -> firmware (SBI/UEFI) -> bootloader -> OS kernel
provides: SBI calls, loads: expects: a0=hartid,
memory map, ACPI/DTB kernel+initrd a1=DTB/ACPI ptr, MMU off
```
For each arrow, name: the entry address, the register/pointer contract, and the memory/translation state. The failing arrow is your bug location.
## Firmware Responsibilities
- **Provide the platform description.** Hand the next stage a device tree (DTB) or ACPI tables describing memory, CPUs, and peripherals. Prob