LinuxCommandLibrary

flashrom

TLDR

Probe the chip to ensure wiring is correct

$ flashrom -p [programmer]
copy
Read flash contents and save to a file
$ flashrom -p [programmer] -r [path/to/backup.bin]
copy
Write a file to the flash chip
$ flashrom -p [programmer] -w [path/to/firmware.bin]
copy
Verify flash contents against a file
$ flashrom -p [programmer] -v [path/to/file.bin]
copy
Erase the flash chip
$ flashrom -p [programmer] -E
copy
Probe using Raspberry Pi SPI
$ flashrom -p linux_spi:dev=/dev/spidev0.0
copy
Write only a specific region from a layout file
$ flashrom -p [programmer] -l [layout.txt] -i [region_name] -w [file.bin]
copy

SYNOPSIS

flashrom [-p programmer] [-r|-w|-v|-E] [file] [options]

DESCRIPTION

Flashrom is a utility for identifying, reading, writing, verifying, and erasing flash chips. It supports BIOS/EFI firmware flashing directly on the motherboard (in-system programming) as well as external programmers connected via USB, SPI, or parallel port.
The tool supports over 500 flash chips and 40+ programmer types including internal motherboard access, USB devices (CH341A, Dediprog), SPI programmers (Raspberry Pi, Bus Pirate), and network card-based programmers.

PARAMETERS

-p, --programmer name[:params]

Specify programmer device (required for chip access)
-r, --read file
Read flash ROM contents and save to file
-w, --write file
Write file contents to flash ROM
-v, --verify file
Verify flash ROM contents against file
-E, --erase
Erase the entire flash chip
-c, --chip name
Probe only for a specific flash chip model
-l, --layout file
Read ROM layout from file for partial flashing
-i, --include region
Only read, write, or verify specified region
-f, --force
Override safety checks (use with caution)
-n, --noverify
Skip automatic verification after writing
--flash-name
Display detected flash chip name
--flash-size
Display detected flash chip size

CAVEATS

Always create a backup before writing new firmware with -r. Incorrect flashing can brick your device. Laptop internal flashing is particularly risky and requires explicit -f flags. Some operations need root privileges. Verify programmer compatibility with your specific flash chip before attempting writes.

HISTORY

Flashrom originated from the LinuxBIOS (now coreboot) project around 2005 as a tool to flash open-source firmware. It evolved into a standalone project supporting a wide range of hardware. The project is community-maintained and has become essential for firmware development, coreboot installations, and chip recovery operations.

SEE ALSO

dd(1), hexdump(1), [coreboot](https://coreboot.org)

Copied to clipboard