Difference between revisions of "Board:lenovo/t420"

From coreboot
Jump to: navigation, search
(build howto, more bout VGA option ROM)
(Expanded the guide to make it easier to get coreboot on the T420 + cosmetical changes + Linux through SeaBIOS + VGA works)
Line 13: Line 13:
 
* RAM module combinations of 2G+0, 4G+0, 8G+0, 0+8G, 4G+8G, 8G+8G
 
* RAM module combinations of 2G+0, 4G+0, 8G+0, 0+8G, 4G+8G, 8G+8G
 
* S3 (Suspend to RAM)
 
* S3 (Suspend to RAM)
* msata
+
* mSATA
 
* USB
 
* USB
* Video (internal)
+
* Video (internal, VGA)
 
* Sound (integrated speakers, integrated mic, external headphones, external mic)
 
* Sound (integrated speakers, integrated mic, external headphones, external mic)
 
* LAN
 
* LAN
* mini-PCIe slots (wlan)
+
* Mini-PCIe slots (WLAN)
* bluetooth
+
* Bluetooth
* Linux (through GRUB-as-payload)
+
* Linux (through GRUB-as-payload and a typical MBR install through SeaBIOS)
 
* Windows (through SeaBIOS as payload or chainload SeaBIOS from GRUB payload, using a VGA BIOS)
 
* Windows (through SeaBIOS as payload or chainload SeaBIOS from GRUB payload, using a VGA BIOS)
 
* DVD-ROM drive
 
* DVD-ROM drive
 
* SD card slot
 
* SD card slot
* trackpoint
+
* TrackPoint
* touchpad
+
* Touchpad
* webcam
+
* Webcam
 
* Fn hotkeys (backlight control, suspend, thinklight)
 
* Fn hotkeys (backlight control, suspend, thinklight)
 
* Thinklight
 
* Thinklight
* dock (tested with a TYPE 4337)
+
* Dock (tested with a TYPE 4337)
  
 
Not Tested:
 
Not Tested:
* Video (VGA and Displayport)
+
* Video (DisplayPort)
* Expresscard slot (including hotplugging)
+
* ExpressCard slot (including hotplugging)
* mini pci-e wwan
+
* Mini PCIe WWAN
* Fingerprint reader.
+
* Fingerprint reader
 
* Thermal management
 
* Thermal management
  
Line 41: Line 41:
 
