---
title: Thinkpad T440p Coreboot Guide
description: The definitive guide on corebooting a Thinkpad T440p
author: Timothy Pidashev
tags: [t440p, coreboot, thinkpad]
date: 2025-01-15
image: "/blog/thinkpad-t440p-coreboot-guide/thumbnail.png"
isDraft: true
---

import { Commands, Command, CommandSequence } from "@/components/mdx/command";
import Advertisement from '@/content/blog/components/thinkpad-t440p-coreboot-guide/advertisement';

> **Interactive Script Available!**  
> Want to skip the manual steps in this guide? 
> I've created an interactive script that can automate the entire process step by step as you follow along.
> This script supports Arch, Debian, Fedora, Gentoo, and Nix!

<Command 
  description="Interactive script"
  command="curl -fsSL https://timmypidashev.dev/scripts/run.sh | sh -s -- -t coreboot-t440p"
  client:load
/>

Don't pipe anyone's scripts to **sh** blindly, including mine - <a href="https://github.com/timmypidashev/scripts" target="_blank" rel="noopener noreferrer">audit the source</a>.

## Getting Started 

The Thinkpad T440p is a powerful and versatile laptop that can be further enhanced by installing coreboot, 
an open-source BIOS replacement. This guide will walk you through the process of corebooting your T440p, 
including flashing the BIOS chip and installing the necessary software.

## What You'll Need

Before getting started corebooting your T440p, make sure you have the following:

- **Thinkpad T440p**: This guide is specifically for the T440p model.
- **CH341A Programmer**: This is a USB device used to flash the BIOS chip.
- **Screwdriver**: A torx screwdriver is needed to open the laptop.

## Installing Dependencies

Install the following programs. These will be needed to compile coreboot and flash the BIOS.

<Commands
  description="Install prerequisite packages"
  archCommand="sudo pacman -S base-devel curl git gcc-ada ncurses zlib nasm sharutils unzip flashrom"
  debianCommand="sudo apt install build-essential curl git gnat libncurses-dev zlib1g-dev nasm sharutils unzip flashrom"
  fedoraCommand="sudo dnf install @development-tools curl git gcc-gnat ncurses-devel zlib-devel nasm sharutils unzip flashrom"
  gentooCommand="sudo emerge --ask sys-devel/base-devel net-misc/curl dev-vcs/git sys-devel/gcc ncurses dev-libs/zlib dev-lang/nasm app-arch/sharutils app-arch/unzip sys-apps/flashrom"
  nixCommand="nix-env -i stdenv curl git gcc gnat ncurses zlib nasm sharutils unzip flashrom"
  client:load
/>

## Disassembling the Laptop
1. **Power off your laptop**: Make sure your T440p is completely powered off and unplugged from any power source.
2. **Remove the battery**: Flip the laptop over and remove the battery by sliding the latch to the unlock position and lifting it out.
3. **Unscrew the back panel**: Use a torx screwdriver to remove the screws securing the back panel.

## Locating the EEPROM Chips

In order to flash the laptop, you will need to have access to two EEPROM chips located next to the sodimm RAM.

![EEPROM Chips Location](/blog/thinkpad-t440p-coreboot-guide/eeprom_chips_location.png)

## Assembling the SPI Flasher

Place the SPI flasher ribbon cable into the correct slot and make sure its the 3.3v variant

![SPI Flasher Assembly](/blog/thinkpad-t440p-coreboot-guide/spi_flasher_assembly.png)

After the flasher is ready, connect it to your machine and ensure its ready to use:

<Command 
  description="Ensure the CH341A flasher is being detected"
  command="flashrom --programmer ch341a_spi"
/>

Flashrom should report that programmer initialization was a success.

## Extracting Original BIOS

To begin, first create a clean directory where all work to coreboot
the T440p will be done.

<Command 
  description="Create a directory where all work will be done"
  command="mkdir ~/t440p-coreboot"
  client:load
/>

Next, extract the original rom from both EEPROM chips. This is 
done by attaching the programmer to the correct chip and running
the subsequent commands. It may take longer than expected, and 
ensuring the bios was properly extracted is important before proceeding
further.

<CommandSequence 
  commands={[
    "sudo flashrom --programmer ch341a_spi -r 4mb_backup1.bin",
    "sudo flashrom --programmer ch341a_spi -r 4mb_backup2.bin",
    "diff 4mb_backup1.bin 4mb_backup2.bin"
  ]}
  description="Backup and verify 4MB chip"
  client:load
