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 [OPTIONS]

PARAMETERS

-p, --programmer [:parameters]
    Specifies the programmer device to use. It's critical for identifying the flashing interface. Parameters vary by programmer (e.g., serial port, SPI device).

-r, --read
    Reads the flash chip's contents and saves them to the specified file.

-w, --write
    Writes the specified file to the flash chip. Take extreme caution, ensure image is correct.

-v, --verify
    Verifies the contents of the flash chip against the specified file.

-e, --erase
    Erases the entire flash chip. Use with extreme caution!

-V, --version
    Displays the flashrom version.

-f, --force
    Forces certain operations that would otherwise be considered unsafe. Use with caution.

-i, --image
    Specifies a particular image to read/write from the flash chip.

-l, --layout
    Read layout from LAYOUTFILE. See flashrom(8) for file format.

-n, --noverify
    Skip verification of write process.

-c, --chip
    Specify the chip name. Overrides autodetection.

-d, --debug
    Enable debug output with level.

-q, --quiet
    Suppresses most output.

DESCRIPTION

flashrom is a utility for identifying, reading, writing, verifying and erasing flash chips. It's often used to update BIOS or firmware on various systems. It supports a wide range of chipsets, motherboards, and flash devices. The program attempts to automatically detect the flash chip and associated hardware, allowing users to easily backup or update firmware images.
It is critical to ensure the correct flash image is used, and the program is configured appropriately to avoid bricking a device. flashrom provides options for chip detection, read/write operations, and verification to help ensure successful firmware manipulation. flashrom is often a crucial tool for system administrators, embedded developers, and hardware enthusiasts alike.

CAVEATS

Improper use of flashrom can render a system unusable. Always verify the flash image and programmer settings before writing.
Back up the original firmware before writing a new one.
Some hardware configurations may not be supported or may require specific parameters.

<B>SECURITY CONSIDERATIONS</B>

Firmware modifications can introduce security vulnerabilities. Ensure the source of the flash image is trusted before writing it to the flash chip. Flashing a malicious image can compromise the entire system.

<B>CHIP DETECTION</B>

flashrom uses a sophisticated algorithm to identify the flash chip. It's important to verify the detected chip information before proceeding with any write operations.

<B>POWER SUPPLY</B>

Stable power is critical during the flashing process.
Power loss during writing can brick the device.

HISTORY

flashrom evolved from earlier tools aimed at flashing BIOS chips. Its development has been driven by a community of developers seeking to support a wide range of hardware and provide a versatile tool for firmware management.
Over time, it has expanded its support to various platforms and flash chip technologies, becoming a de facto standard for many embedded systems and hardware hacking endeavors.

SEE ALSO

lspci(8), dmidecode(8)

Copied to clipboard