* CPU Microcode (optional): you may need it if your system is unstable (especially you're using a ES/QS processor)
 
* CPU Microcode (optional): you may need it if your system is unstable (especially you're using a ES/QS processor)
 
* VGA option rom (optional): you need it if you want graphics in SeaBIOS but most payloads should work without it (text mode or corebootfb mode)
 
* VGA option rom (optional): you need it if you want graphics in SeaBIOS but most payloads should work without it (text mode or corebootfb mode)
* ME(Management Engine) => you do not have to touch it(just leave it where it is)
+
* ME(Management Engine) => you do not have to touch it (just leave it where it is)
* EC(Embedded Controller) => you do not have to touch it(just leave it where it is)
+
* EC(Embedded Controller) => you do not have to touch it (just leave it where it is)
  
 
== Building ==
 
== Building ==
[https://bitbucket.org/iruatpku/coreboot-builds/src/627526646262f43c0e7899ca79693f844fef1b23/t420/build.sh A build instruction] has been written on bitbucket.
+
'''[https://bitbucket.org/iruatpku/coreboot-builds/src/627526646262f43c0e7899ca79693f844fef1b23/t420/build.sh A build instruction] has been written on bitbucket.'''
 +
 
 +
To obtain ME, Intel Descriptor, GbE images you will need to read the BIOS off your T420. Using ''ifdtool'' you can extract those images from the backup BIOS image.
 +
  ifdtool -x </path/to/extracted/flash.bin>
 +
 
 +
The ''bios_extract'' did not work on my backup so I had to use PhoenixTool to dump the VGA BIOS.
 +
On some T420's, a weird graphical glitch might occur using native graphics initialization. I managed to workaround through this problem by using the Option ROM initialization instead of the native way but YMMV (could the 1600x900 panel or a too new VBIOS (2119) cause issues?).
  
 
== Flashing ==
 
== Flashing ==
T420 has an SOIC-8 flash chip of 8M. It's subdivided in roughly in 3 parts:
+
T420 has an SOIC-8 flash chip of 8M (Winbond W25Q64CVSIG). It's subdivided in roughly in 3 parts:
  
 
* Descriptor (12K)
 
* Descriptor (12K)
Line 57: Line 63:
 
Vendor firmware locks the flash and so you need to flash externally (unless until someone figures out a way around it).
 
Vendor firmware locks the flash and so you need to flash externally (unless until someone figures out a way around it).
  
Proceeds as follows:
+
Proceed as follows:
 
* Turn off your laptop, remove battery and AC adapter.
 
* Turn off your laptop, remove battery and AC adapter.
 
* Disassemble the T420 laptop as the [https://download.lenovo.com/ibmdl/pub/pc/pccbbs/mobiles_pdf/t420_t420i_hmm.pdf hardware maintenance manual] says. You have to take out the mainboard, because the flash chip is under the magnesium stucture frame.
 
* Disassemble the T420 laptop as the [https://download.lenovo.com/ibmdl/pub/pc/pccbbs/mobiles_pdf/t420_t420i_hmm.pdf hardware maintenance manual] says. You have to take out the mainboard, because the flash chip is under the magnesium stucture frame.
* Connect your external SPI flasher to the SPI chip and flash it. Using an SOIC-8 clip is recommended.
+
* Connect your external SPI flasher to the SPI chip. Using an SOIC-8 clip is recommended although the flash can be done without one. Make a backup of the original BIOS in a safe place.
 +
* Flash the chip with coreboot using flashrom.
 +
* Reassemble the laptop.
 +
* Plug in the AC adapter and turn on the laptop.
 +
 
 +
Using the Bus Pirate as an SPI flasher the pinout is as such:
 +
 
 +
        Bus Pirate  W25Q64BV
 +
        CS          /CS (1)
 +
        3.3V        VCC (8)
 +
        MISO        DO (2)
 +
        CLK          CLK (6)
 +
        GND          GND (4)
 +
        MOSI        DI (5)
 +
 
 +
To read the chip using the Bus Pirate:
 +
  flashrom -p buspirate_spi:dev=/dev/ttyUSB0 -r <output file>
 +
To flash the chip using the Bus Pirate:
 +
  flashrom -p buspirate_spi:dev=/dev/ttyUSB0 -w <coreboot image>
 +
 
 +
Reading and writing using the Bus Pirate takes time. Use the version 6.2 bootloader to make the reads and flashes faster.
 +
 
 +
I highly recommend reading the chip twice to make sure you have a stable connection. Make sure to read and compare your images like so:
 +
  flashrom -p <yourprogrammer> -r flash.bin
 +
  flashrom -p <yourprogrammer> -r flash2.bin
 +
  diff flash.bin flash2.bin
 +
 
 +
If you have trouble reading the chip successfully, the most common problems are:
 +
* Insufficient power supply
 +
* Bad contacts
 +
* Too long wires
 +
* Bad pinout
 +
 
 +
For more information on the chip, refer to the official datasheet of the chip available here: [https://www.winbond.com/resource-files/w25q64cv_revh_052214%5B2%5D.pdf Winbond W25Q64CV]
  
 
When the laptop is running coreboot, you can reflash the firmware using flashrom:
 
When the laptop is running coreboot, you can reflash the firmware using flashrom:
Line 66: Line 105:
  
 
== Ivy Bridge processor support ==
 
== Ivy Bridge processor support ==
Sandy Bridge and Ivy Bridge processor use the same socket, so an Ivy Bridge processor can be installed. To use native graphics init, you should use a [http://review.coreboot.org/#/c/12087/ patch on gerrit] so that coreboot can use the correct code for native graphics init. You can also use a VGA option ROM with SeaBIOS, adding VGA option ROMs for both type of graphics manually is recommended (See the build instructionn above).
+
Sandy Bridge and Ivy Bridge processors use the same socket, so an Ivy Bridge processor can be installed. To use native graphics init, you should use a [http://review.coreboot.org/#/c/12087/ patch on gerrit] so that coreboot can use the correct code for native graphics init. You can also use a VGA option ROM with SeaBIOS. Manually adding VGA option ROMs for both type of GPUs is recommended (see the build instructions above).
  
Up to now, an i5-3340M and an i7-3720QM(QS version) is tested.
+
Up to now, an i5-3340M and an i7-3720QM (QS version) is tested.

Revision as of 21:03, 4 February 2016

Status

Thanks for your interest in Lenovo T420 port. The code has not been merged yet, you can see the code on gerrit.

ATTENTION: You must cherry-pick this patch before building. (It's merged to upstream, you can cherry-picked the T420 port on the upstream coreboot code.)

Issues:

  • The USB beside express card cannot funtion after S3 resume if CONFIG_USBDEBUG is set (work around: reload ehci-pci module)
  • Badly seated RAM may prevent booting (not really a problem but coreboot is more suspicious to this than vendor BIOS)
  • Boot failure with quad core Ivy Bridge processor with 8G DDR3L module (Bug #6, work around:revert 9f1fbb9a3002e8d74d53d7973bd1c7e3d4879238)

Tested:

  • Ivy Bridge processor (see below)
  • RAM module combinations of 2G+0, 4G+0, 8G+0, 0+8G, 4G+8G, 8G+8G
  • S3 (Suspend to RAM)
  • mSATA
  • USB
  • Video (internal, VGA)
  • Sound (integrated speakers, integrated mic, external headphones, external mic)
  • LAN
  • Mini-PCIe slots (WLAN)
  • Bluetooth
  • Linux (through GRUB-as-payload and a typical MBR install through SeaBIOS)
  • Windows (through SeaBIOS as payload or chainload SeaBIOS from GRUB payload, using a VGA BIOS)
  • DVD-ROM drive
  • SD card slot
  • TrackPoint
  • Touchpad
  • Webcam
  • Fn hotkeys (backlight control, suspend, thinklight)
  • Thinklight
  • Dock (tested with a TYPE 4337)

Not Tested:

  • Video (DisplayPort)
  • ExpressCard slot (including hotplugging)
  • Mini PCIe WWAN
  • Fingerprint reader
  • Thermal management

proprietary components status

  • CPU Microcode (optional): you may need it if your system is unstable (especially you're using a ES/QS processor)
  • VGA option rom (optional): you need it if you want graphics in SeaBIOS but most payloads should work without it (text mode or corebootfb mode)
  • ME(Management Engine) => you do not have to touch it (just leave it where it is)
  • EC(Embedded Controller) => you do not have to touch it (just leave it where it is)

Building

A build instruction has been written on bitbucket.

To obtain ME, Intel Descriptor, GbE images you will need to read the BIOS off your T420. Using ifdtool you can extract those images from the backup BIOS image.

 ifdtool -x </path/to/extracted/flash.bin>

The bios_extract did not work on my backup so I had to use PhoenixTool to dump the VGA BIOS. On some T420's, a weird graphical glitch might occur using native graphics initialization. I managed to workaround through this problem by using the Option ROM initialization instead of the native way but YMMV (could the 1600x900 panel or a too new VBIOS (2119) cause issues?).

Flashing

T420 has an SOIC-8 flash chip of 8M (Winbond W25Q64CVSIG). It's subdivided in roughly in 3 parts:

  • Descriptor (12K)
  • ME firmware (5M-12K)
  • System flash (3M)

ME firmware is not readable. Vendor firmware locks the flash and so you need to flash externally (unless until someone figures out a way around it).

Proceed as follows:

  • Turn off your laptop, remove battery and AC adapter.
  • Disassemble the T420 laptop as the hardware maintenance manual says. You have to take out the mainboard, because the flash chip is under the magnesium stucture frame.
  • Connect your external SPI flasher to the SPI chip. Using an SOIC-8 clip is recommended although the flash can be done without one. Make a backup of the original BIOS in a safe place.
  • Flash the chip with coreboot using flashrom.
  • Reassemble the laptop.
  • Plug in the AC adapter and turn on the laptop.

Using the Bus Pirate as an SPI flasher the pinout is as such:

       Bus Pirate   W25Q64BV
       CS           /CS (1)
       3.3V         VCC (8)
       MISO         DO (2)
       CLK          CLK (6)
       GND          GND (4)
       MOSI         DI (5)

To read the chip using the Bus Pirate:

 flashrom -p buspirate_spi:dev=/dev/ttyUSB0 -r <output file>

To flash the chip using the Bus Pirate:

 flashrom -p buspirate_spi:dev=/dev/ttyUSB0 -w <coreboot image>

Reading and writing using the Bus Pirate takes time. Use the version 6.2 bootloader to make the reads and flashes faster.

I highly recommend reading the chip twice to make sure you have a stable connection. Make sure to read and compare your images like so:

 flashrom -p <yourprogrammer> -r flash.bin
 flashrom -p <yourprogrammer> -r flash2.bin
 diff flash.bin flash2.bin

If you have trouble reading the chip successfully, the most common problems are:

  • Insufficient power supply
  • Bad contacts
  • Too long wires
  • Bad pinout

For more information on the chip, refer to the official datasheet of the chip available here: Winbond W25Q64CV

When the laptop is running coreboot, you can reflash the firmware using flashrom:

 flashrom -p internal:laptop=force_I_want_a_brick -w <coreboot image>

Ivy Bridge processor support

Sandy Bridge and Ivy Bridge processors use the same socket, so an Ivy Bridge processor can be installed. To use native graphics init, you should use a patch on gerrit so that coreboot can use the correct code for native graphics init. You can also use a VGA option ROM with SeaBIOS. Manually adding VGA option ROMs for both type of GPUs is recommended (see the build instructions above).

Up to now, an i5-3340M and an i7-3720QM (QS version) is tested.