lilibyte

ThinkPad X60T Libreboot Log
2021-09-08
hardware, software

First Attempt At Internal Flashing

I started off following Luke Smith's video on installing Libreboot on X60 ThinkPads. This video walks you through the typical (but soon out-dated) "2 stage" process for an internal Libreboot installation.

In the process of doing the first flash, I got the warning /dev/mem map failed: Operation not permitted exactly like this post on the libreboot reddit forum and fixed it by following the typical advice for this problem: changing your grub configuration (in my case I changed /etc/default/grub) to include GRUB_CMDLINE_LINUX="iomem=relaxed" and re-ran the flash script. At this point, with everything seeming to be working correctly, I shutdown the system only to find the screen not turning on despite the green indicator lights working.

I asked for help on IRC and after some unfortunate miscommunication, my X60T was bricked. I'll explain that in the next section but first on the off-chance someone ever reads this and is in a similar position: BEFORE YOU DO ANYTHING

Both much hassle was had, and many new things were learned in the steps it took just to get back to this point since I'm new to all of this, especially externally flashing a chip There's a good chance your screen is incompatible with the version of Libreboot you flashed. Don't make the same mistake I did in making the issue worse!

What I Did Wrong: Manually "Reset" The bucts

I was using guidance that assumed that my ThinkPad was still running the Lenovo BIOS but with the bucts (Backup Control; Top Swap) set to 1. From that page on the libreboot.org documentation:

> If you flash such a ROM, while bucts is set to 1, the system won’t boot because there’s not a valid bootblock ... reset BUC.TS to 0 by removing that yellow cmos coin (it’s a battery) and putting it back after a minute or two

This commit was made as a result of my issue, containing the following addition to the documentation:

> +**WARNING: if flashrom complains about /dev/mem access, please
> +run sudo ./bucts 0. If flashrom is complaining about /dev/mem, it means
> +that you have CONFIG_STRICT_DEVMEM enabled in your kernel. Reboot with the
> +following kernel parameter added in your bootloader: iomem=relaxed and try
> +again with the above instructions. DO NOT continue until the above works, and
> +you see the expected flashrom output as indicated above.**
> +
> +If you *did* run flashrom and it failed to flash, but you set bucts to 1 and
> +shut down, don't worry. Just remove the yellow coin-cell battery (it's underneath
> +the keyboard, connected to the mainboard), wait a minute or two, reconnect the
> +coin-cell and try again from scratch. In this instance, if flashrom didn't do
> +anything, and didn't flash anything, it means you still have Lenovo BIOS but
> +if bucts is set to 1, you can flush it and set it back to 0. BUC.TS is stored in
> +volatile memory, powered by that CR2032 coin-cell battery.

For some people that advice is sound, I'm sure, but in my case the libreboot flash was indeed successful, so when I proceeded with unplugging the CR2032 coin-cell battery and rebooted, I got nothing other than beeping: one long beep, and two shorter beeps.

According to BIOS Central this means "System board failure; Video adapter problem; LCD assembly failure". At this point, it is safe to assume that I already had libreboot flashed and bucts set to 0, but no longer have a useable BIOS after unplugging the coin-cell battery.

Unbricking My X60T: Externally Flashing Libreboot With A Raspberry Pi

Because I already have a Raspberry Pi but no other equipment suitable for external flashing, I purchased the following two items:

This post is meant to be more of an anecdote than a tutorial, so here are some links I used or think could be useful:

I ended up just installing Raspberry Pi OS Lite and using the raspi-config script for setting it up, and then installing the dependencies needed for flashrom/downloading libreboot. I was previously using an Arch Linux ARM install, but I wasted way too much time trying to get that playing nicely with the install scripts so I gave up.

My biggest recommendation would be to TAKE LOTS OF PHOTOS during the disassembly process. The libreboot.org X60T recovery guide shows pictures detailing the process, but I ultimately just disconnected everything that I could. I don't know if that ended up hurting me or not specifically because I did run into issues after this:

