Flashing a BIOS chip with a Raspberry Pi

I made this post as a addition or supplement to my “Flashing a BIOS chip with an Arduino” post.

While doing some research online I found several articles/posts from people using a Raspberry Pi to flash SPI flash chips. Apparently the Raspberry Pi  is very suitable for this kind of thing as it has a SPI interface and is able to run linux. I was eager to try this out for myself so I got out my Pi 3 model B and got to work. For this project I used a Winbond 25X80 salvaged from a motherboard I had lying around.

Preparing the RaspberryPi

Download the latest Rasbian release, I used the Jessie Lite version.

Install the packages needed by flashrom by using the following command:

sudo apt-get install pciutils libpci-dev libusb-1.0 libusb-dev git

Build and install flashrom using the commands below:

git clone https://github.com/flashrom/flashrom.git
cd flashrom
make && make install

Next, the SPI interface must be enabled by uncommenting “#dtparam=spi=on” in the “/boot/config.txt” file.

After rebooting the spi interfaces are available under “/dev/spidev0.0”.

Connecting the Raspberry to the SPI flash chip

The table below show the connections between the RaspberryPi and the chip.

RPi pin SPI flash
25 GND
24 CS
23 SCK
21 DO
19 DI
17 VCC 3.3V and /HOLD and /WP

Al that is left is flashing the bios.

sudo flashrom -p linux_spi:dev=/dev/spidev0.0 -w YOURBIOSHERE


flashrom 0.9.9-35-gd152fb9 on Linux 4.9.35-v7+ (armv7l)
flashrom is free software, get the source code at https://flashrom.org

Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns).
Found Winbond flash chip "W25X80" (1024 kB, SPI) on linux_spi.
Reading old flash chip contents... done.
Erasing and writing flash chip... Erase/write done.
Verifying flash... VERIFIED.


  • https://github.com/flashrom/flashrom
  • https://www.flashrom.org/RaspberryPi
  • https://2600solutions.com/backing-up-flashing-bios-micro-computer-raspi-arduino/
  • http://dalincom.ru/datasheet/W25X80.pdf
  • http://diy.viktak.com/2014/07/how-to-recover-laptop-after-failed-bios.html

Flashing a bios chip with an Arduino

In this post I will describe the process I went trough of flashing the BIOS chip on a P5B motherboard using an Arduino Duemilanove. I also tried this with a Raspberry Pi, that post can be found here: https://tomvanveen.eu/flashing-bios-chip-raspberry-pi/.


My cousin gave me this motherboard and asked me to have a look at it after a failed BIOS update turned his computer into paperweight. I’ve actually attempted to fix this board before using a method described here but I eventually gave up after I realised I lacked the necessary skills and shelved the project. Fast forward a year or so I come across a post on hackaday about a Arduino based BIOS flasher and decided the time had come to give it another try.

The requirements


  • a BIOS chip compatible/supported by Flashrom, in my case a Macronix mx25L8005 (a list of all supported chips can be found here)
  • any of the supported Arduinos (I used a duemilanove):
    • any based on the ATmega328 (/168/88 will work with small changes too), like the Arduino Uno R3.
    • Arduino Mega or Mega2560, but notice that the software has a different branch for them.
  • a way to convert the 5V logic levels to 3.3V (except if 3.3V arduino, these are rarer)


  • Flashrom
  • frser-duino (formerly known as serprog-duino)
  • the AVR toolchain

Preparing the environment (I used a Ubuntu VM):

sudo apt-get install flashrom gcc-avr binutils-avr gdb-avr avr-libc avrdude git

Building flashrom

git clone --recursive git://github.com/urjaman/frser-duino
cd frser-duino

Depending on the Arduino model:

For models with a FTDI chip:

make ftdi && make flash-ftdi

For models without a FTI chip:

make u2 && make flash-u2

The process

Before you can actually flash the chip you must first connect the flasher to the chip. Some motherboards have a SPI header which makes connecting the Arduino a breeze. Other motherboards may have a removable chip which you transport to a breadboard. If your motherboard doesn’t have either one you will still be able to use this method but you might need some wires/clips specially designed for working with chips and or microprocessors.

The ASUS P5B motherboard has a SPI header located near the BIOS chip. The pinout can be seen in the picture below. Please note that pin names can differ between chips ( i.e. the SO pin can also be named MISO or DO depending on the chip).

Pinout (depends on the chip)

Connecting the Arduino to the chip

Arduino SPI
12 SO
11 SI
10 CS
13 SCK
3.3V VCC +/WP + /HOLD

To start flashing use the following command:

flashrom -p serprog:dev=/dev/ttyUSB0:2000000 -w P5B.rom

To check if everything went according to plan you can dump the chip’s content by using this command. Or use the -v option while running flashrom to verify that the flashing was successful.

flashrom -p serprog:dev=/dev/ttyUSB0:2000000 -r good.rom

After completing the dump you can use a hex editor to compare the files. If they match it means you’ve successfully flashed your chip 🙂 .

Links used: