Skip to content

Commit

Permalink
Add Build and flash guide
Browse files Browse the repository at this point in the history
  • Loading branch information
Siproqu committed Aug 24, 2021
1 parent f66e0df commit 23000e9
Show file tree
Hide file tree
Showing 4 changed files with 234 additions and 0 deletions.
84 changes: 84 additions & 0 deletions Installing-and-Configuring/Building-Heads/t430s.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
---
layout: default
title: Lenovo T430s
nav_order: 1
permalink: /t430s-building/
parent: Step 1 - Building Heads
grand_parent: Installing and configuring
---

Lenovo T430s
====

<!-- markdownlint-disable MD033 -->
<details open markdown="block">
<summary>
Table of contents
</summary>
{: .text-delta }
1. TOC
{:toc}
</details>
<!-- markdownlint-enable MD033 -->

This guide only documents build options you might be interested in, which are:
If you are not interested in those options follow the [General Building](/general-building/) guide.

- Setting an arbitrary MAC address.
- Change some BIOS options (like swap the fn and ctrl-key)

# Preparation

Follow the [General Building](/general-building/) until you have installed all dependencies and cloned the tree. _Do not_ execute `make BOARD=t430s-maximized` yet!

# Edit build (optional)

## Change MAC of Ethernet NIC (via Hexeditor)


The ethernets NIC firmware is located at: `blobs/t430s/gbe.bin`

The MAC address appears twice in there at the offset: `0x0` and `0x1000` and is set to `00:de:ad:c0:ff:ee`.

Replace `00:de:ad:c0:ff:ee` with your MAC addresses at the two offsets.

## Change MAC (via coreboots bincfg)

**TODO**
<!-- clone https://github.com/coreboot/coreboot.git
cd build/coreboot/utils/bincfg/ && make
set mac in gbe-8...
bincfg gbe-8...spec gbe8...set gbe1
-->

## BIOS options

You can enable certain options like: swap the fn and ctrl key, enable sticky fn key etc.

```
cd ~/
git clone https://github.com/coreboot/coreboot.git
cd coreboot/src/mainboard/lenovo/t430s/
# Open the cmos.default file and enable or disable the options you like. Save the file and close it.
git diff cmos.default > ~/heads/patches/coreboot-4.13/0061-cmos-settings.patch
```

## Set different flash chip in flashrom arguments

**This step is only necessary if non of the detected chips matches MX25L12835F/MX25L12845E/MX25L12865E.**

- Open `heads/boards/t430s-maximized.config` with an editor.
- Search for `CONFIG_FLASHROM_OPTIONS=`
- Replace `-c MX25L12835F/MX25L12845E/MX25L12865E` with `-c <your chip name>`.

Run the build again and copy the new `coreboot.rom` to the USB dongle.

# Build Heads
```
make BOARD=t430s-maximized
```

Wait. Building will take some time...

The `coreboot.rom` image will be copied to `build/coreboot-4.13/t430s-maximized/coreboot.rom`.
Copy it to a USB dongle and follow the [Flashing Guide](/t430s-flashing/).
150 changes: 150 additions & 0 deletions Installing-and-Configuring/Flashing-Guides/t430s.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
---
layout: default
title: Lenovo T430s
nav_order: 1
permalink: /t430s-flashing/
parent: Step 2 - Flashing Guides
grand_parent: Installing and configuring
---

# Lenovo T430s


<!-- markdownlint-disable MD033 -->
<details open markdown="block">
<summary>
Table of contents
</summary>
{: .text-delta }
1. TOC
{:toc}
</details>
<!-- markdownlint-enable MD033 -->

## Prerequisits