/>

<CommandSequence
  commands={[
    "sudo flashrom --programmer ch341a_spi -r 8mb_backup1.bin",
    "sudo flashrom --programmer ch341a_spi -r 8mb_backup2.bin",
    "diff 8mb_backup1.bin 8mb_backup2.bin"
  ]}
  description="Backup and verify 8MB chip"
  client:load
/>

If the diff checks pass, combine both files into one ROM.

<Command
  description="Combine 4MB & 8MB into one ROM"
  command="cat 8mb_backup_1.bin 4mb_backup1.bin > t440p-original.rom"
  client:load
/>

## Building Required Tools

Now that the original bios has been successfuly extracted, it is time 
to clone the coreboot repository and build every tool needed to build
a new bios image.

<CommandSequence
  commands={[
    "git clone https://review.coreboot.org/coreboot ~/t440p-coreboot/coreboot",
    "cd ~/t440p-coreboot/coreboot",
    "git checkout e1e762716cf925c621d58163133ed1c3e006a903",
    "git submodule update --init --checkout"
  ]}
  description="Clone coreboot and checkout to the correct commit"
  client:load
/>

We will need to build `idftool`, which will be used to export all necessary blobs
from our original bios, and `cbfstool`, which will be used to extract __mrc.bin__(a blob 
from a haswell chromebook peppy image).

<Command 
  description="Build util/ifdtool"
  command="cd ~/t440p-coreboot/coreboot/util/ifdtool && make"
  client:load
/>

<Command
  description="Build util/cbfstool"
  command="cd ~/t440p-coreboot/coreboot/ && make -C util/cbfstool"
  client:load
/>

## Exporting Firmware Blobs

Once the necessary tools have been built, we can export the
3 flash regions from our original bios image.

<CommandSequence
  commands={[
    "cd ~/t440p-coreboot/coreboot/util/ifdtool",
    "./ifdtool -x ~/t440p-coreboot/t440p-original.rom",
    "mv flashregion_0_flashdescriptor.bin ~/t440p-coreboot/ifd.bin",
    "mv flashregion_2_intel_me.bin ~/t440p-coreboot/me.bin",
    "mv flashregion_3_gbe.bin ~/t440p-coreboot/gbe.bin"
  ]}
  description="Export firmware blobs"
  client:load
/>

## Obtaining mrc.bin

In order to obtain __mrc.bin__, we need the chromeos peppy image.
This can be pulled by running the `crosfirmware.sh` script found in util/chromeos.

<Command
  description="Download peppy chromeos image"
  command="cd ~/t440p-coreboot/coreboot/util/chromeos && ./crosfirmware.sh peppy"
  client:load
/>


We can now obtain __mrc.bin__ using cbfstool to extract the blob from the image.

<CommandSequence
  commands={[
    "cd ~/t440p-coreboot/coreboot/util/chromeos",
    "../cbfstool/cbfstool coreboot-*.bin extract -f mrc.bin -n mrc.bin -r RO_SECTION",
    "mv mrc.bin ~/t440p-coreboot/mrc.bin"
  ]}
  description="Extract mrc.bin using cbfstool"
  client:load
/>

## Configuring Coreboot

Configuring coreboot is really where most of your time will be spent. To help out, 
I've created several handy configs that should suit most use cases, and can be easily
tweaked to your liking. Here is a list of whats available:

### 1. GRUB2 (Recommended)

GRUB2 is the recommended payload for most users. It boots Linux directly without needing a
separate bootloader installation on disk. This configuration includes three secondary payloads:

- **memtest86+** - Memory testing utility
- **nvramcui** - CMOS/NVRAM settings editor
- **coreinfo** - System information viewer

If your T440p has the optional GT730M dGPU, the GRUB2 config also includes the
necessary VGA option ROM for it.

### 2. SeaBIOS

SeaBIOS provides a traditional BIOS interface, making it the most compatible option.
Choose this if you need to boot operating systems that expect a legacy BIOS, such
as Windows or BSD.

### 3. edk2 (UEFI)

edk2 provides a UEFI firmware interface. Choose this if you prefer UEFI boot or
need UEFI-specific features.

---

If using the interactive script, it will prompt you to choose a payload and apply
a preset configuration automatically. You can also choose to open the full
configuration menu (`make nconfig`) to customize further.

