Carter Zhang's Blog

Welcome to Carter Zhang's Blog!

Libreboot Installation on ThinkPad X200

2024-06-17 2 min read

Today I successfully installed Libreboot on my machine using my Raspberry Pi Pico. I am glad to share the howtos during the installation.

1. Grab and complie flashprog

On an external computer, clone the flashprog source code repository.

 $ git clone https://review.sourcearcade.org/plugins/gitiles/flashprog

Then follow the building instructions to install building dependencies and build flashprog from source code.

2. Grab lbmk and build firmware for Raspberry Pi Pico

 $ git clone https://codeberg.org/libreboot/lbmk
 $ cd lbmk
 $ ./build roms serprog rp2040 pico

Firmware file will result in bin/serprog_rp2040/serprog_pico.uf2. Copy it to your Raspberry Pico.

3. Check the device’s flash chip size

Build flashprog on your X200. Then, reboot with iomem=relaxed kernel parameter, and run:

 # ./flashprog -p internal

4. Download the corresponding ROM file

Navigate to this page: https://libreboot.org/download.html

Choose a mirror, then navigate to stable/YOUR_VERSION/roms/. Download the corresponding ROM file to install. Extract it and you’ll see a group of files. Choose a file according to your keyboard layout and your need.

5. Prepare the connection

Refer to this page. Connect your chip to your Raspberry Pi Pico. Then connect your Pico to the external computer. Use sudo dmesg -wH to determine whether your Pico is detected, and take note of the device path (/dev/ttyACMx).

6. Backup and flash

Make two backups and compare their hashes:

 # ./flashprog -p serprog:dev=/dev/ttyACMx,spispeed=8M -r /path/to/backup/file1.rom -c "MX25L6405D"
 # ./flashprog -p serprog:dev=/dev/ttyACMx,spispeed=8M -r /path/to/backup/file2.rom -c "MX25L6405D"
 $ sha256sum /path/to/backup/file1.rom
 $ sha256sum /path/to/backup/file2.rom

Then start the flashing procedure:

 # ./flashprog -p serprog:dev=/dev/ttyACMx,spispeed=8M -w /path/to/rom/file.rom -c "MX25L6405D"

Wait until the flashing procedure finishes.

7. Finalization

Disconnect the Pico from the external computer. Then disconnect the Pico from the X200.

Enjoy ^_^