flashrom is a free, open-source command-line tool for reading, writing and verifying flash chips. It runs on Linux and other systems, supports a long list of programmers — including the popular CH341A — and recognises thousands of chips. Many technicians prefer it to vendor programming software because it is transparent, scriptable and well documented. This guide covers a practical workflow for laptop BIOS chips: installing flashrom, reading and verifying a chip, writing an image and dealing with the error messages you are most likely to see.

Installing flashrom

On most Linux distributions flashrom is available from the package manager:

sudo apt install flashrom

(or the equivalent for your distribution). Recent versions support more chips and programmers, so newer is better. Run flashrom --version to see what you have.

Permissions

Access to USB programmers usually needs root privileges or a udev rule that gives your user access to the device. Running flashrom with sudo is the simplest approach for occasional use.

Choosing the programmer

flashrom is told which programmer to use with the -p option:

ProgrammerOption
CH341A USB programmer-p ch341a_spi
FTDI-based programmers-p ft2232_spi with options for the specific device
Linux SPI device (for example on a single-board computer)-p linux_spi:dev=/dev/spidev0.0
Microcontroller-based programmers-p serprog with the device path

The CH341A is the most common in repair shops; its hardware and wiring are covered in How to Read and Write a BIOS Chip with a CH341A Programmer.

Step 1: detect the chip

With the chip connected (clip or socket):

sudo flashrom -p ch341a_spi

flashrom probes the chip and reports what it found. If it matches several possible chips, it lists them and asks you to choose one with -c:

sudo flashrom -p ch341a_spi -c "W25Q128.V"

Choose the entry whose capacity and voltage match the chip's marking. If nothing is found, see the troubleshooting section below and CH341A Cannot Detect the Chip: Causes and Fixes.

Step 2: read twice and compare

sudo flashrom -p ch341a_spi -r read1.bin
sudo flashrom -p ch341a_spi -r read2.bin
sha256sum read1.bin read2.bin

The two checksums must be identical. If they differ, the connection is unreliable — reseat the clip, check the voltage and read again. A browser-based alternative for checksums is the File Checksum Calculator (SHA-256, SHA-1, CRC32). Keep one good read as the board's original backup before doing anything else.

Step 3: write an image

When you have a correct image for the board, with its unique data transferred:

sudo flashrom -p ch341a_spi -w corrected.bin

flashrom erases the necessary blocks, writes the file and then verifies it automatically. The file must be exactly the chip's size.

Step 4: verify separately

You can also verify the chip against a file at any time:

sudo flashrom -p ch341a_spi -v corrected.bin

A successful verify means the chip contains exactly the file.

Working with regions

On Intel-based boards, flashrom can read the flash descriptor and work on individual regions:

sudo flashrom -p ch341a_spi --ifd -i bios -w corrected.bin

This writes only the BIOS region from the file, leaving the descriptor, ME and other regions on the chip untouched. It is useful when you want to replace one region but keep the rest exactly as it is. The descriptor and regions are explained in The Intel Flash Descriptor: Regions, Locks and Why It Matters.

Logging what flashrom does

flashrom prints useful details during every operation: the detected chip, its size, the programmer and each stage of erase, write and verify. Keep that output with the job by redirecting it to a file, for example by appending 2>&1 | tee flashrom-log.txt to the command. If something goes wrong, the log shows exactly which step failed and with what message.

Voltage

flashrom does not know what voltage your programmer drives. A standard CH341A runs its signals at 3.3 V. For 1.8 V chips, use a 1.8 V adapter between the programmer and the clip. Check the chip's part number before connecting.

Common error messages

Message (paraphrased)Likely causeWhat to do
No flash chip foundPoor contact, wrong pin 1, wrong voltage, chip not poweredReseat clip, check orientation and voltage
Multiple chip definitions matchSeveral compatible parts share an IDChoose one with -c
Verification failedUnreliable connection, protection, or failing chipCheck contact; check protection; retry
Erase or write failedWrite protection or status register locksCheck status register bits
Cannot open the USB devicePermissionsUse sudo or a udev rule

Write-protection bits in the chip's status register can block writing even when reading works; that is covered in SPI Flash Write Protection and Status Register Bits.

Reading in circuit

When the chip is read with a clip on the board, the programmer powers the chip — and often parts of the board through the chip's supply. That can cause:

  • unstable detection;
  • reads that differ each time;
  • programmer overcurrent.

If reads are unreliable, remove the chip and use a socket, or isolate the chip's supply where the board design allows.

A complete session, start to finish

  1. Identify the chip from its marking; note capacity and voltage.
  2. Connect the programmer, with a 1.8 V adapter if required, and check pin 1.
  3. Run detection; choose the chip with -c if asked.
  4. Read twice, compare checksums, and store the good read with the board code and date in its name.
  5. Prepare the image to write — the board's own data transferred into a clean image of the exact size.
  6. Write, let flashrom verify, then read once more and compare with the file.
  7. Disconnect, refit or reassemble, and test the board.

Following the same order every time removes most of the risk from BIOS work.

Reliability tips

  • Use a short, good-quality USB cable and connect the programmer directly to the computer.
  • Keep the clip cable short; long leads make high-speed reading unreliable.
  • If your programmer supports it, a lower SPI speed can make marginal connections work.
  • Never disconnect anything while a write is in progress.

The internal programmer

flashrom can also access the flash chip from a running laptop with -p internal. On most laptops the firmware locks the flash against writes from the operating system, so this works only on some machines and is risky if interrupted. For repair, an external programmer is the safer tool.

Example: a read that kept changing

A technician reads a 16 MB chip three times with flashrom and gets three different checksums. The chip is detected each time, so the clip is roughly in place. Measuring the chip's supply during the read shows it dropping well below 3.3 V — the programmer is powering half the board through the chip. After removing the chip and reading it in a socket, two reads match exactly. The board's original data is saved before anything else happens.

FAQ

Is flashrom better than vendor software?

It is open, scriptable and supports many chips and programmers. Vendor software can be easier for beginners. Both work.

Why does flashrom ask me to choose a chip?

Several compatible chips share the same ID. Choose the one matching your chip's capacity and voltage.

Does flashrom handle 1.8 V chips?

The software does; the hardware must supply 1.8 V. Use an adapter with a CH341A.

Can I write only part of the chip?

Yes, on Intel boards, with the flash descriptor and the --ifd -i options.

Why does writing fail when reading works?

Write protection or status register locks, or an unreliable connection. Check both.

Bottom line

flashrom gives you full control of a BIOS chip from the Linux command line. Detect the chip, read twice and compare checksums, keep the original, write only full-size images or specific regions, and verify every write. Mind the voltage and in-circuit power effects, and remove the chip when reads are unreliable.