2020-02-16 00:35:03 +01:00
|
|
|
# Lenovo X200 / T400 / T500 / X301 common
|
|
|
|
|
|
|
|
These models are sold with either 8 MiB or 4 MiB flash chip. You can identify
|
|
|
|
the chip in your machine through flashrom:
|
|
|
|
```console
|
|
|
|
# flashrom -p internal
|
|
|
|
```
|
|
|
|
|
|
|
|
Note that this does not allow you to determine whether the chip is in a SOIC-8
|
|
|
|
or a SOIC-16 package.
|
|
|
|
|
2020-12-12 19:03:28 +01:00
|
|
|
## Installing with ME firmware
|
|
|
|
|
|
|
|
To install coreboot and keep ME working, you don't need to do anything special
|
|
|
|
with the flash descriptor. Only flash the `bios` region externally and don't
|
|
|
|
touch any other regions:
|
|
|
|
```console
|
|
|
|
# flashrom -p YOUR_PROGRAMMER -w coreboot.rom --ifd -i bios
|
|
|
|
```
|
|
|
|
|
2020-02-16 00:35:03 +01:00
|
|
|
## Installing without ME firmware
|
|
|
|
|
|
|
|
```eval_rst
|
|
|
|
.. Note::
|
|
|
|
**ThinkPad R500** has slightly different flash layout (it doesn't have
|
|
|
|
``gbe`` region), so the process would be a little different for that model.
|
|
|
|
```
|
|
|
|
|
|
|
|
On Montevina machines it's possible to disable ME and remove its firmware from
|
|
|
|
SPI flash by modifying the flash descriptor. This also makes it possible to use
|
|
|
|
the flash region the ME used for `bios` region, allowing for much larger
|
|
|
|
payloads.
|
|
|
|
|
|
|
|
First of all create a backup of your ROM with an external programmer:
|
|
|
|
```console
|
|
|
|
# flashrom -p YOUR_PROGRAMMER -r backup.rom
|
|
|
|
```
|
|
|
|
|
2020-03-11 13:36:04 +01:00
|
|
|
Then, split the IFD regions into separate files with ifdtool. You will need
|
2020-02-16 00:35:03 +01:00
|
|
|
`flashregion_3_gbe.bin` later.
|
|
|
|
```console
|
|
|
|
$ ifdtool -x backup.rom
|
|
|
|
```
|
|
|
|
|
|
|
|
Now you need to patch the flash descriptor. You can either [modify the one from
|
|
|
|
your backup with **ifdtool**](#modifying-flash-descriptor-using-ifdtool), or
|
|
|
|
[generate a completely new one with **bincfg**](#creating-a-new-flash-descriptor-using-bincfg).
|
|
|
|
|
|
|
|
#### Modifying flash descriptor using ifdtool
|
|
|
|
|
|
|
|
Pick the layout according to your chip size from the table below and save it to
|
|
|
|
the `new_layout.txt` file:
|
|
|
|
|
|
|
|
```eval_rst
|
|
|
|
+---------------------------+---------------------------+---------------------------+
|
2020-03-20 00:57:00 +01:00
|
|
|
| 4 MiB chip | 8 MiB chip | 16 MiB chip |
|
2020-02-16 00:35:03 +01:00
|
|
|
+===========================+===========================+===========================+
|
|
|
|
| .. code-block:: none | .. code-block:: none | .. code-block:: none |
|
|
|
|
| | | |
|
|
|
|
| 00000000:00000fff fd | 00000000:00000fff fd | 00000000:00000fff fd |
|
|
|
|
| 00001000:00002fff gbe | 00001000:00002fff gbe | 00001000:00002fff gbe |
|
2021-03-06 19:46:03 +01:00
|
|
|
| 00003000:003fffff bios | 00003000:007fffff bios | 00003000:00ffffff bios |
|
2020-02-16 00:35:03 +01:00
|
|
|
| 00fff000:00000fff pd | 00fff000:00000fff pd | 00fff000:00000fff pd |
|
|
|
|
| 00fff000:00000fff me | 00fff000:00000fff me | 00fff000:00000fff me |
|
|
|
|
+---------------------------+---------------------------+---------------------------+
|
|
|
|
```
|
|
|
|
|
|
|
|
The last two lines define `pd` and `me` regions of negative size. This way
|
|
|
|
ifdtool will mark those as unused.
|
|
|
|
|
|
|
|
Update regions in the flash descrpitor (it was extracted previously with
|
|
|
|
`ifdtool -x`):
|
|
|
|
```console
|
|
|
|
$ ifdtool -n new_layout.txt flashregion_0_flashdescriptor.bin
|
|
|
|
```
|
|
|
|
|
|
|
|
Set `MeDisable` bit in ICH0 and MCH0 straps:
|
|
|
|
```console
|
|
|
|
$ ifdtool -M 1 flashregion_0_flashdescriptor.bin.new
|
|
|
|
```
|
|
|
|
|
|
|
|
Delete previous descriptors and rename the final one:
|
|
|
|
```console
|
|
|
|
$ rm flashregion_0_flashdescriptor.bin
|
|
|
|
$ rm flashregion_0_flashdescriptor.bin.new
|
|
|
|
$ mv flashregion_0_flashdescriptor.bin.new.new flashregion_0_flashdescriptor.bin
|
|
|
|
```
|
|
|
|
|
|
|
|
Continue to the [Configuring coreboot](#configuring-coreboot) section.
|
|
|
|
|
2021-03-06 14:54:01 +01:00
|
|
|
#### Using checked-in flash descriptor via bincfg
|
2020-02-16 00:35:03 +01:00
|
|
|
|
2021-03-06 14:54:01 +01:00
|
|
|
There is a copy of an X200's flash descriptor checked into the coreboot
|
|
|
|
repository. It is supposed to work for the T400/T500 as well. The descriptor
|
|
|
|
can be converted back to its binary form using a tool called **bincfg**. Go
|
|
|
|
to `util/bincfg` and build it:
|
2020-02-16 00:35:03 +01:00
|
|
|
```console
|
|
|
|
$ cd util/bincfg
|
|
|
|
$ make
|
|
|
|
```
|
|
|
|
|
2020-03-20 00:57:00 +01:00
|
|
|
If your flash is not 8 MiB, you need to change values of `flcomp_density1` and
|
2020-07-23 08:12:41 +02:00
|
|
|
`flreg1_limit` in the `ifd-x200.set` file according to following table:
|
2020-02-16 00:35:03 +01:00
|
|
|
|
|
|
|
```eval_rst
|
|
|
|
+-----------------+-------+-------+--------+
|
2020-03-20 00:57:00 +01:00
|
|
|
| | 4 MiB | 8 MiB | 16 MiB |
|
2020-02-16 00:35:03 +01:00
|
|
|
+=================+=======+=======+========+
|
|
|
|
| flcomp_density1 | 0x3 | 0x4 | 0x5 |
|
|
|
|
+-----------------+-------+-------+--------+
|
2021-03-06 19:46:03 +01:00
|
|
|
| flreg1_limit | 0x3ff | 0x7ff | 0xfff |
|
2020-02-16 00:35:03 +01:00
|
|
|
+-----------------+-------+-------+--------+
|
|
|
|
```
|
|
|
|
|
2021-03-06 14:54:01 +01:00
|
|
|
Then convert the flash descriptor:
|
2020-02-16 00:35:03 +01:00
|
|
|
```console
|
2020-03-22 17:08:15 +01:00
|
|
|
$ make gen-ifd-x200
|
2020-02-16 00:35:03 +01:00
|
|
|
```
|
|
|
|
|
2020-03-22 17:08:15 +01:00
|
|
|
It will be saved to the `flashregion_0_fd.bin` file.
|
|
|
|
|
2020-02-16 00:35:03 +01:00
|
|
|
#### Configuring coreboot
|
|
|
|
|
|
|
|
Now configure coreboot. You need to select correct chip size and specify paths
|
|
|
|
to flash descriptor and gbe dump.
|
|
|
|
|
|
|
|
```
|
|
|
|
Mainboard --->
|
|
|
|
ROM chip size (8192 KB (8 MB)) # According to your chip
|
2021-03-06 19:46:03 +01:00
|
|
|
(0x7fd000) Size of CBFS filesystem in ROM # or 0x3fd000 for 4 MiB chip / 0xffd000 for 16 MiB chip
|
2020-02-16 00:35:03 +01:00
|
|
|
|
|
|
|
Chipset --->
|
|
|
|
[*] Add Intel descriptor.bin file
|
2020-03-22 17:08:15 +01:00
|
|
|
# Note: if you used bincfg, specify path to generated util/bincfg/flashregion_0_fd.bin
|
2020-02-16 00:35:03 +01:00
|
|
|
(/path/to/flashregion_0_flashdescriptor.bin) Path and filename of the descriptor.bin file
|
|
|
|
|
|
|
|
[*] Add gigabit ethernet configuration
|
|
|
|
(/path/to/flashregion_3_gbe.bin) Path to gigabit ethernet configuration
|
|
|
|
```
|
|
|
|
|
|
|
|
Then build coreboot and flash whole `build/coreboot.rom` to the chip.
|
|
|
|
|
|
|
|
## Flash layout
|
|
|
|
|
|
|
|
The flash layouts of the OEM firmware are as follows:
|
|
|
|
|
|
|
|
```eval_rst
|
|
|
|
+---------------------------------+---------------------------------+
|
2020-03-20 00:57:00 +01:00
|
|
|
| 4 MiB chip | 8 MiB chip |
|
2020-02-16 00:35:03 +01:00
|
|
|
+=================================+=================================+
|
|
|
|
| .. code-block:: none | .. code-block:: none |
|
|
|
|
| | |
|
|
|
|
| 00000000:00000fff fd | 00000000:00000fff fd |
|
|
|
|
| 00001000:001f5fff me | 00001000:005f5fff me |
|
|
|
|
| 001f6000:001f7fff gbe | 005f6000:005f7fff gbe |
|
|
|
|
| 001f8000:001fffff pd | 005f8000:005fffff pd |
|
|
|
|
| 00200000:003fffff bios | 00600000:007fffff bios |
|
|
|
|
| 00290000:002affff ec | 00690000:006affff ec |
|
|
|
|
| 003e0000:003fffff bootblock | 007e0000:007fffff bootblock |
|
|
|
|
+---------------------------------+---------------------------------+
|
|
|
|
```
|
|
|
|
|
|
|
|
On each boot of vendor BIOS `ec` area in flash is checked for having firmware
|
|
|
|
there, and if there is one, it proceedes to update firmware on H8S/2116 (when
|
|
|
|
both external power and main battery are attached). Once update is performed,
|
2020-03-20 00:57:00 +01:00
|
|
|
first 64 KiB of `ec` area is erased. Visit
|
2020-02-16 00:35:03 +01:00
|
|
|
[thinkpad-ec repository](https://github.com/hamishcoleman/thinkpad-ec) to learn
|
|
|
|
more about how to extract EC firmware from vendor updates.
|