🛠 Provisionner une flotte de CM4 : secure boot et images personnalisées

Raspberry Pi Compute Module 4 (CM4, 2020) — Board Sheet · avance · Schéma : IMG-compute-module-4-avance-2-boot-secure-flotte-cm4.svg — chaîne de production simplifiée : un PC hôte lance rpi-sb-provisioner vers un CM4 en mode rpiboot ; à côté, pi-gen fabrique une image custom ; des clés (root public key) sont dessinées en coffret sécurisé.

Objectives

For an industrial deployment, the official documentation recommends pinning a bootloader release, defining BOOT_ORDER, and using the Raspberry Pi Secure Boot Provisioner (rpi-sb-provisioner) + pi-gen for custom images. This tutorial generates a key chain, provisions a CM4 for secure boot (it will only boot code signed by your keys), and lays the groundwork for a reproducible fleet.

Hardware

Complete Code

#!/usr/bin/env bash
# sb-provision-cm4.sh — secure boot d'un CM4 (flux officiel rpi-sb-provisioner).
set -euo pipefail
git clone https://github.com/raspberrypi/rpi-sb-provisioner && cd rpi-sb-provisioner
make

# 1) Générer l'arbre de clés (root + signing) — À SAUVEGARDER HORS LIGNE
./rpi-sb-provisioner generate-keys

# 2) CM4 en mode rpiboot (J2 posé) : écrire les clés publiques dans l'OTP du module
./rpi-sb-provisioner write-public-keys

# 3) Écrire un bootloader signé dans l'EEPROM (bootloader épinglé = bonne pratique)
./rpi-sb-provisioner write-bootloader

# 4) Les images destinées à la flotte doivent désormais être signées avec vos clés
#    (pi-gen + rpi-sb-provisioner sign-image), puis écrites sur eMMC via rpiboot.

Expected Verification

After provisioning, ./rpi-sb-provisioner verify-bootloader confirms the signature; a provisioned module refuses to boot a standard unsigned image (the ACT LED remains off, no output) — this proves that secure boot is working. Keep a non-provisioned "reference" machine for comparison.

Common Errors

Other tutorials for this board

Code examples for this board

← Back to the board 🛠 All tutorials