### Hardware
- The USB dongle with the Heads binary (`coreboot.com`).
- A Raspberry Pi and either:
- jumper wires (6xFemale-Female, 3xFemale-Male), a Bread-Board
- OR 6xFemale-Female, 3 jumper wires, the equipment to solder a "Y-jumper wire" to connect two pins to one 3v3 output.
- A [Pamona SOIC-8 Clip](https://www.pomonaelectronics.com/products/test-clips/soic-clip-8-pin) (You can also try a cheaper one, but I failed with it).
- A computer to connect to the RasperrbyPi

### Software

- `raspi-config` to enable SPI on the RaspberryPi. If your Raspberry runs the default OS ([Raspberry Pi OS](https://www.raspberrypi.org/software/)) it is already installed.
- `flashrom` on the Raspberry Pi (`sudo apt install flashrom`).
- (optional) [OpenBoardView](https://openboardview.org/)


## Flash Heads

### **Disassemble the laptop**

Follow _chapter 9_ of the [Lenovo maintenance guide](https://download.lenovo.com/ibmdl/pub/pc/pccbbs/mobiles_pdf/t430s_t430si_hmm_en_0b48538_01.pdf) to disassembly the laptop.
You do not have to remove the smart card reader, the speakers and the Bluetooth card and its switch.

Though don't forget to remove the media card reader (page 75).

After you have taken out the mainboard flip it around.

The flash memory is located here:

![T430s-board](/images/T430s_board.jpg)

And has the following pin layout.

![T430s-chip](/images/T430s_chip_annotated.jpg)

In case you want reassure yourself: get the [board view file](https://drive.google.com/file/d/0B2mH6ffKfXjCUWJUb0FKa2g5SE0/view) to check out the pin layout there. You can open it with [OpenBoardView](https://openboardview.org/).

### **Prepare the Raspberry Pi**

First, you need to enable the SPI device on the Rapsberry Pi.

Do this by run `sudo raspi-config` and enable it under `Interface Options`. Reboot the Raspberry Pi.

Now connect the clip to the Raspberry Pi by using the jumper wires:

| Pi Pin | GPIO | chip pin |
|--------|------|--------------|
| 1 | First 3v3 | Vcc (8) |
| 17 | Second 3v3 | WB (3), HOLD (7) |
| 19 | 10 | MOSI (5) |
| 21 | 9 | MISO (2) |
| 23 | 11 | CLK (6) |
| 24 | 8 | CS0 (1) |
| 39 | Ground | GND (4) |

Since the RaspberryPi has only two 3v3 outputs you need to connect the WB and HOLD pin to the same 3v3 output. Use the bread board or your soldered wire for that.

### **Probe the chip**

Connect your USB dongle to the Raspberry and `cd` into it.

Connect the clip to the chip.

> In case flashrom can't detect or read the chip consider the following:
> - If your Raspberry Pi is connected to an laptop USB port plugin the laptop to the AC.
> - The legs of the chip are really tiny and wear down quickly. Does the clip has a proper connection to the chips legs?
> - Checkout flashroms [common problems](https://www.flashrom.org/Common_problems).
> - If noting helps you probably have to replace the chip on the mainboard.
> Here is a [guide](https://tobiasmanske.de/posts/thinkpad-coreboot-part1/) for that.
Detect the chip.

```
sudo flashrom -p linbux_spi:dev=/dev/spidev0.0,spispeed=10000
```

Flashrom should detect **two** chip types. One of them is `MX25L12835F/MX25L12845E/MX25L12865E`. Ignore the other one.

In case **non** of the detected chips match `MX25L12835F/MX25L12845E/MX25L12865E` you have to rebuild Coreboot unfortunately.

> If you have to rebuild:
> - Write down the name of the chip and follow [the build guide](/t430s-building/#set-different-flash-chip-in-flashrom-arguments) to edit the configuration.
> - Also replace `MX25L12835F/MX25L12845E/MX25L12865E` with your chip name in each of the commands below.
### **Backup and flash**

1. Backup the current BIOS

```
sudo flashrom -p linbux_spi:dev=/dev/spidev0.0,spispeed=10000 -c MX25L12835F/MX25L12845E/MX25L12865E -r ./dump_1.bin
sudo flashrom -p linbux_spi:dev=/dev/spidev0.0,spispeed=10000 -c MX25L12835F/MX25L12845E/MX25L12865E -r ./dump_2.bin
sudo flashrom -p linbux_spi:dev=/dev/spidev0.0,spispeed=10000 -c MX25L12835F/MX25L12845E/MX25L12865E -r ./dump_3.bin
```

2. Compare hash sums

```
sha256sum -b dump_1.bin > hashvalues.txt
sha256sum -b dump_2.bin >> hashvalues.txt
sha256sum -b dump_3.bin >> hashvalues.txt
```
Compare the hash sums. If they do not match, read the content again and compare until they match.

Copy the dumps and `hashvalues.txt` to your USB dongle.

Those dumps are your backup of the current BIOS! You can flash them in case something went wrong and your laptop won't boot.

3. Flash Heads

```
sudo flashrom -p linbux_spi:dev=/dev/spidev0.0,spispeed=10000 -c MX25L12835F/MX25L12845E/MX25L12865E -w coreboot.rom
```

Once its done assemble your laptop and boot into Heads.

Continue with [configuring keys](/Configuring-Keys/).

# Archived Technical Details and References

- [Maintenance guide for the T430s](https://download.lenovo.com/ibmdl/pub/pc/pccbbs/mobiles_pdf/t430s_t430si_hmm_en_0b48538_01.pdf) ([archive](https://web.archive.org/web/20201112013412/https://download.lenovo.com/ibmdl/pub/pc/pccbbs/mobiles_pdf/t430s_t430si_hmm_en_0b48538_01.pdf))
- [T430s board view](https://drive.google.com/file/d/0B2mH6ffKfXjCUWJUb0FKa2g5SE0/view) ([archive](https://archive.org/details/t430s.boardview.11263-1_UMA))
- [Flash Memory Reference - MX25L12835F](https://www.mxic.com.tw/Lists/Datasheet/Attachments/7397/MX25L12835F,%203V,%20128Mb,%20v1.6.pdf) ([archive](https://web.archive.org/web/20210816122225/https://www.mxic.com.tw/Lists/Datasheet/Attachments/7397/MX25L12835F,%203V,%20128Mb,%20v1.6.pdf))
- [Solder new flash memory](https://tobiasmanske.de/posts/thinkpad-coreboot-part1/) ([archive](https://web.archive.org/web/20210824072910/https://tobiasmanske.de/posts/thinkpad-coreboot-part1/))
- [Flashrom RaspberryPi guide](https://flashrom.org/RaspberryPi) ([archive](https://web.archive.org/web/20210604150505/https://flashrom.org/RaspberryPi))
- [RaspberryPi Pin Layout](https://pinout.xyz/pinout/spi) ([archive](https://web.archive.org/web/20210818215850/https://pinout.xyz/))

Binary file added images/T430s_board.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/T430s_chip_annotated.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 23000e9

Please sign in to comment.