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.

242 lines
11 KiB

  1. # Skulls - [Thinkpad X230](https://pcsupport.lenovo.com/en/products/laptops-and-netbooks/thinkpad-x-series-laptops/thinkpad-x230).
  2. ![seabios_bootmenu](front.jpg)
  3. ## Latest release
  4. * This directory's `./build.sh` should produce the exact release image file (from a skulls git checkout).
  5. Get it from our [release page](https://github.com/merge/coreboot-x230/releases)
  6. * __coreboot__: We take coreboot's master branch at the time we build a release image.
  7. * __microcode update__: revision `1f` from 2018-02-07 see package [20180312](https://downloadcenter.intel.com/download/27591) under [Intel's license](LICENSE.microcode)
  8. * __SeaBIOS__: version [1.11.1](https://seabios.org/Releases) from 2018-03-19
  9. * The only proprietary binary, the VGA BIOS is executed in "secure" mode ([PCI_OPTION_ROM_RUN_YABEL](https://www.coreboot.org/Coreboot_Options))
  10. ## table of contents
  11. * [TL;DR](#tldr)
  12. * [First-time installation](#firsttime-installation)
  13. * [Updating](#updating)
  14. * [Moving to Heads](#moving-to-heads)
  15. * [Why does this work](#why-does-this-work)
  16. ## TL;DR
  17. 1. run `sudo ./x230_before_first_install.sh` on your current X230 Linux system
  18. 2. Power down, remove the battery. Remove the keyboard and palmrest. Connect
  19. a hardware flasher to an external PC (or a Raspberry Pi with a SPI 8-pin chip clip
  20. can directly be used), and run
  21. `sudo ./external_install_bottom.sh` on the lower chip
  22. and `sudo ./external_install_top.sh` on the top chip of the two.
  23. 3. For updating later, run `./x230_skulls.sh`. No need to disassemble.
  24. And always use the latest [released](https://github.com/merge/coreboot-x230/releases)
  25. package. This will be tested. The git master
  26. branch is _not_ meant to be stable. Use it for testing only.
  27. ## First-time installation
  28. #### before you begin
  29. Before starting, run Linux on your X230, install `dmidecode` and run
  30. `sudo ./x230_before_first_install.sh`. It simply prints system information and helps
  31. you find out your RAM voltage. Make sure you have RAM that uses 1,5V, not 1,35V.
  32. #### original BIOS update / EC firmware (optional)
  33. Before flashing coreboot, consider doing one original Lenovo upgrade process
  34. in case you're not running the latest version. This is not supported anymore,
  35. once you're running coreboot (You'd have to manually flash back your backup
  36. images first, see later chapters).
  37. Also, this updates the BIOS _and_ Embedded Controller (EC) firmware. The EC
  38. is not updated anymore, when running coreboot. The latest EC version is 1.14
  39. and that's unlikely to change.
  40. In case you're not running the latest BIOS version, either
  41. * use [the latest original CD](https://support.lenovo.com/at/en/downloads/ds029188) and burn it, or
  42. * use the same, only with a patched EC firmware that allows using any aftermarket-battery:
  43. By default, only original Lenovo batteries are allowed.
  44. Thanks to [this](http://zmatt.net/unlocking-my-lenovo-laptop-part-3/)
  45. [project](https://github.com/eigenmatt/mec-tools) we can use Lenovo's bootable
  46. upgrade image, change it and create a bootable _USB_ image, with an EC update
  47. that allows us to use any 3rd party aftermarket battery:
  48. sudo apt-get install build-essential git mtools libssl-dev
  49. git clone https://github.com/hamishcoleman/thinkpad-ec && cd thinkpad-ec
  50. make patch_disable_keyboard clean
  51. make patch_enable_battery clean
  52. make patched.x230.img
  53. That's it. You can create a bootable USB stick: `sudo dd if=patched.x230.img of=/dev/sdx`
  54. and boot from it. Alternatively, burn `patched.x230.iso` to a CD. And make sure
  55. you have "legacy" boot set, not "UEFI" boot.
  56. #### preparation: required hardware
  57. * An 8 Pin SOIC Clip, for example from
  58. [Pomona electronics](https://www.pomonaelectronics.com/products/test-clips/soic-clip-8-pin)
  59. (for availability, check
  60. [aliexpress](https://de.aliexpress.com/item/POMONA-SOIC-CLIP-5250-8pin-eeprom-for-tacho-8pin-cable-for-pomana-soic-8pin/32814247676.html) or
  61. [elsewhere](https://geizhals.eu/?fs=pomona+test+clip+5250))
  62. or alternatively hooks like
  63. [E-Z-Hook](http://catalog.e-z-hook.com/viewitems/test-hooks/e-z-micro-hooks-single-hook-style)
  64. * 6 [female](https://electronics.stackexchange.com/questions/37783/how-can-i-create-a-female-jumper-wire-connector)
  65. [jumper wires](https://en.wikipedia.org/wiki/Jump_wire) like
  66. [these](https://geizhals.eu/jumper-cable-female-female-20cm-a1471094.html)
  67. to connect the clip to a hardware flasher (if not included with the clip)
  68. * a hardware flasher
  69. [supported by flashrom](https://www.flashrom.org/Flashrom/0.9.9/Supported_Hardware#USB_Devices), see below for the examples we support
  70. #### open up the X230
  71. Remove the 7 screws of your X230 to remove the keyboard (by pushing it towards the
  72. screen before lifting) and the palmrest. You'll find the chips using the photo
  73. below. This is how the SPI connection looks like on both of the X230's chips:
  74. Screen (furthest from you)
  75. ______
  76. MOSI 5 --| |-- 4 GND
  77. CLK 6 --| |-- 3 N/C
  78. N/C 7 --| |-- 2 MISO
  79. VCC 8 --|______|-- 1 CS
  80. Edge (closest to you)
  81. ... choose __one of the following__ supported flashing hardware examples:
  82. #### Hardware Example: Raspberry Pi 3
  83. A Raspberry Pi can directly be a flasher through it's I/O pins, see below.
  84. Use a test clip or hooks, see [required hardware](#preparation-required-hardware).
  85. On the RPi we run [Raspbian](https://www.raspberrypi.org/downloads/raspbian/)
  86. and have the following setup:
  87. * Connect to the console: Either
  88. * connect a screen and a keyboard, or
  89. * Use the [Serial connection](https://elinux.org/RPi_Serial_Connection) using a
  90. USB-to-serial cable (like [Adafruit 954](http://www.adafruit.com/products/954),
  91. [FTDI TTL-232R-RPI](http://www.ftdichip.com/Products/Cables/RPi.htm) or
  92. [others](https://geizhals.eu/usb-to-ttl-serial-adapter-cable-a1461312.html)) and
  93. picocom (`picocom -b 115200 /dev/ttyUSB0`) or minicom
  94. * in the SD Cards's `/boot/config.txt` file `enable_uart=1` and `dtparam=spi=on`
  95. * [For flashrom](https://www.flashrom.org/RaspberryPi) we put `spi_bcm2835`
  96. and `spidev` in /etc/modules
  97. * [Connect to a wifi](https://www.raspberrypi.org/documentation/configuration/wireless/wireless-cli.md)
  98. or ethernet to `sudo apt-get install flashrom`
  99. * connect the Clip to the Raspberry Pi 3 (there are
  100. [prettier images](https://github.com/splitbrain/rpibplusleaf) too):
  101. Edge of pi (furthest from you)
  102. (UART)
  103. L GND TX RX CS
  104. E | | | |
  105. F +---------------------------------------------------------------------------------+
  106. T | x x x x x x x x x x x x x x x x x x x x |
  107. | x x x x x x x x x x x x x x x x x x x x |
  108. E +----------------------------------^---^---^---^-------------------------------^--+
  109. D | | | | |
  110. G 3.3V MOSIMISO| GND
  111. E (VCC) CLK
  112. Body of Pi (closest to you)
  113. ![Raspberry Pi at work](rpi_clip.jpg)
  114. Now copy the Skulls release tarball over to the Rasperry Pi and
  115. [continue](#unpack-the-skulls-release-archive) on the Pi.
  116. #### Hardware Example: CH341A based
  117. The CH341A from [Winchiphead](http://www.wch.cn/), a USB interface chip,
  118. is used by some cheap memory programmers.
  119. The one we describe can be bought at
  120. [aliexpress](http://www.aliexpress.com/item/Free-Shipping-CH341A-24-25-Series-EEPROM-Flash-BIOS-DVD-USB-Programmer-DVD-programmer-router-Nine/32583059603.html),
  121. but it's available [elsewhere](https://geizhals.eu/?fs=ch341a) too.
  122. * Leave the P/S Jumper connected (programmer mode, 1a86:5512 USB device)
  123. * Connect the programmer to your PC's USB port
  124. * Connect your clip or hooks to the programmer's SPI pins
  125. TODO description and foto
  126. #### unpack the Skulls release archive
  127. mkdir skulls
  128. tar -xf skulls-x230-<version>.tar.xz -C skulls
  129. cd skulls
  130. #### ifd unlock and me_cleaner: the 8MB chip
  131. The [Intel Management Engine](https://en.wikipedia.org/wiki/Intel_Management_Engine)
  132. resides on the 8MB chip (at the bottom, closer to you).
  133. We don't need to touch it for coreboot-upgrades in the future, but to
  134. enable internal flashing, we need to unlock it once, and remove the Management
  135. Engine for
  136. [security reasons](https://en.wikipedia.org/wiki/Intel_Management_Engine#Security_vulnerabilities):
  137. sudo ./external_install_bottom.sh -m -k <backup.bin>
  138. That's it. Keep the backup safe.
  139. Background (just so you know):
  140. * The `-m` option above also runs `me_cleaner -S` before flashing back, see [me_cleaner](https://github.com/corna/me_cleaner).
  141. * The `-l` option will (re-)lock your flash ROM, in case you want to force
  142. yourself (and others) to hardware-flashing.
  143. * Connecting an ethernet cable as a power-source for SPI (instead of the VCC pin)
  144. is not necessary (some other flashing how-to guides mention this).
  145. Setting a fixed (and low) SPI speed for flashrom offeres the same stability.
  146. Our scripts do this for you.
  147. #### BIOS: the 4MB chip
  148. sudo ./external_install_top.sh -i <release-image-file>.rom -k <backup>
  149. That's it. Keep the backup safe, assemble and turn on the X230. coreboot will
  150. do hardware init and start SeaBIOS.
  151. ## Updating
  152. Only the "upper" 4MB chip has to be written.
  153. You can again flash externally, using `external_install_top.sh` just like the
  154. first time, see above.
  155. Instead you can run the update directly on your X230
  156. using Linux. That's of course very convenient - just install flashrom from your
  157. Linux distribution - but according to the
  158. [flashrom manpage](https://manpages.debian.org/stretch/flashrom/flashrom.8.en.html)
  159. this is very dangerous:
  160. 1. boot Linux with the `iomem=relaxed` boot parameter (for example in /etc/default/grub `GRUB_CMDLINE_LINUX_DEFAULT`)
  161. 2. [download](https://github.com/merge/skulls/releases) the latest Skulls release tarball and unpack it
  162. 3. run `sudo ./x230_skulls.sh` for generating all necessary files and instructions
  163. ## Moving to Heads
  164. [Heads](http://osresearch.net/) is an alternative BIOS system with advanced
  165. security features. It's more complicated to use though. When having Skulls
  166. installed, installing Heads is as easy as updating Skulls. You can directly
  167. start using it:
  168. * [build Heads](https://github.com/osresearch/heads)
  169. * boot Linux with the `iomem=relaxed` boot parameter
  170. * copy Heads' 12M image file `build/x230/coreboot.rom` to Skulls' x230 diretory
  171. * run `sudo ./x230_heads.sh`
  172. That's it. Heads is a completely different project. Please read the
  173. [documentation](http://osresearch.net/) for how to use it and report bugs
  174. [over there](https://github.com/osresearch/heads/issues)
  175. Switching back to Skulls is the same as [updating](#updating). Just run
  176. `./x230_skulls.sh`.
  177. ## Why does this work?
  178. On the X230, there are 2 physical "BIOS" chips. The "upper" 4MB
  179. one holds the actual bios we can generate using coreboot, and the "lower" 8MB
  180. one holds the rest that you can [modify yourself once](#flashing-for-the-first-time),
  181. if you like, but strictly speaking, you
  182. [don't need to touch it at all](https://www.coreboot.org/Board:lenovo/x230#Building_Firmware).
  183. What's this "rest"?
  184. Mainly a tiny binary used by the Ethernet card and the Intel Management Engine.