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

Output:

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.

Resources:

  • 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

10 thoughts on “Flashing a BIOS chip with a Raspberry Pi”

  1. Thank you for this post. I was able to fix my Asrock x79 Extreme4-m with this technique.

  2. Hello. I am getting this error when installing flashrom on raspberry pi 3,

    internal.c:148:32: error: ‘par_master_internal’ defined but not used [-Werror=unused-const-variable=]
    static const struct par_master par_master_internal = {
    ^~~~~~~~~~~~~~~~~~~
    cc1: all warnings being treated as errors
    Makefile:1043: recipe for target ‘internal.o’ failed
    make: *** [internal.o] Error 1

    occurs after (sudo make)

    Your help is much appreciated

      1. Hi,

        I am using jessie lite too. same error on latest version 2 previous versions.

        But I managed to install it with apt-get install flashrom, and its working now,

        Thank you very much

        Amr

          1. Trying to revive a bricked GPU CARD..( MSI RX580 GAMING X) The bios chip is ( winbong w25x40cling)
            still no luck reading it with permona soic 8 test clip..
            will keep you updated

            Many thanks

Leave a Reply

Your email address will not be published. Required fields are marked *