X230 Coreboot and me_cleaner

step 0 - prep work and tools

step 1 - remove flash ROMs

  1. disassemble the laptop
    • be sure to disconnect the main battery and the "CMOS" battery
  2. desolder SPI1 and SPI2
    • SOIC-8 chips
    • on the board near where the touchpad was
    • SPI1 is the first 8mb of the BIOS
    • SPI2 is the remaining 4mb of the BIOS

step 2 - dump flash ROMs

  1. dump SPI1
    • flashrom --chip "MX25L6406E/MX25L6408E" --programmer buspirate_spi:dev=/dev/ttyUSB0 --read ./bios-8m.img
      • took about 22 minutes
  2. dump SPI2
    • flashrom --chip "MX25L3206E/MX25L3208E" --programmer buspirate_spi:dev=/dev/ttyUSB0 --read ./bios-4m.img
      • took about 11 minutes
  3. join the dumps
    • cat bios-8m.img bios-4m.img > bios-12m.img

step 3 - nuke the ME firmware from the flash dump

  1. check me_cleaner chipset status
    • my X230 uses a Core i5-3320M, which is Ivy Bridge, which uses ME 8.x
      • me_cleaner can remove all modules except ROMP and BUP
      • optionally, me_cleaner can also set the MeAltDisable flag to disable ME entirely
  2. check ME dump
    1. build ifdtool
      1. cd coreboot/util/ifdtool
      2. make
    2. ifdtool --dump bios-12m.img
  3. run me_cleaner
    1. cd me_cleaner
    2. check ME again
      • python me_cleaner.py -c bios-12m.img
    3. enable ME kill switch and clean ME
      • python me_cleaner.py -S -O bios-12m-cleaned.img bios-12m.img
  4. unlock flash descriptor and ME region
    1. ifdtool --unlock bios-12m-cleaned.img
    2. mv bios-12m-cleaned.img.new bios-12m-cleaned-unlocked.img

step 4 - build flash dump with Coreboot

  1. extract blobs
    • ifdtool --extract bios-12m-cleaned-unlocked.img creates these files:
      • flashregion_0_flashdescriptor.bin: flash image metadata
      • flashregion_1_bios.bin: OEM BIOS, to be replaced with Coreboot
      • flashregion_2_intel_me.bin: ME blob, changed by me_cleaner
      • flashregion_3_gbe.bin: built-in Ethernet card firmware, not using
  2. configure Coreboot
    1. cd coreboot
    2. make distclean
    3. make menuconfig
      • General setup --->
        • [*] Use CMOS for configuration values
      • Mainboard --->
        • Mainboard vendor --->
          • (X) Lenovo
        • Mainboard model --->
          • (X) ThinkPad X230
        • ROM chip size --->
          • (X) 12288 KB (12 MB)
            • this should be selected by default
      • Chipset --->
        • [*] Add Intel descriptor.bin file
          • flashregion_0_flashdescriptor.bin
        • [*] Add Intel ME/TXE firmware
          • flashregion_2_intel_me.bin
      • Devices --->
        • Graphics initialization --->
          • (X) Use native graphics init
            • should be selected by default?
            • allows us to not need VGA option ROM (only for Intel mobile CPUs with LVDS screens)
      • <Save>
  3. build Coreboot
    1. make crossgcc-i386 CPUS=4
    2. make crossgcc-x64 CPUS=4
    3. make
    4. cp build/coreboot.rom ../coreboot.img

step 5 - split flash dump

  1. dd bs=1M count=8 if=coreboot.img of=coreboot-8m.img
  2. dd bs=1M skip=8 count=4 if=coreboot.img of=coreboot-4m.img
  3. use ls -l to make sure coreboot-8m.img and coreboot-4m.img are the same size as bios-8m.img and bios-4m.img, respectively

step 6 - write the ROMs

  1. write SPI1
    • flashrom --chip "MX25L6406E/MX25L6408E" --programmer buspirate_spi:dev=/dev/ttyUSB0 --write coreboot-8m.img
      • took about 53 minutes
  2. write SPI2
    • flashrom --chip "MX25L3206E/MX25L3208E" --programmer buspirate_spi:dev=/dev/ttyUSB0 --write coreboot-4m.img
      • took about 31 minutes

step 7 - tidying up

re-solder flash ROMs, re-assemble laptop, and enjoy!