LinuxCommandLibrary

flash

Write data to a flash memory device

TLDR

Open a menu of available flashcard decks for selection

$ flash
copy

Display information about the flashcard system
$ flash -i
copy

Change the previewer from default bat to cat
$ flash -p [cat]
copy

Display help
$ flash -h
copy

Display version
$ flash -v
copy

SYNOPSIS

flashrom [OPTIONS] [-r <file> | -w <file> | -E | -V | -D | -L]

PARAMETERS

-h, --help
    Displays a concise help message and exits.

-R, --read-firmware
    Reads the entire firmware content from the flash chip.

-E, --erase-firmware
    Erases the entire content of the flash chip.

-W, --write-firmware
    Writes the specified firmware image to the flash chip.

-V, --verify-firmware
    Verifies the firmware on the chip against a given image file.

-D, --detect
    Only detects the flash chip(s) present without performing other operations.

-L, --list-supported
    Lists all flash chips and programmers supported by flashrom.

-p <programmer>[:<options>], --programmer <programmer>[:<options>]
    Specifies the hardware programmer device to use (e.g., internal, ch341a_spi) and optional programmer-specific parameters.

-c <chipname>, --chip <chipname>
    Forces flashrom to use a specific flash chip name instead of auto-detection.

-r <filename>, --read <filename>
    Specifies the file to which the firmware content will be read and saved.

-w <filename>, --write <filename>
    Specifies the file from which the firmware image will be written to the chip.

-v, --verbose
    Increases the verbosity level of the output for debugging and detailed information.

-q, --quiet
    Suppresses most output, showing only critical error messages.

-z, --disable-write-protect
    Attempts to disable software write protection on the flash chip.

-f <offset>, --offset <offset>
    Starts the read or write operation at a specific offset within the firmware image or chip.

-V, --version
    Displays the program version information and exits.

DESCRIPTION

flashrom is a free, open-source command-line utility designed for detecting, reading, writing, verifying, and erasing flash chips. It primarily targets BIOS/firmware chips found on motherboards, network cards, and various embedded systems, supporting a wide range of chip types (e.g., SPI, Parallel, LPC, FWH) and programmers (internal hardware controllers, external USB/parallel port devices). Unlike vendor-specific tools that often rely on the system BIOS, flashrom communicates directly with the flash chip, offering greater control, broader chip support, and improved reliability. It's an indispensable tool for updating firmware, flashing custom BIOS like Coreboot, or recovering from corrupted firmware, making it a critical utility for system administrators and hardware enthusiasts.

CAVEATS

Using flashrom incorrectly can permanently damage ('brick') your hardware, particularly the BIOS/firmware chip. Always back up existing firmware before attempting write operations. Ensure a stable power supply throughout the flashing process. It typically requires root privileges to access hardware directly, and support for specific flash chips and programmers varies. Always consult the flashrom documentation and supported hardware lists.

PROGRAMMER SELECTION

The -p option is critical for specifying the correct hardware interface (programmer) that flashrom will use to communicate with the flash chip. Examples include internal (for chips on the same system board), ch341a_spi (for external USB programmers), or serprog (for serial programmers). Selecting the wrong programmer can lead to errors or hardware damage.

SAFETY PRECAUTIONS

Before any write or erase operation, always perform a full backup of your current firmware using flashrom -r <backup_file>. Ensure your system has a stable and uninterrupted power supply throughout the flashing process to prevent data corruption and potential hardware damage. Verify the integrity of the written firmware using -V after writing.

SUPPORTED HARDWARE

flashrom supports a vast, but not exhaustive, array of flash chips and programmers. For an up-to-date and complete list of supported devices, refer to the official flashrom website (e.g., flashrom.org/Supported_hardware) or use the -L option to list supported devices on your system.

HISTORY

flashrom was initiated in 2007 by Carl-Daniel Hailfinger with the goal of creating an open-source, vendor-agnostic utility for flashing BIOS/firmware chips. It emerged as a robust alternative to proprietary tools, often providing more direct control and wider chip support. Its development has been crucial for projects like Coreboot, allowing users to replace proprietary BIOS with open-source alternatives. It continues to be actively maintained, expanding its support for new hardware and flash technologies.

SEE ALSO

dd(1), lshw(1), lspci(8), lsusb(8), fwupd(1)

Copied to clipboard