For manual configuration, first copy the extracted blobs into place:

<CommandSequence
  commands={[
    "mkdir -p ~/t440p-coreboot/coreboot/3rdparty/blobs/mainboard/lenovo/haswell",
    "mkdir -p ~/t440p-coreboot/coreboot/3rdparty/blobs/cpu/intel/haswell",
    "cp ~/t440p-coreboot/ifd.bin ~/t440p-coreboot/coreboot/3rdparty/blobs/mainboard/lenovo/haswell/descriptor.bin",
    "cp ~/t440p-coreboot/me.bin ~/t440p-coreboot/coreboot/3rdparty/blobs/mainboard/lenovo/haswell/me.bin",
    "cp ~/t440p-coreboot/gbe.bin ~/t440p-coreboot/coreboot/3rdparty/blobs/mainboard/lenovo/haswell/gbe.bin",
    "cp ~/t440p-coreboot/mrc.bin ~/t440p-coreboot/coreboot/3rdparty/blobs/cpu/intel/haswell/mrc.bin"
  ]}
  description="Copy firmware blobs into the coreboot source tree"
  client:load
/>

Then open the configuration menu:

<Command
  description="Open coreboot configuration"
  command="cd ~/t440p-coreboot/coreboot && make nconfig"
  client:load
/>

Key settings to configure:

- **Mainboard** &rarr; Mainboard vendor: **Lenovo** &rarr; Mainboard model: **ThinkPad T440p**
- **Chipset** &rarr; Add Intel descriptor.bin, ME firmware, and GbE configuration (set paths to your blobs)
- **Chipset** &rarr; Add haswell MRC file (set path to mrc.bin)
- **Payload** &rarr; Choose your preferred payload (GRUB2, SeaBIOS, or edk2)

## Building and Flashing 

After configuring coreboot, it is time to build and flash it onto your unsuspecting T440p :D

<CommandSequence
  commands={[
    "cd ~/t440p-coreboot/coreboot",
    "make crossgcc-i386 CPUS=$(nproc)",
    "make"
  ]}
  description="Build coreboot"
  client:load 
/>

Once the coreboot build has completed, split the built ROM for the 8MB(bottom) chip & 4MB(top) chip.

<CommandSequence
  commands={[
    "cd ~/t440p-coreboot/coreboot/build",
    "dd if=coreboot.rom of=bottom.rom bs=1M count=8",
    "dd if=coreboot.rom of=top.rom bs=1M skip=8"
  ]}
  description="Split the built ROM for both EEPROM chips"
  client:load
/>

Now flash the new bios onto your thinkpad!

<Command
  description="Flash the 4MB chip"
  command="sudo flashrom --programmer ch341a_spi -w top.rom"
/>

<Command
  description="Flash the 8MB chip"
  command="sudo flashrom --programmer ch341a_spi -w bottom.rom"
/>

Thats it! If done properly, your thinkpad should now boot!

## Reverting to Original

If for some reason you feel the need to revert back, or your T440p can't boot, 
here are the steps needed to flash the original image back.

### Can't Boot

<CommandSequence 
  commands={[
    "cd ~/t440p-coreboot/",
    "dd if=t440p-original.rom of=bottom.rom bs=1M count=8",
    "dd if=t440p-original.rom of=top.rom bs=1M skip=8"
  ]}
  description="Split original bios image for both EEPROM chips"
  client:load
/>

<Command 
  description="Flash the 4MB chip"
  command="sudo flashrom --programmer ch341a_spi -w top.rom"
/>

<Command 
  description="Flash the 8MB chip"
  command="sudo flashrom --programmer ch341a_spi -w bottom.rom"
/>

### Can Boot

<CommandSequence
  commands={[
    "sudo sed -i '/GRUB_CMDLINE_LINUX_DEFAULT/ s/\"/ iomem=relaxed\"/2' /etc/default/grub",
    "sudo grub-mkconfig -o /boot/grub/grub.cfg",
  ]}
  description="Set kernel flag iomem=relaxed and update grub config"
  client:load
/>

Reboot to apply `iomem=relaxed`

<Command
  description="Flash the original bios"
  command="sudo flashrom -p internal:laptop=force_I_want_a_brick -r ~/t440p-coreboot/t440p-original.rom"
/>

And that about wraps it up! If you liked the guide, leave a reaction or comment any changes or fixes
I should make below. Your feedback is greatly appreciated!
