🛠 Bootloader EEPROM du CM4 : maîtriser BOOT_ORDER via usbboot

Raspberry Pi Compute Module 4 (CM4, 2020) — Board Sheet · intermediaire · Schéma : IMG-compute-module-4-intermediaire-1-ordre-boot-eeprom-cm4.svg — CM4 sur IO Board avec jumper J2 (nRPI_BOOT) posé, câble micro-USB J11 relié à un PC hôte exécutant rpiboot ; une puce EEPROM sur le module est mise en évidence avec les valeurs BOOT_ORDER 0xf1, 0xf2, 0xf15, 0xf6.

Objectives

The CM4 is the first Compute Module with a bootloader in an SPI EEPROM embedded on the module. Concrete consequences: recovery.bin is never executed from eMMC/SD, the rpi-eeprom-update service is disabled by default, and any modification of the boot order goes through usbboot/rpiboot. This tutorial: read the bootloader version, change BOOT_ORDER (0xf1 SD/eMMC, 0xf2 network, 0xf15 USB→eMMC, 0xf6 NVMe) via the recovery flow, then lock the EEPROM against writing.

Hardware

Complete code

#!/usr/bin/env bash
# bootorder-cm4.sh — reprogrammer BOOT_ORDER de l'EEPROM d'un CM4 (flux officiel).
set -euo pipefail
git clone --depth 1 https://github.com/raspberrypi/usbboot && cd usbboot
cd recovery
cat > boot.conf <<'EOF'
[All]
BOOT_ORDER=0xf15
EOF
./update-pieeprom.sh                     # régénère pieeprom.bin depuis boot.conf
cd .. && sudo ./rpiboot -d recovery      # écrit l'EEPROM (J2 posé, EEPROM_nWP non maintenu bas)

Then, once the module has restarted normally (J2 removed):

vcgencmd bootloader_version | head -1    # la date doit correspondre au build fraîchement écrit
grep -i boot /var/log/bootstrap.log 2>/dev/null || true
# Durcissement production : protection en écriture
echo 'eeprom_write_protect=1' | sudo tee -a /boot/firmware/config.txt

Expected verification

vcgencmd bootloader_version displays the date of the regenerated build; with BOOT_ORDER=0xf15, plugging in a bootable USB drive makes the module boot from it with eMMC fallback. The boot log (uart or journalctl -b) traces the boot order used.

Common errors

Other tutorials for this board

Code examples for this board

← Back to the board 🛠 All tutorials