Flashrom

From UART Wiki
Revision as of 19:50, 18 May 2025 by TheCod3r (talk | contribs) (→‎Overview)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Flashrom

Flashrom is a free and open-source utility for reading, writing, verifying, and erasing flash chips. It supports a wide range of hardware programmers and chipsets, making it popular among electronics repair professionals, firmware developers, and hackers.

Overview

Flashrom allows users to interact directly with BIOS, EEPROM, and SPI flash memory chips. It supports multiple programming hardware interfaces, including the CH341A Programmer, PCI-based programmers, USB programmers, and others. Flashrom is primarily command-line based and runs on Linux, Windows (via Cygwin or native ports), and macOS.

Features

  • Supports hundreds of flash chips from many manufacturers (Winbond, Macronix, Atmel, SST, etc.)
  • Supports many hardware programmers including CH341A, Bus Pirate, TL866, Dediprog, and more
  • Can read, write, verify, and erase flash memory
  • Supports SPI, I²C, LPC, FWH, and parallel flash interfaces
  • Supports dumping BIOS and firmware for backup or modification
  • Open-source under the GNU General Public License (GPL)

Supported Hardware

Flashrom supports a variety of programmer hardware, including:

  • CH341A Programmer (USB-based)
  • Bus Pirate
  • TL866 Programmer
  • Dediprog SF100
  • Raspberry Pi GPIO interface
  • Many PCI and LPC programmers

For a complete and up-to-date list of supported programmers, see the official Flashrom documentation: Flashrom Supported Hardware

Installation

Linux

Most Linux distributions include Flashrom in their repositories. To install:

sudo apt-get install flashrom    # Debian/Ubuntu  
sudo yum install flashrom        # Fedora  
sudo pacman -S flashrom          # Arch Linux  

Windows

Flashrom can be built using Cygwin or available as a pre-built binary from third-party sources. Native Windows ports exist but might be less stable.

macOS

Flashrom can be compiled from source or installed via package managers like Homebrew:

brew install flashrom

Basic Usage

Flashrom is a command-line tool. Common commands include:

  • Detect the programmer and chip:
flashrom -p ch341a_spi
  • Read the chip contents to a file:
flashrom -p ch341a_spi -r backup.bin
  • Write a file to the chip:
flashrom -p ch341a_spi -w modified.bin
  • Verify the chip contents against a file:
flashrom -p ch341a_spi -v backup.bin

Replace `ch341a_spi` with the programmer you are using.

Safety Tips

  • Always backup the chip before writing.
  • Make sure you use the correct programmer and chip identification.
  • Use a reliable power source and avoid disconnecting the programmer during operations.
  • Use a 1.8V Adapter if your chip requires low-voltage programming.

Troubleshooting

  • If Flashrom cannot detect the chip, check connections and try using a different programmer or interface.
  • On Linux, you might need to run Flashrom as root (using `sudo`).
  • Ensure your user has permissions to access USB devices.

Documentation and Resources

Related Pages