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.

178 lines
7.7 KiB

6 years ago
  1. # coreboot-x230
  2. pre-built coreboot images and documentation on how to flash them for the Thinkpad X230
  3. These images
  4. * include [SeaBIOS](https://seabios.org/SeaBIOS) as coreboot payload, for maximum compatibility.
  5. * are meant to be [flashed externally](#how-to-flash) (...top.rom release files)
  6. * ...full.rom release files are not functional entirely. Only the the top 4M are usable.
  7. * are compatible with Windows and Linux
  8. ## Latest build (config overview and version info)
  9. See our [releases](https://github.com/merge/coreboot-x230/releases)
  10. * Lenovo's proprietary VGA BIOS ROM is executed in "secure" mode
  11. ### coreboot
  12. * We simply take coreboot's current state in it's master branch at the time we build a release image.
  13. That's the preferred way to use coreboot. The git revision we use is always included in the release.
  14. ### Intel microcode
  15. * version [20180108](https://downloadcenter.intel.com/download/27431/Linux-Processor-Microcode-Data-File)
  16. * in 20180108, for the X230's CPU ID (306ax) the latest update is 2015-02-26
  17. * (not yet in coreboot upstream)
  18. ### SeaBIOS
  19. * version [1.11.0](https://seabios.org/Releases#SeaBIOS_1.11.0) from 2017-11-10
  20. * (in coreboot upstream)
  21. ## When do we do a release?
  22. Either when
  23. * There is a new SeaBIOS release,
  24. * There is a new Intel microcode release (included in coreboot AND affecting our CPU ID),
  25. * There is a coreboot issue that affects us (unlikely), or
  26. * We need to change the config
  27. ## TL;DR
  28. Download a released image, connect your hardware SPI flasher to the "upper"
  29. 4MB chip in your X230, and do
  30. flashrom -p linux_spi:dev=/dev/spidev0.0,spispeed=128 -w x230_coreboot_seabios_example_top.rom
  31. where `linux_spi:` is the example of using your SPI pins of, for example, a
  32. Raspberry Pi. A [Bus Pirate](http://dangerousprototypes.com/docs/Bus_Pirate) with
  33. `buspirate_spi` or others connected to the host directly should be fine too.
  34. ## Flashing for the first time
  35. ### EC firmware (optional)
  36. Enter Lenovo's BIOS with __F1__ and check the embedded controller (EC) version to be
  37. __1.14__ and upgrade using [the latest bootable CD](https://support.lenovo.com/at/en/downloads/ds029188)
  38. if it isn't. The EC cannot be upgraded when coreboot is installed. (In case a newer
  39. version should ever be available (I doubt it), you could temporarily flash back your
  40. original Lenovo BIOS image)
  41. ### me_cleaner (optional)
  42. The Intel Management Engine resides on the 8MB chip. We don't need to touch it
  43. for coreboot-upgrades in the future, but while opening up the Thinkpad anyways,
  44. we can save it and run [ifdtool](https://github.com/coreboot/coreboot/tree/master/util/ifdtool)
  45. and [me_cleaner](https://github.com/corna/me_cleaner) on it:
  46. flashrom -p linux_spi:dev=/dev/spidev0.0,spispeed=128 -c "MX25L3206E/MX25L3208E" -r ifdmegbe.rom
  47. flashrom -p linux_spi:dev=/dev/spidev0.0,spispeed=128 -c "MX25L3206E/MX25L3208E" -r ifdmegbe2.rom
  48. diff ifdmegbe.rom ifdmegbe2.rom
  49. git clone https://github.com/corna/me_cleaner.git && cd me_cleaner
  50. ./me_cleaner.py -S -O ifdmegbe_meclean.rom ifdmegbe.rom
  51. ifdtool -u ifdmegbe_meclean.rom
  52. flashrom -p linux_spi:dev=/dev/spidev0.0,spispeed=128 -c "MX25L3206E/MX25L3208E" -w ifdmegbe_meclean.rom.new
  53. ### save the 4MB chip
  54. (internally, memory of the two chips is mapped together, the 8MB being the lower
  55. part, but we can essientially ignore that)
  56. For the first time, we have to save the original image, just like we did with
  57. the 8MB chip. It's important to keep this image somewhere safe:
  58. flashrom -p linux_spi:dev=/dev/spidev0.0,spispeed=128 -r top1.rom
  59. flashrom -p linux_spi:dev=/dev/spidev0.0,spispeed=128 -r top2.rom
  60. diff top1.rom top2.rom
  61. ## Flashing the coreboot / SeaBIOS image
  62. When __upgrading__ to a new version, for example when a new [SeaBIOS](https://seabios.org/Releases)
  63. version is available, only the "upper" 4MB chip has to be written.
  64. Download the latest release image we provide here and flash it:
  65. flashrom -p linux_spi:dev=/dev/spidev0.0,spispeed=128 -w x230_coreboot_seabios_example_top.rom
  66. ## How to flash
  67. We flash externally, using a "Pomona 5250 8-pin SOIC test clip". You'll find
  68. one easily. This is how the X230's SPI connection looks on both 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. ### Example: Raspberry Pi 3
  77. We run [Raspbian](https://www.raspberrypi.org/downloads/raspbian/)
  78. and have the following setup
  79. * [Serial connection](https://elinux.org/RPi_Serial_Connection) using a "USB to Serial" UART Adapter and picocom or minicom
  80. * Yes, in this case you need a second PC connected to the RPi over UART
  81. * in the SD Cards's `/boot/config.txt` file `enable_uart=1` and `dtparam=spi=on`
  82. * [For flashrom](https://www.flashrom.org/RaspberryPi) we put `spi_bcm2835` and `spidev` in /etc/modules
  83. * [Connect to a wifi](https://www.raspberrypi.org/documentation/configuration/wireless/wireless-cli.md) or to network over ethernet to install `flashrom`
  84. * only use the ...top.rom release file
  85. * connect the Clip to the Raspberry Pi 3:
  86. Edge of pi (furthest from you)
  87. (UART)
  88. L GND TX RX CS
  89. E | | | |
  90. F +---------------------------------------------------------------------------------+
  91. T | x x x x x x x x x x x x x x x x x x x x |
  92. | x x x x x x x x x x x x x x x x x x x x |
  93. E +----------------------------------^---^---^---^-------------------------------^--+
  94. D | | | | |
  95. G 3.3V MOSIMISO| GND
  96. E (VCC) CLK
  97. Body of Pi (closest to you)
  98. Now you should be able to copy the image over to your Rasperry Pi and run the
  99. mentioned `flashrom` commands. One way to copy, is convertig it to ascii using
  100. `uuencode` (part of Debian's sharutils package) described below. Another way
  101. is of course using a USB Stick :)
  102. (convert)
  103. host$ uuencode coreboot.rom coreboot.rom.ascii > coreboot.rom.ascii
  104. (transfer)
  105. rpi$ cat > coreboot.rom.ascii
  106. host$ pv coreboot.rom.ascii > /dev/ttyUSBX
  107. (wait)
  108. rpi$ (CTRL-D)
  109. (convert back)
  110. rpi$ uudecode -o coreboot.rom coreboot.rom.ascii
  111. (verify)
  112. host$ sha1sum coreboot.rom
  113. rpi$ sha1sum coreboot.rom
  114. ### Example: internal
  115. NOT YET AVAILABLE HERE
  116. * make sure you have your backups
  117. * I find this to be a little more dangerous, but in this case you don't need any additional hardware
  118. * create the following file (named x230-layout.txt):
  119. * here you'll use the ...full.rom release file
  120. 0x00000000:0x007fffff ifdmegbe
  121. 0x00800000:0x00bfffff bios
  122. * Boot Linux with the `iomem=relaxed` boot parameter (for example set in /etc/default/grub) and use
  123. `flashrom -p internal --layout x230-layout.txt --image bios -w x230_coreboot_seabios_example_full.rom`
  124. ## How we build
  125. Everything necessary to build coreboot is included in this project and building
  126. coreboot is not hard at all. Please refer to [coreboot's own documentation](https://www.coreboot.org/Build_HOWTO).
  127. When building, testing and doing a release here, we always try to upload our
  128. result to coreboot's [board status project](https://www.coreboot.org/Supported_Motherboards).
  129. ## Why does this work?
  130. On the X230, there are 2 physical "BIOS" chips. The "upper" 4MB
  131. one holds the actual bios we can generate using coreboot, and the "lower" 8MB
  132. one holds the rest that you can [modify yourself once](#flashing-for-the-first-time),
  133. if you like, but strictly speaking, you don't need to touch it at all. What's this "rest"?
  134. Mainly a tiny binary used by the Ethernet card and the Intel Management Engine.