🛠 Remettre une Zero 2 W en état de boot : usbboot et boot files

Raspberry Pi Zero 2 W (2021) — Board Sheet · avance · Schéma : IMG-zero-2w-avance-1-recovery-usb-usbboot.svg — Zero 2 W sans carte microSD reliée à un PC par son port données, outil rpiboot listant un périphérique 0a5c:2711, microSD montée séparément sur le PC.

Objectives

Master the recovery of a card that no longer boots. The Zero 2 W does NOT have an EEPROM: the boot flow reads OTP then “bootcode.bin” on the SD card’s FAT partition. An erroneous config.txt = no image; a corrupted SD card = nothing works. But the Zero line has a way out: without an SD card, it boots in USB device mode and rpiboot then exposes the microSD as mass storage — everything can be repaired from a PC.

Hardware

Complete code

# 1) Récupération via USB device mode (aucune SD dans la Zero 2 W) :
git clone --depth=1 https://github.com/raspberrypi/usbboot
cd usbboot && make
sudo ./rpiboot
# La Zero 2 W (OTGID flottant) énumère 0a5c:2711 et la microSD interne
# apparaît comme un disque de masse sur le PC.

# 2) Réparer le contenu de la partition boot (FAT) :
sudo mkdir -p /mnt/sdboot && sudo mount /dev/sdX1 /mnt/sdboot
ls /mnt/sdboot          # bootcode.bin, start.elf, config.txt...

# config.txt douteux ? Restaurer une ligne minimale ou retirer l'overlay fautif :
sudo cp /mnt/sdboot/config.txt /mnt/sdboot/config.txt.bak
sudo sed -i 's/^dtoverlay=pas-bon/# dtoverlay=pas-bon/' /mnt/sdboot/config.txt

# 3) Recopier une image neuve par-dessus la carte (dernier recours) :
sudo dd if=2024-*raspberry-pi-os-lite.img of=/dev/sdX bs=4M status=progress conv=fsync

Expected verification

With “lsusb” you see “0a5c:2711” before rpiboot, then a new disk appears after launching rpiboot: the card’s microSD is accessible. After repairing config.txt and rebooting the card, the activity LED blinks at startup and SSH comes back. Full test: “vcgencmd versioncheck” confirms consistent boot files.

Common errors

Other tutorials for this board

Code examples for this board

← Back to the board 🛠 All tutorials