flashrom
Program/update firmware (BIOS, UEFI) on flash chips
TLDR
Probe the chip, ensuring the wiring is correct
Read flash and save it to a file
Write a file to the flash
Verify the flash against a file
Probe the chip using Raspberry Pi
SYNOPSIS
flashrom [options]
Examples:
flashrom -p internal -r bios.rom
flashrom -p internal -w new_bios.rom
flashrom -p ch341a_spi -c 'MX25L6406E/MX25L6408E' -r spi_dump.bin
PARAMETERS
-p, --programmer <type>
Specify the programmer device to use (e.g., 'internal', 'ch341a_spi', 'ft2232_spi'). Use '-L' for a list of supported programmers.
-r, --read <filename>
Read the contents of the flash ROM chip and save it to the specified file.
-w, --write <filename>
Write the contents of the specified file to the flash ROM chip. This command automatically erases and verifies unless --noverify is used.
-E, --erase
Erase the flash ROM chip completely. Requires confirmation unless --force is used.
-V, --verify
Verify the chip contents against the specified file (usually used after a write operation). Implied by --write unless --noverify is present.
-c, --chip <chipname>
Force a specific flash chip. Use '-L' for a list of supported chips. Useful if auto-detection fails.
-L, --list-programmers
List all supported programmers and chips.
-i, --image <name>
Operate only on a specific region/image defined in a layout file (e.g., 'BIOS', 'ME', 'GBE'). Requires -L or --ifd/--fmap.
--ifd
Interpret the image as an Intel Firmware Descriptor (IFD) and operate on its regions. Often used with -i.
--fmap
Interpret the image as an FMAP layout and operate on its regions. Often used with -i for coreboot/Libreboot firmware.
--host-bios
Operate specifically on the host BIOS region of the IFD.
-F, --force
Force the operation, overriding certain safety checks (e.g., chip ID mismatch, erase confirmation). Use with extreme caution.
-v, --verbose
Enable verbose output, providing more detailed information during the operation.
-h, --help
Display a brief help message and exit.
DESCRIPTION
flashrom is a versatile, open-source utility for identifying, reading, writing, verifying, and erasing flash ROM chips. It's widely used for managing BIOS/UEFI firmware on motherboards, but also supports firmware on network cards, FPGAs, and various embedded devices. By supporting a broad range of hardware programmers (like internal mainboard programmers, external SPI, and parallel port devices) and thousands of flash chips, flashrom provides a free and open-source alternative to proprietary vendor-specific tools. It's a critical tool for projects like coreboot and Libreboot, enabling users to install, update, or back up custom or alternative firmware. Due to its direct hardware access, extreme caution is advised during use.
CAVEATS
Using flashrom carries significant risks. Incorrect usage, unsupported hardware, or power interruptions during flashing can permanently 'brick' your device, rendering it unusable. Always ensure you have a backup of your existing firmware before attempting any write or erase operations. flashrom often requires root privileges to access hardware directly, which adds another layer of risk if not used carefully. Verify chip and programmer compatibility meticulously before proceeding.
SUPPORTED PROGRAMMERS
flashrom supports a wide range of hardware programmers, including internal (mainboard) programmers (e.g., Intel FWH/LPC, AMD SPI, Intel SPI), external SPI programmers (e.g., CH341A, FT2232-based devices, Bus Pirate), parallel port programmers (e.g., BLC-style, DediProg), and others like Raspberry Pi GPIO, Arduino, and various USB-based devices. The exact list depends on the flashrom build and connected hardware.
SUPPORTED CHIPS
flashrom boasts support for thousands of flash ROM chips from numerous manufacturers, encompassing NOR flash chips (like those from Macronix, Winbond, Spansion, SST) and certain NAND flash chips. It supports chips with various interfaces, including SPI, Parallel, and FWH/LPC. The continuous development ensures ongoing support for new and legacy hardware.
TYPICAL USE CASES
The primary uses for flashrom include backing up existing BIOS/UEFI firmware, updating firmware to newer versions (especially for custom or open-source firmware like coreboot/Libreboot), restoring corrupted firmware, or flashing firmware onto network cards, embedded systems, and other devices containing flashable ROMs.
HISTORY
Development of flashrom began around 2007, primarily driven by the coreboot project community. Its creation aimed to provide a robust, free, and open-source tool for flashing various firmware chips, circumventing the need for proprietary and often Windows-only vendor utilities. It quickly evolved to support a vast array of flash ROM chips and hardware programmers, becoming an indispensable tool for firmware enthusiasts, developers, and those seeking to install open-source firmware like coreboot or Libreboot.