The guide states:

> NOTE: On X60/T60 thinkpads, don’t connect pin 8. Instead, plug in your the PSU to the charging port on your mainboard, but do not power on the mainboard. This will provide a stable 3.3V voltage, with adequate current levels. On those laptops, this is necessary because the flash shares a common 3.3V DC rail with many other ICs that all draw quite a lot of current.

In other words, plug the charging cable into the port on the laptop, but don't plug the cable into an outlet. I was stuck on this step for longer than any other, I think. I tried to get a proper 3.3V signal but nothing seemed to work which produced this result when trying to use flashrom to detect the chip: No EEPROM/flash device found.. I went through all the troubleshooting steps for this error I could find or think of:

The closest I got after dozens of attempts was this strange output:

Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns).
Found ST flash chip "unknown ST SPI chip" (0 kB, SPI) on linux_spi.
===
This flash part has status NOT WORKING for operations: PROBE READ ERASE WRITE
The test status of this chip may have been updated in the latest development
version of flashrom. If you are running the latest development version,
please email a report to flashrom@flashrom.org if any of the above operations
work correctly for you with this flash chip. Please include the flashrom log
file for all operations you tested (see the man page for details), and mention
which mainboard or programmer you tested in the subject line.
Thanks for your help!
No operations were specified.

But even that I never saw again. I'm still not sure why I never had any luck with the charging cable providing the 3.3v signal. I decided to just risk wiring the 1st Pi GPIO pin to the 8th flash rom chip pin and power it that way, contrary to the advice from both of the Libreboot guides:

> NOTE: Do not use the 3.3v rail from your SPI programmer. Leave that disconnected. For 3.3v, plug your charger into the mainboard (but do not power on the mainboard) when the clip is connected. Before removing the clip, disconnect the charger. This will provide adequate 3.3v DC at correct current levels. The SPI flash on an X60 Tablet shares a common 3.3V rail with many other components on the mainboard, which all draw a lot of current, more than most flashers can provide.

x60t soic8 wired to rpi

Luckily this did work for me without any issues. Here is a terrible mockup I made showing the proper wiring configuration. This same information is also available in the libreboot.org guides linked above.

rpi soic8 wiring diagram

For reference, here is the flashing log:

pi@raspberrypi:~/lbmk/flashrom $ sudo ./flashrom -p linux_spi:dev=/dev/spidev0.0,spispeed=512
flashrom v1.2 on Linux 5.10.52-v7l+ (armv7l)
flashrom is free software, get the source code at https://flashrom.org

Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns).
Found SST flash chip "SST25VF016B" (2048 kB, SPI) on linux_spi.
No operations were specified.

pi@raspberrypi:~/lbmk/flashrom $ sudo ./flashrom -p linux_spi:dev=/dev/spidev0.0,spispeed=4096 -r dump.bin
flashrom v1.2 on Linux 5.10.52-v7l+ (armv7l)
flashrom is free software, get the source code at https://flashrom.org

Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns).
Found SST flash chip "SST25VF016B" (2048 kB, SPI) on linux_spi.
Reading flash... done.

pi@raspberrypi:~/lbmk/flashrom $ sudo ./flashrom -p linux_spi:dev=/dev/spidev0.0,spispeed=4096 -w
~/x60_usdvorak_vesafb.rom
flashrom v1.2 on Linux 5.10.52-v7l+ (armv7l)
flashrom is free software, get the source code at https://flashrom.org

Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns).
Found SST flash chip "SST25VF016B" (2048 kB, SPI) on linux_spi.
Reading old flash chip contents... done.
Erasing and writing flash chip... Erase/write done.
Verifying flash... VERIFIED.

Dumping the existing rom wasn't actually very important to do in my case because I had already flashed libreboot in another step.

