Thinkpad X220 – Coreboot and ME removal

Module preparation

See https://tylercipriani.com/blog/2016/11/13/coreboot-on-the-thinkpad-x220-with-a-raspberry-pi/

  1. Setup a RPi
  2. Build flashrom on it
  3. Connect RPi to BIOS chip
  4. Dump Firmware off chip
    1. Dump multiple times until you have multiple files with the same hashes
  5. Copy to workstation
  6. Use ifdtool (from the coreboot sources) to modify (unlock) descriptor (may not actually be necessary)
    1. ifdtool -u <firmware.bin>
  7. Extract partitions
    1. ifdtool -x <firmware.bin>
  8. Run me_cleaner over ME partition
    1. Get it from https://github.com/corna/me_cleaner
    2. python3 <me_cleaner_location>/me_cleaner.py flashregion_2_intel_me.bin

VGA BIOS extraction (optional)

This allows graphics in GRUB to work as intended, the text themes should work fine, SeaBIOS works fine without it, and the moment linux touches the GPU it all works anyway.

  1. Download UEFITool – get it from https://github.com/LongSoft/UEFITool
  2. Compile UEFITool  – run qmake uefitool.pro && make (requires QT5)
  3. Open whole firmware image
  4. Search “VGA Compatible BIOS”
  5. In the results in the bottom double click a (hopefully the only) result
    1. UEFITool with the module containing the VGA BIOS selected
  6. Right click “extract body”, save as vgabios.bin
  7. (Further optional) Double check the module extracted is correct:
    1. Install fcode-utils (debian)
    2. Run romheaders vgabios.bin
    3. Expect the following:
      1. romheaders output for the X220 VGA BIOS

 

Coreboot prep

Follow the usual setup instructions for coreboot – pull the git repo, initialise the submodules, build the toolchain etc.

Use the following as your .config:
CONFIG_USE_OPTION_TABLE=y
CONFIG_USE_BLOBS=y
CONFIG_VENDOR_LENOVO=y
CONFIG_ONBOARD_VGA_IS_PRIMARY=y
CONFIG_VGA_BIOS=y
CONFIG_VGA_BIOS_FILE="====YOUR==PATH==HERE====/vga-8086-126.bin"
CONFIG_HAVE_IFD_BIN=y
CONFIG_HAVE_ME_BIN=y
CONFIG_DRIVERS_PS2_KEYBOARD=y
CONFIG_CONSOLE_POST=y
CONFIG_HAVE_GBE_BIN=y
CONFIG_BOARD_LENOVO_X220=y
# CONFIG_CONSOLE_CBMEM is not set
CONFIG_ENABLE_VMX=y
CONFIG_IFD_BIN_PATH="====YOUR==PATH==HERE====/flashregion_0_flashdescriptor.bin"
CONFIG_ME_BIN_PATH="====YOUR==PATH==HERE====/flashregion_2_intel_me.bin"
CONFIG_GBE_BIN_PATH="====YOUR==PATH==HERE====/flashregion_3_gbe.bin"
CONFIG_DEFAULT_CONSOLE_LOGLEVEL_6=y
CONFIG_SEABIOS_MASTER=y
CONFIG_SEABIOS_THREAD_OPTIONROMS=y
CONFIG_PXE=y
CONFIG_BUILD_IPXE=y
CONFIG_PXE_ROM_ID="8086,1502"
CONFIG_MEMTEST_SECONDARY_PAYLOAD=y
CONFIG_NVRAMCUI_SECONDARY_PAYLOAD=y
CONFIG_TINT_SECONDARY_PAYLOAD=y

Run make like usual

Flash the image!

Pretty self explanatory, use the -w instead of -r flag on flashrom.

Notes:

  • CONFIG_USE_OPTION_TABLE=y Allows you to set things like the power management beeps using nvramtool, and the nvramcui payload
  • The other secondary payloads are optional too
  • CONFIG_SEABIOS_MASTER=y Seems to be required, using the numbered version may not work
  • If you don’t want to use the VGA rom, select “Devices/Use native graphics initialization” (MAINBOARD_DO_NATIVE_VGA_INIT)

Leave a Reply

Your email address will not be published. Required fields are marked *