LinuxCommandLibrary

flashrom

Program/update firmware (BIOS, UEFI) on flash chips

TLDR

Probe the chip, ensuring the wiring is correct

$ flashrom [[-p|--programmer]] [programmer]
copy

Read flash and save it to a file
$ flashrom [[-p|--programmer]] [programmer] [[-r|--read]] [path/to/file]
copy

Write a file to the flash
$ flashrom [[-p|--programmer]] [programmer] [[-w|--write]] [path/to/file]
copy

Verify the flash against a file
$ flashrom [[-p|--programmer]] [programmer] [[-v|--verify]] [path/to/file]
copy

Probe the chip using Raspberry Pi
$ flashrom [[-p|--programmer]] [linux_spi:dev=/dev/spidev0.0]
copy

SYNOPSIS

flashrom [-p programmer] [-r|--read file] [-w|--write file] [-v|--verify file] [-E|--erase] [options]

PARAMETERS

-V, --verbose
    Increase verbosity (repeat for more detail)

-q, --quiet
    Reduce verbosity

-h, --help
    Show help

--version
    Print version info

-p, --programmer
    Use specified programmer (e.g. internal, ch341a_spi)

--programmer-override
    Override programmer parameters

-c, --chip
    Use specific chip type

-r, --read
    Read flash into file

-w, --write
    Write file to flash

-v, --verify
    Verify flash against file

-E, --erase
    Erase entire flash

-l, --lock
    Lock/unlock lockbits

--wp-disable
    Disable write protection

--wp-enable
    Enable write protection

--ifd -i, --image
    Handle Intel Firmware Descriptor regions

-N, --no-write-protect
    Disable hardware write protection

region options (e.g. --fmap)
    Operate on specific flash regions

DESCRIPTION

Flashrom is a free, open-source tool for detecting, reading, writing, verifying, and erasing flash ROM chips on desktops, laptops, servers, and embedded devices.

It supports over 500 flash chip types and numerous programmers, including internal motherboard interfaces like LPC, FWH, SPI, and external hardware such as USB-based CH341A, FT2232, or Dediprog SF100.

Common uses include BIOS/UEFI firmware updates when vendor tools fail, coreboot or Libreboot installation, recovering bricked systems, or dumping firmware for analysis. Flashrom auto-detects chips and programmers where possible, with options for forced selection.

Operations include reading (-r), writing (-w), verifying (-v), erasing (-E), and locking/unlocking. It handles regions like descriptors, bootblocks, and Intel ME. Verbose output aids debugging.

While powerful, it requires root privileges and hardware access. Always backup before flashing to avoid permanent damage.

CAVEATS

High risk: Incorrect use can permanently brick hardware. Always verify chip/programmer, backup original firmware, and test on supported setups. Requires root. Some chipsets have hardware write protection.

SUPPORTED PROGRAMMERS

Run flashrom -p ? for list (e.g. internal, dummy, ft2232_spi, ch341a_spi, dediprog).

DETECTION

flashrom -p internal --probe-only to safely detect chip without changes.

HISTORY

Developed since 2006 for the coreboot project to flash firmware without proprietary tools. Now maintained by coreboot community, supports 500+ chips and 50+ programmers. Major releases align with coreboot milestones; widely used in open-source firmware ecosystems.

SEE ALSO

coreboot(8), fwupd(8), flashcp(8), dmidecode(1)

Copied to clipboard