You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

271 lines
13 KiB

4 years ago
4 years ago
  1. # Skulls - [Thinkpad X230](https://pcsupport.lenovo.com/en/products/laptops-and-netbooks/thinkpad-x-series-laptops/thinkpad-x230) and X230T
  2. ![seabios_bootmenu](front.jpg)
  3. ## Latest release
  4. Get it from our [release page](https://github.com/merge/coreboot-x230/releases)
  5. * __coreboot__: We take coreboot's master branch at the time we build a release image.
  6. * __microcode update__: revision `0x21` from 2019-02-13
  7. * __SeaBIOS__: version [1.12.1](https://seabios.org/Releases) from 2019-02-04
  8. ### release images to choose from
  9. We release multiple different, but _very similar_ images you can choose from.
  10. They all should work on all versions of the X230/X230T. These are the
  11. differences; (xxxxxxxxxx stands for random characters in the filename):
  12. * `x230_coreboot_seabios_xxxxxxxxxx_top.rom` includes the _proprietary_
  13. [VGA BIOS](https://en.wikipedia.org/wiki/Video_BIOS) from [Intel](https://www.intel.com/content/www/us/en/intelligent-systems/intel-embedded-graphics-drivers/faq-bios-firmware.html)
  14. which is non-free software. It is executed in "secure" mode.
  15. * `x230_coreboot_seabios_free_xxxxxxxxxx_top.rom` includes the
  16. [VGA BIOS](https://en.wikipedia.org/wiki/Video_BIOS)
  17. [SeaVGABIOS](https://www.seabios.org/SeaVGABIOS) which is free software.
  18. While technically more interesting, visually this is currently not as
  19. beautiful:
  20. * The [bootspash image is not shown](https://github.com/merge/skulls/issues/59).
  21. * Early boot console messages (after your HDD's bootloader has started a kernel) might be [missing](https://github.com/merge/skulls/issues/46).
  22. ## table of contents
  23. * [TL;DR](#tldr)
  24. * [First-time installation](#first-time-installation)
  25. * [Updating](#updating)
  26. * [Moving to Heads](#moving-to-heads)
  27. * [Why does this work](#why-does-this-work)
  28. * [How to rebuild](#how-to-reproduce-the-release-images)
  29. ## TL;DR
  30. 1. run `sudo ./x230_skulls.sh` on your current X230 Linux system
  31. 2. Power down, remove the battery. Remove the keyboard and palmrest. Connect
  32. a hardware flasher to an external PC (or a Raspberry Pi with a SPI 8-pin chip clip
  33. can directly be used), and run
  34. `sudo ./external_install_bottom.sh` on the lower chip
  35. and `sudo ./external_install_top.sh` on the top chip of the two.
  36. 3. For updating later, run `./x230_skulls.sh`. No need to disassemble.
  37. And always use the latest [released](https://github.com/merge/coreboot-x230/releases)
  38. package. This will be tested. The git master
  39. branch is _not_ meant to be stable. Use it for testing only.
  40. ## First-time installation
  41. #### before you begin
  42. Run Linux on your X230, install `dmidecode` and run
  43. `sudo ./x230_skulls.sh`. It simply prints system information and
  44. helps you to be up to date.
  45. Make sure you have the latest skulls-x230 package release by running
  46. `./x230_skulls.sh -U`.
  47. #### original BIOS update / EC firmware (optional)
  48. If the script, `sudo ./x230_skulls.sh` says "The installed original BIOS is very
  49. old.", it means that you have a BIOS version that may include an EC version
  50. older than 1.14.
  51. If that's the case, consider doing one original Lenovo upgrade process. This is not
  52. supported anymore, once you're running coreboot (You'd have to manually
  53. flash back your backup images first, see later chapters).
  54. This updates the BIOS _and_ Embedded Controller (EC) firmware. The EC
  55. is not updated anymore, when running coreboot. The latest EC version is 1.15
  56. which is included with the latest official BIOS release 2.77 from 04 Oct 2019.
  57. You have 2 options:
  58. * use [the latest original CD](https://pcsupport.lenovo.com/us/en/products/laptops-and-netbooks/thinkpad-x-series-laptops/thinkpad-x230/downloads/ds029187) and burn it, or
  59. * use the same, only with a patched EC firmware that allows using any aftermarket-battery:
  60. (this is only possible up to EC Firmware 1.14)
  61. By default, only original Lenovo batteries are allowed.
  62. Thanks to [this](http://zmatt.net/unlocking-my-lenovo-laptop-part-3/)
  63. [project](https://github.com/eigenmatt/mec-tools) we can use Lenovo's bootable
  64. upgrade image, change it and create a bootable _USB_ image (even with EC updates
  65. that allows one to use 3rd party aftermarket batteries). For this, follow instructions
  66. at [github.com/hamishcoleman/thinkpad-ec](https://github.com/hamishcoleman/thinkpad-ec).
  67. #### preparation: required hardware
  68. * An 8 Pin SOIC Clip, for example from
  69. [Pomona electronics](https://www.pomonaelectronics.com/products/test-clips/soic-clip-8-pin)
  70. (for availability, check
  71. [aliexpress](https://de.aliexpress.com/item/POMONA-SOIC-CLIP-5250-8pin-eeprom-for-tacho-8pin-cable-for-pomana-soic-8pin/32814247676.html) or
  72. [elsewhere](https://geizhals.eu/?fs=pomona+test+clip+5250))
  73. or alternatively hooks like
  74. [E-Z-Hook XKM](https://e-z-hook.com/test-hooks/micro-hook/xkm/)
  75. * 6 [female](https://electronics.stackexchange.com/questions/37783/how-can-i-create-a-female-jumper-wire-connector)
  76. [jumper wires](https://en.wikipedia.org/wiki/Jump_wire) like
  77. [these](https://geizhals.eu/jumper-cable-female-female-20cm-a1471094.html)
  78. to connect the clip to a hardware flasher (if not included with the clip)
  79. * a hardware flasher
  80. [supported by flashrom](https://www.flashrom.org/Flashrom/0.9.9/Supported_Hardware#USB_Devices), see below for the examples we support
  81. #### open up the X230
  82. Remove the 7 screws of your X230 to remove the keyboard (by pushing it towards the
  83. screen before lifting) and the palmrest. You'll find the chips using the photo
  84. below. This is how the SPI connection looks like on both of the X230's chips:
  85. Screen (furthest from you)
  86. ![ ______
  87. MOSI 5 --| |-- 4 GND
  88. CLK 6 --| |-- 3 N/C
  89. N/C 7 --| |-- 2 MISO
  90. VCC 8 --|______|-- 1 CS](soic8.png)
  91. Edge (closest to you)
  92. ... choose __one of the following__ supported flashing hardware examples:
  93. #### Hardware Example: Raspberry Pi 3
  94. A Raspberry Pi can directly be a flasher through it's I/O pins, see below.
  95. Use a test clip or hooks, see [required hardware](#preparation-required-hardware).
  96. On the RPi we run [Raspbian](https://www.raspberrypi.org/downloads/raspbian/)
  97. and have the following setup:
  98. * Connect to the console: Either
  99. * connect a screen and a keyboard, or
  100. * Use the [Serial connection](https://elinux.org/RPi_Serial_Connection) using a
  101. USB-to-serial cable (like [Adafruit 954](http://www.adafruit.com/products/954),
  102. [FTDI TTL-232R-RPI](http://www.ftdichip.com/Products/Cables/RPi.htm) or
  103. [others](https://geizhals.eu/usb-to-ttl-serial-adapter-cable-a1461312.html)) and
  104. picocom (`picocom -b 115200 /dev/ttyUSB0`) or minicom
  105. * in the SD Cards's `/boot/config.txt` file `enable_uart=1` and `dtparam=spi=on`
  106. * [For flashrom](https://www.flashrom.org/RaspberryPi) we put `spi_bcm2835`
  107. and `spidev` in /etc/modules
  108. * [Connect to a wifi](https://www.raspberrypi.org/documentation/configuration/wireless/wireless-cli.md)
  109. or ethernet to `sudo apt-get install flashrom`
  110. * connect the Clip to the Raspberry Pi 3 (there are
  111. [prettier images](https://github.com/splitbrain/rpibplusleaf) too):
  112. Edge of pi (furthest from you)
  113. (UART)
  114. L GND TX RX CS
  115. E | | | |
  116. F +---------------------------------------------------------------------------------+
  117. T | x x x x x x x x x x x x x x x x x x x x |
  118. | x x x x x x x x x x x x x x x x x x x x |
  119. E +----------------------------------^---^---^---^-------------------------------^--+
  120. D | | | | |
  121. G 3.3V MOSIMISO| GND
  122. E (VCC) CLK
  123. Body of Pi (closest to you)
  124. ![Raspberry Pi at work](rpi_clip.jpg)
  125. Now copy the Skulls release tarball over to the Rasperry Pi and
  126. [continue](#unpack-the-skulls-release-archive) on the Pi.
  127. #### Hardware Example: CH341A based
  128. The CH341A from [Winchiphead](http://www.wch.cn/), a USB interface chip,
  129. is used by some cheap memory programmers.
  130. The one we describe can be bought at
  131. [aliexpress](http://www.aliexpress.com/item/Free-Shipping-CH341A-24-25-Series-EEPROM-Flash-BIOS-DVD-USB-Programmer-DVD-programmer-router-Nine/32583059603.html),
  132. but it's available [elsewhere](https://geizhals.eu/?fs=ch341a) too.
  133. This means you need a different computer running a Linux based system here.
  134. Also, we don't use the included 3,3V power output (provides too little power),
  135. but a separate power supply. If you don't have any, consider getting a AMS1117
  136. based supply for a second USB port (like [this](https://de.aliexpress.com/item/1PCS-AMS1117-3-3V-Mini-USB-5V-3-3V-DC-Perfect-Power-Supply-Module/32785334595.html) or [this](https://www.ebay.com/sch/i.html?_nkw=ams1117+usb)).
  137. * Leave the P/S Jumper connected (programmer mode, 1a86:5512 USB device)
  138. * Connect 3,3V from your external supply to the Pomona clip's (or hook) VCC
  139. * Connect GND from your external supply to GND on your CH341A programmer
  140. * Connect your clip or hooks to the rest of the programmer's SPI pins
  141. * Connect the programmer (and power supply, if USB) to your PC's USB port
  142. ![ch341a programmer with extra USB power supply](ch341a.jpg)
  143. #### unpack the Skulls release archive
  144. tar -xf skulls-x230-<version>.tar.xz
  145. cd skulls-x230-<version>
  146. #### ifd unlock and me_cleaner: the 8MB chip
  147. Flashing the bottom chip (closer to you) is optional. It has the same pinout
  148. than the upper chip. This allows you to enable/disable in-system flashing
  149. (without disassembling the Thinkpad) and/or to neuter the
  150. [Intel Management Engine](https://en.wikipedia.org/wiki/Intel_Management_Engine)
  151. for [security reasons](https://en.wikipedia.org/wiki/Intel_Management_Engine#Security_vulnerabilities).
  152. sudo ./external_install_bottom.sh -m -k <backup-file-to-create>
  153. That's it. Keep the backup safe. Here are the options (just so you know):
  154. * The `-m` option applies `me_cleaner -S -d` before flashing back, see
  155. [me_cleaner](https://github.com/corna/me_cleaner).
  156. * The `-l` option will (re-)lock your flash ROM, in case you want to force
  157. yourself (and others) to hardware-flashing, see [updating](#updating).
  158. #### Your BIOS choice: the 4MB chip
  159. Now it's time to make your choice! Choose one of the images included in our
  160. release and select it during running:
  161. sudo ./external_install_top.sh -k <backup-file-to-create>
  162. This selects and flashes it and that's it.
  163. Keep the backup safe, assemble and
  164. turn on the X230. coreboot will do hardware init and start SeaBIOS.
  165. ## Updating
  166. If you have locked your flash (i.e. `./external_install_bottom -l`) you can
  167. flash externally using `external_install_top.sh` just like the
  168. first time, see above. Only the "upper" 4MB chip has to be written.
  169. It is recommended to do the the update directly on your X230 using Linux
  170. though. This is considered more safe for your hardware and is very convenient -
  171. just install the "flashrom" program and run `./x230_skulls.sh`, see below.
  172. 1. boot Linux with the `iomem=relaxed` boot parameter (for example in /etc/default/grub `GRUB_CMDLINE_LINUX_DEFAULT`)
  173. 2. [download](https://github.com/merge/skulls/releases) the latest Skulls release tarball and unpack it or check for updates by running `./x230_skulls.sh -U`.
  174. 3. run `sudo ./x230_skulls.sh` and choose the image to flash.
  175. Hint: In case your Linux distribution's GRUB bootloader doesn't use the full
  176. screen, put the line `GRUB_GFXMODE=1366x768x32` in your `/etc/default/grub` file
  177. (and run `update_grub`).
  178. ## Moving to Heads
  179. [Heads](http://osresearch.net/) is an alternative BIOS system with advanced
  180. security features. It's more complicated to use though. When having Skulls
  181. installed, installing Heads is as easy as updating Skulls. You can directly
  182. start using it:
  183. * [build Heads](https://github.com/osresearch/heads)
  184. * boot Linux with the `iomem=relaxed` boot parameter
  185. * copy Heads' 12M image file `build/x230/coreboot.rom` to Skulls' x230 directory
  186. * run `sudo ./x230_heads.sh`
  187. That's it. Heads is a completely different project. Please read the
  188. [documentation](http://osresearch.net/) for how to use it and report bugs
  189. [over there](https://github.com/osresearch/heads/issues)
  190. Switching back to Skulls is the same as [updating](#updating). Just run
  191. `./x230_skulls.sh`.
  192. ## Why does this work?
  193. On the X230, there are 2 physical "BIOS" chips. The "upper" 4MB
  194. one holds the actual bios we can generate using coreboot, and the "lower" 8MB
  195. one holds the rest that you can [modify yourself once](#first-time-installation),
  196. if you like, but strictly speaking, you
  197. [don't need to touch it at all](https://www.coreboot.org/Board:lenovo/x230#Building_Firmware).
  198. What's this "rest"?
  199. Mainly a tiny binary used by the Ethernet card and the Intel Management Engine.
  200. Read the [coreboot documentation](https://doc.coreboot.org/mainboard/lenovo/xx30_series.html)
  201. for more details.
  202. ## how to reproduce the release images
  203. * `git clone https://github.com/merge/skulls`
  204. * `cd skulls/x230`
  205. * `git checkout 0.1.5` for the release you want to build. In this example 0.1.5.
  206. * `./build.sh` and choose the configuration you want to build
  207. ### replace the splashscreen image
  208. In order to create your own splashscreen image, before building,
  209. overwrite the `splashscreen.jpg` with your own JPEG, using
  210. * "Progressive" turned off, and
  211. * "4:2:0 (chroma quartered)" Subsampling