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.

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