🛠 Boot sur carte SD, chaîne de démarrage et recouvrement
Objectives
- Understand the BCM2835 boot chain: without EEPROM or USB boot, the VideoCore ROM always reads
bootcode.binfrom the FAT partition of the full-size SD card. - Prepare a rescue card and repair a corrupted boot partition without reinstalling.
- Implement a headless recovery procedure.
Hardware
- Model A, full-size SD card (the slot is full-size, not microSD!), SD card reader on the PC.
- Raspberry Pi OS legacy 32-bit image (Buster or older; current images have dropped ARMv6 support).
balena-etcher,win32diskimager, orddfor raw writing.
Full Code
# Écrire l'image sur la carte SD (PC Linux)
sudo dd if=2021-05-07-raspios-buster-armhf.img of=/dev/sdX bs=4M status=progress conv=fsync
# Recouvrement sans réécriture : monter la partition FAT et réparer config.txt
sudo mount /dev/sdX1 /mnt/boot
mv /mnt/boot/config.txt /mnt/boot/config.txt.bak # config fautive de côté
sync && sudo umount /mnt/boot
# Indicateurs matériels : la LED verte clignote si bootcode.bin est trouvé,
# reste éteinte si la ROM ne lit rien (carte mal écrite / format incompatible)
cat /boot/config.txt | head
Expected Verification
After writing, the card has a FAT partition (~64 MB: bootcode.bin, start.elf, fixup.dat, kernel.img, config.txt) and an ext4 root partition. On boot, the green LED blinks and then the system starts; a dark LED = ROM without bootcode.bin.
Common Errors
- Writing the image to the partition (sdX1) instead of the whole disk (sdX): nothing boots.
- Using a recent Raspberry Pi OS image: the BCM2835's ARMv6 is no longer supported, use a legacy image.
- Low-quality microSD with adapter: the BCM2835 ROM is picky, prefer a real full-size card.
- Overwriting
cmdline.txt(single line!) during repair: root=PARTUUID not found, kernel panic.
Other tutorials for this board
Code examples for this board
led_blink.pyPythonbutton_led.pyPythonservo_sweep.pyPythondht_temp.pyPythonoled_i2c.pyPythonmcp3008_read.pyPython