Librebooting thinkpad t440p "instruction"
Feb 05, 2025At this article i would like to write down the instruction of flashing libreboot bios to thinkpad t440p
Prepare all the needed equipment and data
Note: This approach will be executed with Raspberry Pi B3+ model
So the list of items that we should have before we can actually proceed.
- The thinkpad t440p
- Raspberry Pi 24 pin GPIO
- SOIC 8 PIN clip
For the quick set i will be using already builded rooms of libreboot just to not deal with all the process of building it from scratch. We will get release room and will inject all nescessary data in there.
The libreboot room image downloaded from https://mirror.math.princeton.edu/pub/libreboot/stable/20241206/roms/ download the libreboot-20241206rev8t440plibremrc12mb.tar.xz
This is the grub payload with seabios for usqwerty keyboard room.
Before we can inject required binary blobs we need to have lbmk system installed, so do the next to install the lbmk:
- Clone the lbmk from git repo into your local folder lbmk-repo
- cd into cloned repository
Execute following command to inject required binnary blobs in the cloned lbmk repo direktory:
./mk inject libreboot-20241206rev8_t440plibremrc_12mb.tar.xz
Note: This command will build all the dependencies and then inject needed blobs.
Unpack the archive and copy to the separate folder the "DONOTFLASHYET.FIRST,INJECTFILESVIAINSTRUCTIONSONLIBREBOOT.ORGseagrubt440plibremrc12mblibgfxinittxtmodeusqwerty.rom" room file.
Execute following command to split room for two ships top and bottom:
dd if=DO_NOT_FLASH_YET._FIRST,_INJECT_FILES_VIA_INSTRUCTIONS_ON_LIBREBOOT.ORG_seagrub_t440plibremrc_12mb_libgfxinit_txtmode_usqwerty.rom of=top.rom bs=1M skip=8 dd if=DO_NOT_FLASH_YET._FIRST,_INJECT_FILES_VIA_INSTRUCTIONS_ON_LIBREBOOT.ORG_seagrub_t440plibremrc_12mb_libgfxinit_txtmode_usqwerty.rom of=bottom.rom bs=1M count=8
Now we have this two files for top and botton chip, upload them to Raspberry Pi and let's start preparing the SOIC8 clip and Raspberry Pi to read the old chip content.
Lets start with connection SOIC clip and reading existing chip contents
- Disassemble the laptop so you will be able to manipulate with flash chip. There is two chips that we need to read and flash into, top and bottom.
The chip on the motherboard you can observe the dot at some side of the chip this will be the pin number 1 so and then we can count all other.
- Let's connect pins from Raspberry Pi to SOIC8 clip:
Here is the correct mapping for Raspberry Pi to SOIC8 clip
Pin # | 25xx signal | RPi(GPIO) | BBB(P9 header) |
1 | CS | 24 | 17 |
2 | MISO | 21 | 21 |
3 | not used | not used | not used |
4 | GND | 25 | 1 |
5 | MOSI | 19 | 18 |
6 | CLK | 23 | 22 |
7 | not used | not used | not used |
8 | VCC | 1 | 3 |
Here how it should looks like the black pin on SOIC clip which comes from 24 pin its the 1 pin that should be connected to the dot pin on the chip.
Note: Be careful when connecting the clip to not damage the contacts and make sure the Raspberry Pi and laptop is powered off!
After connecting the clip, lets power up Raspberry Pi and install the flashrom and spi deriver
If you are using a terminal, you will need to:
Run sudo raspi-config. Use the down arrow to select 5 Interfacing Options Arrow down to P4 SPI. Select yes when it asks you to enable SPI, Also select yes if it asks about automatically loading the kernel module. Use the right arrow to select the <Finish> button. Select yes when it asks to reboot.
The system will reboot. When it comes back up, log in and enter the following command
ls /dev/*spi*
The Pi should respond with
/dev/spidev0.0 /dev/spidev0.1
Now install the flashrom
sudo apt install git libpci-dev libusb-1.0 libusb-dev
Finish up by cloning the flashrom repo, compiling and installing flashrom:
git clone https://github.com/flashrom/flashrom.git
cd flashrom
make
sudo make install
In order to verify flashrom correctly identifies the chip we run flashrom without any operations.
flashrom -p linux_spi:dev=/dev/spidev0.0,spispeed=512
Note: Some chips may fail to read, don't worry, try to change speed patram from 512 to 2000 also recheck the clip connection it should stick solid.
Now that Flashrom correctly identifies the Winbond W25X80 we can continue to backup the current BIOS.
Note: Also sometime flashrom could not recognize the chip model so we can specify it in the command, try to look at the chip there should be exact number which we can specify in the command
flashrom -p linux_spi:dev=/dev/spidev0.0,spispeed=32768 -r top-chip-stock-bios.rom
Note: Power off the RPI and reconnect clip to bottom chip an repeat same steps to stock rom backup.
sudo ./flashrom -p linux_spi:dev=/dev/spidev0.0,spispeed=32768 -w /path/to/top.rom
Note: Repeat same for the bottom chip
Once that command outputs the following, the flash has completed successfully. If not, just flash again.
Reading old flash chip contents... done. Erasing and writing flash chip... Erase/write done. Verifying flash... VERIFIED.
If it says “VERIFIED” or says that the chip contents are identical to the requested image, then the chip is properly flashed.
After that let's assemble the laptop back and try to boot.
That's it, enjoy!