flashrom
Identifie, lit, écrit, vérifie et efface les puces flash présentes sur les cartes mères, BIOS/UEFI et appareils embarqués. Identifies, reads, writes, verifies, and erases flash chips found on motherboards, BIOS/UEFI, and embedded devices.
↗ https://www.flashrom.orgOverview
flashrom is a command-line utility for detecting and manipulating flash memory chips — the SPI/parallel/LPC flash that holds BIOS, UEFI, EC firmware, or embedded device firmware. In hardware and firmware security work it’s the go-to for dumping a chip for analysis, restoring an image after a bricked flash, or patching firmware in place using a hardware programmer (CH341A, Bus Pirate, FT2232, Raspberry Pi GPIO, etc).
Common Usage
Detect the programmer and chip without touching flash contents
flashrom -p ch341a_spi
Read the full chip contents to a file
flashrom -p ch341a_spi -r dump.bin
Verify a dump matches current chip contents
flashrom -p ch341a_spi -v dump.bin
Write an image back to the chip
flashrom -p ch341a_spi -w modified.bin
Erase the entire chip
flashrom -p ch341a_spi -E
Programmer Selection
Raspberry Pi GPIO as SPI programmer
flashrom -p linux_spi:dev=/dev/spidev0.0,spispeed=1000
FTDI FT2232H-based programmer
flashrom -p ft2232_spi:type=232H
Internal programmer (dangerous — touches the running system’s own flash)
flashrom -p internal
Bus Pirate
flashrom -p buspirate_spi:dev=/dev/ttyUSB0
Tips
- Always
-rtwice and diff the two dumps before trusting a read — bad clip contacts cause silent corruption - Use
-c <chipname>to force chip detection if autodetect picks the wrong part --flash-sizeand-L(list supported chips) help when working with unfamiliar hardware- Prefer an external programmer over
internalwhen the target board is untrusted or possibly bricked
Help / Man page
Usage: flashrom [-h|-R|-L|-p <programmername>[:<parameters>] [-c <chipname>]
[(-r|-w|-v) <file>] [(-E|-x)] [-c <chipname>] [-l <file>]
[-i <image>[:<file>]] [-n] [-N] [-f]] [-V[V[V]]] [-o <logfile>]
-h display this help text and exit
-R print version and exit
-L list supported programmer names and exit
-p <name>[:parameters] specify the programmer device
-c <chipname> probe only for specified flash chip
-r <file> read flash and save to <file>
-w <file> write <file> to flash
-v <file> verify flash against <file>
-E erase flash chip
-x extract layout regions to files
-l <file> read ROM layout from <file>
-i <image>[:<file>] only access image <image> from layout
-n do not auto-verify after write
-N do not automatically set write protect
-f force operation
-V verbose output (-VV, -VVV for more)
-o <logfile> write log to <logfile>
Vue d’ensemble
flashrom est un utilitaire en ligne de commande pour détecter et manipuler les puces de mémoire flash : le flash SPI/parallèle/LPC qui contient le BIOS, l’UEFI, le firmware EC ou le firmware d’un appareil embarqué. Dans le travail de sécurité matérielle et firmware, c’est l’outil de référence pour dumper une puce à des fins d’analyse, restaurer une image après un flash briqué, ou patcher un firmware en place à l’aide d’un programmateur matériel (CH341A, Bus Pirate, FT2232, Raspberry Pi GPIO, etc).
Utilisation courante
# Détecter le programmateur et la puce sans toucher au contenu du flash
flashrom -p ch341a_spi
# Lire le contenu complet de la puce dans un fichier
flashrom -p ch341a_spi -r dump.bin
# Vérifier qu'un dump correspond au contenu actuel de la puce
flashrom -p ch341a_spi -v dump.bin
# Réécrire une image sur la puce
flashrom -p ch341a_spi -w modified.bin
# Effacer la puce entièrement
flashrom -p ch341a_spi -E
Sélection du programmateur
# Raspberry Pi GPIO comme programmateur SPI
flashrom -p linux_spi:dev=/dev/spidev0.0,spispeed=1000
# Programmateur basé sur FTDI FT2232H
flashrom -p ft2232_spi:type=232H
# Programmateur interne (dangereux : touche au flash du système en cours d'exécution)
flashrom -p internal
# Bus Pirate
flashrom -p buspirate_spi:dev=/dev/ttyUSB0
Conseils
- Toujours faire
-rdeux fois et comparer les deux dumps avant de leur faire confiance : de mauvais contacts de clip provoquent une corruption silencieuse - Utiliser
-c <chipname>pour forcer la détection de la puce si l’auto-détection choisit la mauvaise référence --flash-sizeet-L(lister les puces supportées) aident lors du travail avec du matériel peu familier- Préférer un programmateur externe à
internalquand la carte cible n’est pas fiable ou potentiellement briquée
Aide / Page de manuel
Usage: flashrom [-h|-R|-L|-p <programmername>[:<parameters>] [-c <chipname>]
[(-r|-w|-v) <file>] [(-E|-x)] [-c <chipname>] [-l <file>]
[-i <image>[:<file>]] [-n] [-N] [-f]] [-V[V[V]]] [-o <logfile>]
-h display this help text and exit
-R print version and exit
-L list supported programmer names and exit
-p <name>[:parameters] specify the programmer device
-c <chipname> probe only for specified flash chip
-r <file> read flash and save to <file>
-w <file> write <file> to flash
-v <file> verify flash against <file>
-E erase flash chip
-x extract layout regions to files
-l <file> read ROM layout from <file>
-i <image>[:<file>] only access image <image> from layout
-n do not auto-verify after write
-N do not automatically set write protect
-f force operation
-V verbose output (-VV, -VVV for more)
-o <logfile> write log to <logfile>