ThinkPad T400 Libreboot using Raspberry Pi

Setting up.

Before you do anything you need to have your Pi setup with Raspbian Lite. Use raspi-config to make sure everything is setup correct before you attempt to start flashing your T400.

Teardown process is pretty simple and straight forward, if you need any guidance there's plenty of resources online detailing the process.

Finding chip size and backing up the ROM.

Below is a diagram of what your SOIC8/SOIC16 clip should look like along with the corresponding pins on your Pi.


	/////////////////////    SOIC8    \\\\\\\\\\\\\\\\\\\\\\\\

	==================    Toward Screen    ==================

				  _____
	 24 (CS)                -|     |-              17 (3.3V)
	 21 (DO)                -|     |-          Not connected
	 Not connected          -|     |-               23 (SCK)
	 25 (GRND)              -|_____|-                19 (DI)


	===================    Towards RAM    ===================



	/////////////////////    SOIC16    \\\\\\\\\\\\\\\\\\\\\\

	===============    RJ45/11 and VGA Port    ==============

				_____
	Not connected         -|     |-                 21 (DO)
	25 (GRND)             -|     |-                 24 (CS)
	Not connected         -|     |-           Not connected
	Not connected         -|     |-           Not connected
	Not connected         -|     |-           Not connected
	Not connected         -|     |-           Not connected
	19 (DI)               -|     |-               17 (3.3V)
	23 (SCK)              -|_____|-           Not connected


	===================    SATA Port    =====================



		   //////////////////////     GPIO     \\\\\\\\\\\\\\\\\\\\\\\\


                                                      C
                                                      S

          2   4   6   8   10  12  14  16  18  20  22  24  26  28  30  32  34  36  38  40
        ---------------------------------------------------------------------------------
        | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - |
        ---------------------------------------------------------------------------------
        | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - |
        ---------------------------------------------------------------------------------         
         1   3   5   7   9   11  13  15  17  19  21  23  25  27  29  31  33  35  37  39
                                         
                                          3   D   D   S   G
                                          .   I   O   C   R
                                          3           K   N
                                          V               D


                   \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\//////////////////////////////
	

First we need to found out what size chip you have (4MB, 8MB, 16MB) and the name (i.e., MX25L3273E). Should normally be met with about ten lines, should have a size somewhere in parenthesis (4096KB, 8192KB, 16,384KB).


	flashrom -p linux_spi:dev=/dev/spidev0.0,spispeed=1000
	

If flashrom is throwing errors and you know for sure your wiring is done right, then uncomment #dtparam=spi=on in /boot/config.txt then reboot.

Make sure to write down your MAC address which can be found in the BIOS and on the bottom of your ThinkPad. You'll need it later to write to the Libreboot ROM.

Backup the factory ROM a few times.


	flashrom -p linux_spi:dev=/dev/spidev0.0,spispeed=512 -c MX25L3273E -r factory.rom
	flashrom -p linux_spi:dev=/dev/spidev0.0,spispeed=512 -c MX25L3273E -r factory1.rom
	flashrom -p linux_spi:dev=/dev/spidev0.0,spispeed=512 -c MX25L3273E -r factory2.rom
	

Compare the three ROMs, if they match be sure to backup one of the images somewhere safe incase you need to restore later on.


	sha512sum factory*.rom
	

Flashing Libreboot to the ThinkPad.

Clone Libreboot repository


	git clone https://github.com/rabcyr/libreboot
	

Go into the directoy and make ich9gen.


	cd libreboot/resources/utilities/ich9deblob
	make
	./ich9gen --macaddress XX:XX:XX:XX:XX:XX
	cd
	

wget the Libreboot ROM that fits your ROM chip size. You can find these at https://libreboot.org/download.html. In my case it's a 4MB chip so I'll download the tar file that corresponds with it.


	wget https://mirror.math.princeton.edu/pub/libreboot/stable/20160907/rom/grub/libreboot_r20160907_grub_t400_4mb.tar.xz
	tar -xf libreboot_r20160907_grub_t400_4mb.tar.xz
	cd libreboot_r20160907_grub_t400_4mb
	cp t400_4mb_usqwerty_vesafb.rom ~/
	cd
	

Now take the ich9gen .bin you created earlier with your MAC address and merge it into your Libreboot ROM.


	dd if=~/libreboot/resources/utilities/ich9deblob/ich9fdgbe_4m.bin of=~/t400_4mb_usqwerty_vesafb.rom bs=1 count=12k conv=notrunc
	

Finally, flash the image to your ROM chip.


	flashrom -p linux_spi:dev=/dev/spidev0.0,spispeed=512 -w t400_4mb_usqwerty_vesafb.rom -c MX25L3273E