Warning

This document was written many years ago, and the nature of Open Source projects like coreboot means that options may change in name and or in function. The rest of the guide (extracting and flashing the BIOS) should remain largely the same.

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
    • 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)
    • ifdtool -u <firmware.bin>
  7. Extract partitions
    • ifdtool -x <firmware.bin>
  8. Run me_cleaner over ME partition

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" (Under "Text" tab, with "Unicode" off)

  5. In the results in the bottom double click a (hopefully the only) result

    • x220-uefitool-vgabios
    • 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:

    • Install fcode-utils (debian)

    • Run romheaders vgabios.bin

    • Expect the following:

      • x220-romheaders-vgabios
      • 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)