| 1 | # Lenovo ThinkPad T480/T480s |
| 2 | |
| 3 | This page describes how to run coreboot on the [Lenovo ThinkPad T480/T480s]. |
| 4 | |
| 5 | ## Important Notes |
| 6 | |
| 7 | ### EC UART |
| 8 | The T480 (but not T480s) supports the use of the EC UART for debugging. If you want to use this |
| 9 | feature, you need to downgrade the vendor firmware to a version with a compatible EC firmware |
| 10 | *before flashing* for the EC UART to work properly. The EC firmware version needs to be 1.22 |
| 11 | (N24HT37W), which means any BIOS from 1.39 (N24ET64W) to 1.54 (N24ET79W) is acceptable. |
| 12 | |
| 13 | The mapping can be seen here [on Lenovo's site]. |
| 14 | |
| 15 | ### Bootguard |
| 16 | The T480/T480s both have Intel Bootguard enabled, which prevents the device from running |
| 17 | firmware which is not cryptographically signed using the manufacturer's key. |
| 18 | |
| 19 | The [deguard utility](../../soc/intel/deguard) will need to be used in order to bypass Bootguard |
| 20 | on these devices. |
| 21 | |
| 22 | ### Thunderbolt |
| 23 | |
| 24 | Older versions of Thunderbolt 3 controller firmware are buggy on these laptops. |
| 25 | |
| 26 | The issue is that the TB3 firmware writes its logging data to the TB3's own 4M flash chip, and |
| 27 | when the flash chip fills up, the device fails to boot. |
| 28 | |
| 29 | Lenovo has addressed this in a TB3 firmware update, which is recommended be be applied before |
| 30 | installing coreboot to ensure long-term reliability of the device. That said, most laptops that |
| 31 | still work likely have this fix already applied, and you can always externally flash the TB3 |
| 32 | firmware update at the same time as flashing coreboot. |
| 33 | |
| 34 | If your device becomes bricked due to this issue, the only resolution is to externally flash the |
| 35 | updated/fixed TB3 firmware flash (which is located on a separate flash IC from the main firmware). |
| 36 | |
| 37 | The Lenovo TB3 FW update can be obtained [from Lenovo's site]. |
| 38 | |
| 39 | The Libreboot project has some more information about the issue and [how to externally flash the |
| 40 | TB3 firmware]. |
| 41 | |
| 42 | ## Initial Setup |
| 43 | |
| 44 | Follow the coreboot [tutorial](../../tutorial/part1) to: |
| 45 | * install dependencies/prerequisites |
| 46 | * clone the coreboot repo |
| 47 | * build the coreboot toolchain |
| 48 | |
| 49 | You will also need to clone the [deguard](https://review.coreboot.org/deguard) repository, in |
| 50 | order to bypass BootGuard. |
| 51 | |
| 52 | ## Required proprietary blobs |
| 53 | |
| 54 | When flashing the T480/T480s for the first time, the following blobs are required for a full |
| 55 | flash image: |
| 56 | * Flash Descriptor (IFD) |
| 57 | * Management Engine (ME) |
| 58 | * Gigabit Ethernet (GBE) |
| 59 | |
| 60 | These will either be extracted from the vendor firmware on the device or downloaded as needed. |
| 61 | |
| 62 | Additionally, the T480/T480s make use of Intel's Firmware Support Package (FSP) for memory and |
| 63 | silicon init. FSP is provided by default as part of the coreboot build, no user intervention is |
| 64 | required. |
| 65 | |
| 66 | ## Reading the vendor firmware |
| 67 | |
| 68 | The T480/T480s have a single flash chip, a 16 MiB W25Q128 in a SOIC-8 package. The flash chip |
| 69 | uses the following layout: |
| 70 | |
| 71 | 00000000:00000fff flash descriptor (fd) |
| 72 | 00fff000:00000fff platform data (unused) |
| 73 | 00001000:00002fff gbe |
| 74 | 00003000:006fffff me |
| 75 | 00700000:00ffffff bios |
| 76 | |
| 77 | |
| 78 | To read the vendor firmware, disconnect external power and remove the back of the laptop |
| 79 | according to the T480 [Hardware Maintenance Manual]. |
| 80 | Disconnect/remove the battery (and CMOS battery if equipped). Attach a chip clip to the flash. |
| 81 | Use an external programmer (ch341a, raspberry Pi, etc) and flashrom to read the chip. |
| 82 | |
| 83 | ## Preparing the binaries |
| 84 | |
| 85 | The IFD and GBE need to be extracted from the vendor firmware backup read from the flash chip. |
| 86 | See [Extract IFD binaries](../../util/ifdtool/binary_extraction). |
| 87 | Rename the extracted files to `ifd.bin` and `gbe.bin` and move them to the `binaries` folder |
| 88 | you created per the instructions. |
| 89 | |
| 90 | ### Preparing the ME with deguard |
| 91 | |
| 92 | Please review the documentation on the use of the [deguard utility](../../soc/intel/deguard). |
| 93 | |
| 94 | Since the T480/T480s is already a supported target, we simply need to download/extract the donor |
| 95 | image, then generate the "deguarded" ME firmware image |
| 96 | |
| 97 | The donor ME binary required for use with the deguard utility can be downloaded as part of the |
| 98 | [Dell firmware updater]. After downloading, use [Dell_PFS_Extract.py] to extract the required ME |
| 99 | firmware image from the updater: |
| 100 | |
| 101 | python Dell_PFS_Extract.py Inspiron_5468_1.3.0.exe |
| 102 | |
| 103 | The resulting binary should be renamed `me_donor.bin` and moved to the `binaries` folder with |
| 104 | the IFD and GBE. |
| 105 | |
| 106 | Then, generate the deguarded ME firmware image: |
| 107 | |
| 108 | ./finalimage.py --delta data/delta/thinkpad_t480 --version 11.6.0.1126 --pch LP --sku 2M --fake-fpfs data/fpfs/zero --input ../coreboot/binaries/me_donor.bin --output ../coreboot/binaries/me_deguarded.bin |
| 109 | |
| 110 | The command above assumes you are running deguard from the root of the deguard repo, that the |
| 111 | deguard and coreboot repos are checked out under the same parent directory, and that your ME |
| 112 | donor firmware is in the `binaries` subdirectory of coreboot (along with the IFD/GBE binaries). |
| 113 | Adjust the paths as necessary if that is not the case. |
| 114 | |
| 115 | ### Preparing the IFD |
| 116 | |
| 117 | In order to use the modified ME firmware binary generated by deguard above, we need to set the |
| 118 | HAP bit in the IFD using `ifdtool`: |
| 119 | |
| 120 | util/ifdtool/ifdtool -p sklkbl -M 1 binaries/ifd.bin |
| 121 | |
| 122 | The modified IFD will be saved as `ifd.bin.new`. Rename the original file to `ifd.bin.orig` and |
| 123 | the HAP-enabled one to `ifd.bin` |
| 124 | |
| 125 | ## Building coreboot |
| 126 | |
| 127 | You can use `make menuconfig` or `make nconfig` to select the mainboard (Lenovo T480 or T480s), |
| 128 | enable the inclusion of the IFD/ME/GBE binaries, and select your payload and options. |
| 129 | You can also just use the following defconfig: |
| 130 | |
| 131 | CONFIG_VENDOR_LENOVO=y |
| 132 | CONFIG_IFD_BIN_PATH="binaries/ifd.bin" |
| 133 | CONFIG_ME_BIN_PATH="binaries/me_deguarded.bin" |
| 134 | CONFIG_GBE_BIN_PATH="binaries/gbe.bin" |
| 135 | CONFIG_HAVE_IFD_BIN=y |
| 136 | CONFIG_BOARD_LENOVO_T480=y |
| 137 | CONFIG_HAVE_ME_BIN=y |
| 138 | CONFIG_HAVE_GBE_BIN=y |
| 139 | CONFIG_PAYLOAD_EDK2=y |
| 140 | |
| 141 | Save the above to a file called `defconfig` in your coreboot directory, then run: |
| 142 | |
| 143 | make defconfig |
| 144 | make -j"$(nproc)" |
| 145 | |
| 146 | Upon successful compilation, you will have a file `coreboot.rom` in the `build` directory ready |
| 147 | to flash. |
| 148 | |
| 149 | ## Flashing instructions |
| 150 | |
| 151 | The initial flash of coreboot with the modified IFD and deguarded ME must be done using an |
| 152 | external programmer: |
| 153 | |
| 154 | sudo flashrom -p <programmer> -w coreboot.rom |
| 155 | |
| 156 | Subsequent flashes can be done internally and need only modify the `bios` region of the flash: |
| 157 | |
| 158 | sudo flashrom -p internal -w coreboot.rom --ifd -i bios -N |
| 159 | |
| 160 | The `coreboot.rom` flashed on subsequent flashes does not need to contain the IFD/ME/GBE |
| 161 | binaries if only flashing the `bios` region. |
| 162 | |
| 163 | ## Known Issues |
| 164 | |
| 165 | - Alpine Ridge Thunderbolt 3 controller does not work |
| 166 | - Lower (right) USB-C port only works for charging/DP alt mode, not USB/PCIe data |
| 167 | - Some Fn+F{1-12} keys aren't handled correctly |
| 168 | - Nvidia dGPU is finicky |
| 169 | - Needs option ROM |
| 170 | - Power enable code is buggy |
| 171 | - Proprietary driver does not work at all |
| 172 | - Nouveau only works on linux 6.8-6.9 |
| 173 | - Headphone jack detection |
| 174 | - Both headphone jack and speakers work when manually selected via pulseaudio |
| 175 | |
| 176 | ## Verified Working |
| 177 | |
| 178 | - Integrated graphics init with libgfxinit |
| 179 | - video output: internal (eDP), miniDP |
| 180 | - ACPI support |
| 181 | - keyboard and trackpoint |
| 182 | - SATA |
| 183 | - M.2 SATA SSD |
| 184 | - NVMe |
| 185 | - USB |
| 186 | - Ethernet |
| 187 | - WLAN |
| 188 | - WWAN |
| 189 | - Bluetooth |
| 190 | - Virtualization: VT-x and VT-d |
| 191 | - Internal flashing (after initial flash with unlocked IFD) |
| 192 | |
| 193 | [Lenovo ThinkPad T480/T480s]: https://pcsupport.lenovo.com/us/en/products/laptops-and-netbooks/thinkpad-t-series-laptops/thinkpad-t480-type-20l5-20l6/ |
| 194 | [Hardware Maintenance Manual]: https://download.lenovo.com/pccbbs/mobiles_pdf/t480_hmm_en.pdf |
| 195 | [on Lenovo's site]: https://support.lenovo.com/us/en/downloads/ds502355-bios-update-utility-bootable-cd-for-windows-10-64-bit-linux-thinkpad-t480 |
| 196 | [from Lenovo's site]: https://pcsupport.lenovo.com/gb/en/products/laptops-and-netbooks/thinkpad-t-series-laptops/thinkpad-t480s-type-20l7-20l8/solutions/ht508988-critical-intel-thunderbolt-software-and-firmware-updates-thinkpad |
| 197 | [how to externally flash the TB3 firmware]: https://libreboot.org/docs/install/t480.html#thunderbolt-issue-read-this-before-flashing |
| 198 | [Dell firmware updater]: https://web.archive.org/web/20241110222323/https://dl.dell.com/FOLDER04573471M/1/Inspiron_5468_1.3.0.exe |
| 199 | [Dell_PFS_Extract.py]: https://github.com/vuquangtrong/Dell-PFS-BIOS-Assembler/blob/master/Dell_PFS_Extract.py |