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.

219 lines
9.6 KiB

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