Flashrom is a free and open-source command-line tool for reading, writing, verifying and erasing flash chips. It is primarily used for firmware updates and BIOS/UEFI replacement on computers and other electronic devices. Flashrom is a low-level tool that can communicate directly with the flash chip on a device’s motherboard, allowing it to read and write the firmware directly. This is useful for updating firmware on devices that do not have a firmware update utility built-in, or for creating backups of firmware before making changes.
Flashrom supports a wide variety of flash chips and is compatible with many different types of devices, including laptops, desktops, servers, and embedded systems. It also support different protocols like LPC, FWH, parallel, and SPI. Flashrom has the ability to detect the type of flash chip in a device and automatically select the correct programmer to use. It also has built-in support for hardware-based flash programmers, which allows it to write to the flash chip at a very high speed, reducing the chance of power interruption during the process. It also allows you to verify and compare the contents of the flash chip with a file, and it can also erase the contents of the flash chip.
flashrom Command Examples
1. Probe the chip, ensuring the wiring is correct:
# flashrom --programmer programmer
2. Read flash and save it to a file:
# flashrom -p programmer --read path/to/file
3. Write a file to the flash:
# flashrom -p programmer --write path/to/file
4. Verify the flash against a file:
# flashrom -p programmer --verify path/to/file
5. Probe the chip using Raspberry Pi:
# flashrom -p linux_spi:dev=/dev/spidev0.0