The reassembly process was arguably the most tedius thing to deal with up until this point, which is why I stress again the importance of taking photos of exactly where things go and how cables are laid out. A single component was held together with 10 small screws of at least 4 different sizes. I'm very sure it's not quite as tidy inside as it originally was lol.

Since I already had it disassembled, I used the opprotunity to replace the WiFi chip with an Atheros AR5B95H chip that should be supported by a free Linux driver, upgrade the RAM to 2x 2GB 667MHz sticks ( only 3GB will be able to be used), and install a drop-in USB-C replacement charging port:

USB-C Power Jack Replacement Intermission

These replacement ports for X60 type ThinkPads are very interesting to me in my pursuit in carrying around the fewest cable varieties possible. It's also a lovely reminder of the extent that user serviceability and customization of consumer electronics has been crippled since the mid 2000s when these laptops were being made.

The process was very simple: remove a couple screws, pop off the metal bracket holding the power jack and modem connectors, replace the power jack with the new one, return the two screws after lining the modem connector's ground cable back under its screw

x60t with usb-c modification

Finally reroute the new power jack cable through the channels used by the previous one, and plug the internal cable connector back into the mainboard.

It works for me without any issue. I'm using the same wall plug and cable that I use for my more modern laptop and my phone.

Booting Back Up... With Mixed Results

After reassembling only as much as needed, I booted back on only two find two things: 1. the screen is clearly still not working, and 2. I no longer have the beeps that indicate a dead BIOS. To test whether the system worked at all I got ahold of a VGA to HDMI adapter to test the display output, and sure enough after a considerable waiting period with a blank screen the Arch Linux startup screen appears on my external monitor.

Strangely, the first thing I see on the screen is fsck hanging for a solid minute or two: /dev/sda1: recovering journal and /dev/sda1: clean xxx/xxx files, xxx/xxx blocks.

Not something that had ever happened prior to installing libreboot.

fsck error message

After a while stuck on this unchanging message it abruptly switches to the Arch login prompt. I can successfully log into my system and even start xorg, but if I unplug the VGA adapter and plug it back in I end up seeing the same fsck message as before and being taken back to login.

partially successful boot

Based on the List of supported ThinkPad X60 Tablets from now deleted docs:

X60T XGA (1024x768):

X60T SXGA+ (1400x1050):

My assumption is that the 20160907 version of Libreboot I flashed does not support whatever panel is in my X60T, but because I can't get Arch to detect the screen anymore I can't check what panel model I have without disassembling the panel, which I would rather not do if I can avoid it.

Installing A Testing Release Of Libreboot

Without much of an idea of what try next, I consulted the IRC again:

leah> lilibyte: it's odd that the screen doesn't work
      ...
      please try libreboot 20210522 instead. the latest testing release
      it uses a newer coreboot, which has much better edid code, and your
      internal screen on the laptop might work there
      and if that doesn't work, file a bug
      ...

I proceeded with the more recent method of software flashing libreboot using flashrom directly:

[lain@navi ~]$ wget $MIRROR/pub/libreboot/testing/20210522/roms/libreboot-20210522_x60.tar.xz
[lain@navi ~]$ sudo flashrom -p internal -w grub_x60_libgfxinit_corebootfb_usdvorak.rom 
flashrom v1.2 on Linux 5.12.15-arch1-1.0 (i686)
flashrom is free software, get the source code at https://flashrom.org

Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns).
Found chipset "Intel ICH7M".
Enabling flash write... OK.
Found SST flash chip "SST25VF016B" (2048 kB, SPI) mapped at physical address 0xffe00000.
Reading old flash chip contents... done.
Erasing and writing flash chip... Erase/write done.
Verifying flash... VERIFIED.

The flash was successful and I'm almost running normally now! At this point my screen is partially working without need of an external monitor. It's completely black during the boot process but once Arch boots a login screen appears and I can log in, use the TTY, and start an X server normally.

I'll update this post whenever I try something new or have any new information. All of the above was recorded just over a month ago (08/2021).