🛠 Démarrer sur un SSD NVMe et récupérer un bootloader cassé
Objectives
Install the system on an NVMe SSD connected to the PCIe 2.0 ×1 (FPC) connector of the Raspberry Pi 5, configure the EEPROM bootloader boot order, and learn how to restore a bootloader to a working state via USB recovery mode (rpiboot) in case of a bricked device.
Hardware
- Raspberry Pi 5 (4-16 GB) + official 27 W power supply
- M.2 HAT or HAT+ compatible case with NVMe SSD (the FPC connector is disabled unless a HAT+ is detected or
dtparam=pciex1is set) - microSD card reader + USB-C data cable for recovery mode
- PC with
rpiboot(rpiboot package / Linux utility) installed
Complete code
# 1) Activer le contrôleur PCIe côté OS
sudo raspi-config -> Advanced -> PCIe -> Boot Original Firmware
# ou manuellement dans /boot/firmware/config.txt :
grep -q '^dtparam=pciex1$' /boot/firmware/config.txt || \
echo 'dtparam=pciex1' | sudo tee -a /boot/firmware/config.txt
# 2) Copier le système en cours sur le NVMe (après redémarrage)
sudo apt install -y nvme-cli rsync
lsblk | grep nvme
sudo rsync -aHAXx --info=progress2 / /mnt/nvme/ # NVMe monté, /boot inclus
# 3) Ordre de boot EEPROM : SD -> USB -> NVMe, et sonde PCIe sans HAT+
sudo rpi-eeprom-config --edit
# BOOT_ORDER=0xf416
# PCIE_PROBE=1
sudo rpi-eeprom-config | grep -E 'BOOT_ORDER|PCIE_PROBE'
# 4) Recouvrement : bootloader EEPROM effacé/cassé
# Éteindre, maintenir le bouton PWR_ON, brancher USB-C vers le PC, puis :
sudo rpiboot -d /usr/share/rpiboot/msd
# La carte apparaît comme lecteur USB : réécrire l'EEPROM avec
# Raspberry Pi Imager -> Bootloader administration (ou rpi-eeprom-update).
Expected verification
After rebooting, lsblk shows the root on /dev/nvme0n1 and dmesg | grep -i nvme traces the PCIe enumeration. Booting occurs without a microSD card. In recovery mode, lsusb on the PC detects a "BCM2835 Boot ROM" device and the MSD volume appears.
Common errors
- Forgetting
dtparam=pciex1or HAT+ mode: the NVMe is never enumerated, and the Pi reboots from SD. - Attempting uncertified Gen 3 mode: documented instabilities and random disconnections; stay on Gen 2.
- Insufficient power supply: an NVMe SSD consumes peak power; with a non-5 V/5 A power supply, the USB/PCIe budget is limited to 600 mA.
- Using rsync without mounting /boot/firmware separately: the kernel remains on the SD; check
findmnt /boot/firmware. - Confusing rpiboot recovery with image rewriting: rpiboot only repairs the EEPROM bootloader, not the system.
- Using a charge-only USB-C cable: no USB enumeration on the PC side; use a data cable.
Other tutorials for this board
Code examples for this board
led_blink.pyPythonbutton_led.pyPythonservo_sweep.pyPythondht_temp.pyPythonoled_i2c.pyPythonmcp3008_read.pyPython