Difference between revisions of "Board:lenovo/t420"

From coreboot
Jump to: navigation, search
(build howto, more bout VGA option ROM)
 
(20 intermediate revisions by 5 users not shown)
Line 1: Line 1:
 
== Status ==
 
== Status ==
Thanks for your interest in Lenovo T420 port. The code has not been merged yet, you can see the code on [http://review.coreboot.org/#/c/11765/ gerrit].  
+
[[Intel_Native_Raminit]] has it's own status page.
  
ATTENTION: You must cherry-pick [http://review.coreboot.org/#/c/12112/ this patch] before building. (It's merged to upstream, you can cherry-picked the T420 port on the upstream coreboot code.)
+
Thanks for your interest in Lenovo T420 port.  
  
 
Issues:
 
Issues:
* The USB beside express card cannot funtion after S3 resume if CONFIG_USBDEBUG is set (work around: reload ehci-pci module)
+
* The USB/eSATA hybrid port that are used for EHCI debug cannot funtion after S3 resume if CONFIG_USBDEBUG is set (seems to be the southbridge problem, occurs in older Linux systems but not in newer Linux systems, I just can't figure out why, 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)
+
* Mini PCIe WWAN doesn't work
* Boot failure with quad core Ivy Bridge processor with 8G DDR3L module ([https://ticket.coreboot.org/issues/6 Bug #6], work around:revert 9f1fbb9a3002e8d74d53d7973bd1c7e3d4879238)
+
* Microphone Mute button not working in Windows 10 (but seems to work under linux)
 +
* Synaptics Touchpad and Trackpint driver doesnot work originally under Windows 10  (but work under linux). The reason is the ACPI\VEN_PNP&DEV_0F13 generated by the coreboot can not be recognized by the driver. To workaround this, uncomment this line (MS_GROUP01_InterTouch_Inst,*PNP0F13) in the SynPD.inf file of Synaptics offcial driver. (A modified driver is here https://www.dropbox.com/s/t8d5f8n1tq5ddm7/Synaptics_v19_0_19_1__C__x86-x64__Win10__Signed__MS_Win10_UXUI.zip)
 +
* Thermal Management. Coreboot seems does not have native thermal management (dptf.asl) for t420. Under linux it's possible to use the thermald software to work around this. Under Windows 10, the Intel Dynamic Platform and Thermal Framework driver does not work (PCI\VEN_8086&DEV_0153)
 +
* System clock time does not change after sleep and wake up under Windows 10.
 +
* An unknown device under Windows 10 is the ACPI\VEN_GOOG&DEV_CB00.
  
 
Tested:
 
Tested:
* Ivy Bridge processor (see below)
+
* CPU: Sandy Bridge i5-2520M, i7-2630QM, and Ivy Bridge i5-3210M, i5-3360M, i7-3720QM
* RAM module combinations of 2G+0, 4G+0, 8G+0, 0+8G, 4G+8G, 8G+8G
+
* RAM module combinations of 2G+0, 4G+0, 4G+4G, 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, DisplayPort)
 
* 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)
+
* Fingerprint reader
 +
* 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)
 +
* ExpressCard slot (hotplugging not work)
 +
* eSATA (needs [https://review.coreboot.org/#/c/14632/ this patch], hotplugging not work)
 +
* Ctrl-Fn swap
 +
* Mute button (Speaker only)
  
Not Tested:
+
== Nvidia GPU ==
* Video (VGA and Displayport)
+
State of dual graphics on Lenovo Notebooks: [[Board:lenovo/Nvidia_Optimus]]
* Expresscard slot (including hotplugging)
 
* mini pci-e wwan
 
* Fingerprint reader.
 
* Thermal management
 
  
== proprietary components status ==
+
== Proprietary components status ==
 
* 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). The newest version that works is version 2170 https://www.dropbox.com/s/2h9x16kmloofp3y/snb_vbios_2170.rom
* ME(Management Engine) => you do not have to touch it(just leave it where it is)
+
* ME (Management Engine) => The original ME is 5MB. The smallest stripped ME is 1.5MB that can be found. If you use the 1.5MB one https://www.dropbox.com/s/gesgk9ot2ho24zm/me.bin you also need the modified flash descriptor https://www.dropbox.com/s/gx9f48jqypnio2q/descriptor.bin
* 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 as is)
  
 
== Building ==
 
== Building ==
[https://bitbucket.org/iruatpku/coreboot-builds/src/627526646262f43c0e7899ca79693f844fef1b23/t420/build.sh A build instruction] has been written on bitbucket.
+
Just run {{ic|make nconfig}}, and select the board Lenovo T420. Other configurations include:
 +
 
 +
* Size of CBFS can be set up to 3M (0x300000), if you use a stripped ME from HM65 chipset, it can be more.
 +
* You can select 'Use CMOS for configuration values'.
 +
* You can use native graphics initialization.
 +
* EHCI debug dongle support is recommended for debugging.
 +
 
 +
To obtain ME, Intel Descriptor, GbE images you will need to read the BIOS off your T420. Using {{ic|ifdtool}} you can extract those images from the backup BIOS image.
 +
  ifdtool -x </path/to/extracted/flash.bin>
 +
 
 +
You can use [https://github.com/LongSoft/UEFITool UEFITool] or PhoenixTool to extract the VGA BIOS from factory firmware or Lenovo firmware update images, or dump the VGA BIOS via sysfs on Linux. See [https://www.coreboot.org/VGA_support#How_to_retrieve_a_good_video_bios Retrieve VGA BIOS page] for more details.
 +
 
 +
To use VGA option ROMs, you can manually add it to CBFS using cbfstool multiple times to support more GPUs on a single board. Or make use of file aliasing from SeaBIOS:
 +
 
 +
./build/cbfstool build/coreboot.rom add -f vgabios.rom -n pci8086,0106.rom -t optionrom
 +
./build/cbfstool build/coreboot.rom add -f links -n links -t raw
 +
 
 +
The content of file {{ic|links}} is as follows: (I can't figure out how to do this... Is this still work in the latest source?)
 +
 
 +
pci8086,0116.rom pci8086,0106.rom
 +
pci8086,0126.rom pci8086,0106.rom
 +
pci8086,0166.rom pci8086,0106.rom
 +
 
 +
If the payload is not SeaBIOS, coreboot also support running VGA option ROMs, and the fallback file name is {{ic|pci8086,0106.rom}}, so you can just add it with this name.
 +
 
 +
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?).
 +
 
 +
I have uploaded my build, if anyone want to try. There are 10 roms with different MAC addresses (gbe.bin) for sandybridge and another 10 for ivebridge (I tried to link vgabios, but does not work. So I build two sets). The reason for having 10 different MAC addresses is if you have several laptops plugged into the same router, you need different MAC addresses. https://www.dropbox.com/sh/mq1e2a54vv030nz/AAAgPSRYlPhuXiZiRE9qJbwQa
  
 
== 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 89:
 
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.
 +
* You can solder five thin wires to connect the pins to near the memory. Then next time you don't need to fully disassable the laptop.
 +
 
 +
[[File:T420pins.jpg|500px]]
 +
 
 +
[[File:T420soldered.jpg|500px]]
 +
 
 +
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:
 
   flashrom -p internal:laptop=force_I_want_a_brick -w <coreboot image>
 
   flashrom -p internal:laptop=force_I_want_a_brick -w <coreboot image>
 
== 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).
 
 
Up to now, an i5-3340M and an i7-3720QM(QS version) is tested.
 

Latest revision as of 13:38, 31 December 2017

Status

Intel_Native_Raminit has it's own status page.

Thanks for your interest in Lenovo T420 port.

Issues:

  • The USB/eSATA hybrid port that are used for EHCI debug cannot funtion after S3 resume if CONFIG_USBDEBUG is set (seems to be the southbridge problem, occurs in older Linux systems but not in newer Linux systems, I just can't figure out why, work around: reload ehci-pci module)
  • Mini PCIe WWAN doesn't work
  • Microphone Mute button not working in Windows 10 (but seems to work under linux)
  • Synaptics Touchpad and Trackpint driver doesnot work originally under Windows 10 (but work under linux). The reason is the ACPI\VEN_PNP&DEV_0F13 generated by the coreboot can not be recognized by the driver. To workaround this, uncomment this line (MS_GROUP01_InterTouch_Inst,*PNP0F13) in the SynPD.inf file of Synaptics offcial driver. (A modified driver is here https://www.dropbox.com/s/t8d5f8n1tq5ddm7/Synaptics_v19_0_19_1__C__x86-x64__Win10__Signed__MS_Win10_UXUI.zip)
  • Thermal Management. Coreboot seems does not have native thermal management (dptf.asl) for t420. Under linux it's possible to use the thermald software to work around this. Under Windows 10, the Intel Dynamic Platform and Thermal Framework driver does not work (PCI\VEN_8086&DEV_0153)
  • System clock time does not change after sleep and wake up under Windows 10.
  • An unknown device under Windows 10 is the ACPI\VEN_GOOG&DEV_CB00.

Tested:

  • CPU: Sandy Bridge i5-2520M, i7-2630QM, and Ivy Bridge i5-3210M, i5-3360M, i7-3720QM
  • RAM module combinations of 2G+0, 4G+0, 4G+4G, 8G+0, 0+8G, 4G+8G, 8G+8G
  • S3 (Suspend to RAM)
  • mSATA
  • USB
  • Video (internal, VGA, DisplayPort)
  • Sound (integrated speakers, integrated mic, external headphones, external mic)
  • LAN
  • Mini-PCIe slots (WLAN)
  • Bluetooth
  • Fingerprint reader
  • 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)
  • ExpressCard slot (hotplugging not work)
  • eSATA (needs this patch, hotplugging not work)
  • Ctrl-Fn swap
  • Mute button (Speaker only)

Nvidia GPU

State of dual graphics on Lenovo Notebooks: Board:lenovo/Nvidia_Optimus

Proprietary components status

Building

Just run make nconfig, and select the board Lenovo T420. Other configurations include:

  • Size of CBFS can be set up to 3M (0x300000), if you use a stripped ME from HM65 chipset, it can be more.
  • You can select 'Use CMOS for configuration values'.
  • You can use native graphics initialization.
  • EHCI debug dongle support is recommended for debugging.

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>

You can use UEFITool or PhoenixTool to extract the VGA BIOS from factory firmware or Lenovo firmware update images, or dump the VGA BIOS via sysfs on Linux. See Retrieve VGA BIOS page for more details.

To use VGA option ROMs, you can manually add it to CBFS using cbfstool multiple times to support more GPUs on a single board. Or make use of file aliasing from SeaBIOS:

./build/cbfstool build/coreboot.rom add -f vgabios.rom -n pci8086,0106.rom -t optionrom
./build/cbfstool build/coreboot.rom add -f links -n links -t raw 

The content of file links is as follows: (I can't figure out how to do this... Is this still work in the latest source?)

pci8086,0116.rom pci8086,0106.rom
pci8086,0126.rom pci8086,0106.rom
pci8086,0166.rom pci8086,0106.rom

If the payload is not SeaBIOS, coreboot also support running VGA option ROMs, and the fallback file name is pci8086,0106.rom, so you can just add it with this name.

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?).

I have uploaded my build, if anyone want to try. There are 10 roms with different MAC addresses (gbe.bin) for sandybridge and another 10 for ivebridge (I tried to link vgabios, but does not work. So I build two sets). The reason for having 10 different MAC addresses is if you have several laptops plugged into the same router, you need different MAC addresses. https://www.dropbox.com/sh/mq1e2a54vv030nz/AAAgPSRYlPhuXiZiRE9qJbwQa

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.
  • You can solder five thin wires to connect the pins to near the memory. Then next time you don't need to fully disassable the laptop.

T420pins.jpg

T420soldered.jpg

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>