Flashing Libreboot on a ThinkPad T420 with a Raspberry Pi 4B
This is a step-by-step guide on how I flashed Libreboot onto my ThinkPad T420 using a Raspberry Pi 4B. Libreboot is a free and open source BIOS/UEFI replacement that removes proprietary firmware from your machine.
Flashing Libreboot replaces your factory BIOS and can permanently brick your laptop. This process is irreversible without specialized hardware. Proceed at your own risk. I am not responsible for any damage to your device.
What You Need
Hardware
- ThinkPad T420
- Raspberry Pi 4B running Raspberry Pi OS
- SOIC-8 test clip (Pomona 5250 or similar)
- 8 female-to-female jumper wires
- Phillips screwdriver
- Spudger or plastic pry tool
Software
- flashrom or flashprog
- Libreboot ROM for the T420 (8MB)
Step 1: Prepare the Raspberry Pi
Enable SPI
sudo raspi-config
Go to Interface Options -> SPI -> Enable, then reboot.
Install flashrom
sudo apt update
sudo apt install flashrom
Get the Libreboot ROM
Download the T420 8MB ROM from the Libreboot website and extract it:
tar xf libreboot-*_t420_8mb.tar.xz
Inside the extracted folder you will find ROM files. You need to follow the instructions on the Libreboot website to inject the necessary files (like your MAC address) into the ROM before flashing. The ROM filenames will tell you this. Do not skip this step.
Step 2: Disassemble the T420
Remove the battery and AC adapter before doing anything.
- Flip the laptop over and remove the screws marked with keyboard and palmrest icons
- Flip it back over and push the keyboard toward the screen, then lift it up from the bottom edge
- Disconnect the keyboard ribbon cable
- Lift the palmrest and disconnect the trackpad and fingerprint reader ribbon cables
- Locate the BIOS chip. It is an 8-pin chip near the ExpressCard slot area, usually labeled W25Q64 or MX25L6405 (this is the 8MB flash chip)
Step 3: Wire the SOIC-8 Clip to the Raspberry Pi
Here is the pinout for the flash chip:
____
CS 1|o |8 VCC
DO 2| |7 HOLD
WP 3| |6 CLK
GND 4|____|5 DI
The dot on the chip marks pin 1.
Connections
| SOIC-8 Pin | Function | Pi GPIO Pin | Pi Pin Name |
|---|---|---|---|
| 1 | CS | 24 | SPI0_CE0 |
| 2 | DO (MISO) | 21 | SPI0_MISO |
| 3 | WP | 17 | 3.3V |
| 4 | GND | 25 | GND |
| 5 | DI (MOSI) | 19 | SPI0_MOSI |
| 6 | CLK | 23 | SPI0_SCLK |
| 7 | HOLD | 17 | 3.3V |
| 8 | VCC | 17 | 3.3V |
Pins 3, 7, and 8 all go to 3.3V on the Pi. You can use any of the 3.3V pins on the Pi header (pin 1 or pin 17).
Use 3.3V only. The Pi’s 5V pins will destroy the flash chip.
Step 4: Attach the Clip
- Make absolutely sure the laptop has no power. No battery, no AC adapter
- Line up the dot on the SOIC-8 clip with pin 1 on the chip (the dot on the chip diagram and the physical chip has a circle indent, do not go off the paint mark if it has one.)
- Press the clip down firmly until it is seated on all 8 pins
- A loose clip is the number one cause of read failures. Make sure it is solid
Step 5: Back Up the Original BIOS
This is the most important step. Do it twice and compare checksums. If you do not have a good backup you have no way to recover if something goes wrong.
First read
sudo flashrom -p linux_spi:dev=/dev/spidev0.0,spispeed=1000 -r backup1.bin
Second read
sudo flashrom -p linux_spi:dev=/dev/spidev0.0,spispeed=1000 -r backup2.bin
Compare checksums
sha256sum backup1.bin backup2.bin
If the checksums do not match:
- Reseat the clip
- Check your wiring
- Try a lower speed:
spispeed=512 - Try again until you get two identical reads
Do not proceed until the checksums match. Copy these backups to a USB drive or another computer. These are your only way back to the stock BIOS.
Step 6: Flash Libreboot
sudo flashrom -p linux_spi:dev=/dev/spidev0.0,spispeed=1000 -w /path/to/libreboot.rom
Replace /path/to/libreboot.rom with the path to your prepared ROM file.
flashrom will read the chip, erase it, write the new ROM, and verify the write. If it says VERIFIED at the end, the flash was successful.
If the flash fails
- Reseat the clip
- Try
spispeed=512 - Make sure no power source is connected to the laptop
- Check all wiring
- Try again
If flashrom complains about ROM size
If the ROM file is larger than the chip, you may need to truncate it:
dd if=input.rom of=output.rom bs=8388608 count=1
Step 7: Reassemble and Boot
- Remove the SOIC-8 clip carefully
- Disconnect the jumper wires from the Pi
- Reassemble the palmrest, keyboard, and screws
- Insert the battery
- Power on
You should see the Libreboot/GRUB boot screen instead of the Lenovo splash screen.
Troubleshooting
| Problem | Solution |
|---|---|
| “No EEPROM/flash device found” | Reseat clip, check wiring, try spispeed=512 |
| Reads do not match | Loose clip or bad connection, reseat and try again |
| Laptop will not boot after flash | Reflash the ROM, make sure you used the correct 8MB ROM |
| Screen stays black | Try an external monitor, reset CMOS by removing the CMOS battery for 30 seconds |
| Power light comes on but shuts off after 10 seconds | Reseat the RAM, try one stick at a time in each slot |
| flashrom does not recognize the chip | Try adding -c W25Q64JV-.Q or whatever your chip model is |
Why Libreboot
Your stock Lenovo BIOS is proprietary. You do not know what it is doing. Libreboot replaces it with free software so you have full control over what runs on your hardware from the moment you press the power button. It also removes the WiFi whitelist so you can use any WiFi card you want.
The T420 is one of the best supported Libreboot machines. It is cheap, repairable, and has a great keyboard. If you are going to run a libre system, this is a solid choice.