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]... [filename]

PARAMETERS

-h, --help
    Show help message and exit

-V, --version
    Print program version

--license
    Print license information

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

--programmer-override
    Override auto-detected programmer address

--internal-off
    Do not use internal programmer

--internal-auto
    Try internal programmer first

-i, --ifd
    Target Intel Flash Descriptor regions

--wp-status
    Print/write-protect status

--wp-range
    Print write-protect ranges

--layout
    Read layout file for regions

-c, --chip
    Use specific chip (e.g. W25Q64.V)

--chip-info
    More info on detected chip

-l, --list-chips
    List all supported chips

--list-supported
    List programmer/chip support matrix

-N, --no-write
    Disable write operations (dry-run)

-f, --force
    Force operations (use with caution)

--wp-disable
    Disable write protection

--wp-enable
    Enable write protection at base

--wp-range
    Set specific write-protect range

-s, --slow
    Use slower, safer timing

--slow-read
    Slow read timing

-v, --verbose
    Increase verbosity

-q, --quiet
    Reduce output

-r, --read
    Read flash into file

-w, --write
    Write file to flash

-V, --verify
    Verify flash against file

-E, --erase
    Erase entire flash chip

-F
    Write then verify

-p
    Probe for chip/programmer

DESCRIPTION

flashrom is a free and open-source utility for identifying, reading, writing, verifying, and erasing flash ROM chips. While there is no standard Linux command named exactly flash, flashrom is the primary tool for this purpose in Linux environments.

It supports over 500 flash chips and more than 80 programmers (hardware interfaces like internal CPU programmer, USB devices, SPI, etc.). Commonly used for updating BIOS/UEFI firmware on motherboards, flashing router firmware, PGAs, FPGAs, and SSDs. It auto-detects chips and programmers where possible.

Key features include: backup before flash, verify after write, force modes for locked chips, region-specific operations (e.g., descriptor, BIOS), and verbose logging. Requires root privileges for hardware access. Always backup existing content first to avoid bricking devices.

Install via package manager (e.g., apt install flashrom) or compile from source at coreboot.org.

CAVEATS

Extremely dangerous: incorrect use can permanently brick hardware. Always verify chip and programmer support first with flashrom -p internal -l. Backup with -r backup.rom. Not all programmers support all operations. May require kernel modules (e.g. spi, ft2232). Test on disposable hardware.

SUPPORTED PROGRAMMERS

internal (CPU-driven), dediprog, ft2232_spi, usbblaster, ch341a_spi, pickit2, etc. Run flashrom --list-programmers.

USAGE EXAMPLE

flashrom -p internal -r bios_backup.rom
flashrom -p internal -w new_bios.rom -v

DEBUGGING

Use --verbose --writer verbosity=3 for detailed logs. Check dmesg for hardware issues.

HISTORY

Originated as flashprog in 2002 by Stefan Reinauer for coreboot project. Renamed flashrom in 2006. Actively maintained by coreboot community with regular releases. Added support for hundreds of chips and programmers over years, driven by open-source firmware needs.

SEE ALSO

flash_erase(1), flash_eraseall(1), flashcp(1), flash_lock(1), flash_unlock(1), mtd-debug(8), ethtool(8)

Copied to clipboard