x200_external.html 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1">
  6. <style type="text/css">
  7. @import url('../css/main.css');
  8. </style>
  9. <title>ThinkPad X200: flashing tutorial (BeagleBone Black)</title>
  10. </head>
  11. <body>
  12. <div class="section">
  13. <h1 id="pagetop">Flashing the X200 with a BeagleBone Black</h1>
  14. <p>Initial flashing instructions for X200.</p>
  15. <p>
  16. This guide is for those who want libreboot on their ThinkPad X200
  17. while they still have the original Lenovo BIOS present. This guide
  18. can also be followed (adapted) if you brick your X200, to know how
  19. to recover.
  20. </p>
  21. <ul>
  22. <li><a href="#preinstall">X200 laptops with libreboot pre-installed</a></li>
  23. <li><a href="#flashchips">Flash chips</a></li>
  24. <li><a href="#macaddress">MAC address</a></li>
  25. <li><a href="#clip">Initial BBB configuration and installation procedure</a></li>
  26. <li><a href="#boot">Boot it!</a></li>
  27. <li><a href="#wifi">Wifi</a></li>
  28. <li><a href="#wwan">wwan</a></li>
  29. <li><a href="#memory">Memory</a></li>
  30. <li><a href="#gpio33">X200S and X200 Tablet users: GPIO33 trick will not work.</a></li>
  31. </ul>
  32. <p><a href="index.html">Back to main index</a></p>
  33. </div>
  34. <div class="section">
  35. <h1 id="preinstall">X200 laptops with libreboot pre-installed</h1>
  36. <p>
  37. If you don't want to install libreboot yourself, companies exist that sell these laptops
  38. with libreboot pre-installed, along with a free GNU/Linux distribution.
  39. </p>
  40. <p>
  41. Check the <a href="../../suppliers">suppliers</a> page for more information.
  42. </p>
  43. </div>
  44. <div class="section">
  45. <h1 id="flashchips">Flash chip size</h1>
  46. <p>
  47. Use this to find out:<br/>
  48. # <b>dmidecode | grep ROM\ Size</b>
  49. </p>
  50. <p>
  51. The X200S and X200 Tablet will use a WSON-8 flash chip, on the
  52. bottom of the motherboard (this requires removal of the
  53. motherboard). <b>Not all X200S/X200T are supported;
  54. see <a href="../hcl/x200.html#x200s">../hcl/x200.html#x200s</a>.</b>
  55. </p>
  56. <p>
  57. <a href="#pagetop">Back to top of page.</a>
  58. </p>
  59. </div>
  60. <div class="section">
  61. <h1 id="macaddress">MAC address</h1>
  62. <p>
  63. On the X200/X200S/X200T, the MAC address for the onboard
  64. gigabit ethernet chipset is stored inside the flash chip,
  65. along with other configuration data.
  66. </p>
  67. <p>
  68. Keep a note of the MAC address before disassembly; this is
  69. very important, because you will need to insert this into
  70. the libreboot ROM image before flashing it.
  71. It will be written in one of these locations:
  72. </p>
  73. <p>
  74. <img src="images/x200/disassembly/0002.jpg" alt="" />
  75. <img src="images/x200/disassembly/0001.jpg" alt="" />
  76. </p>
  77. </div>
  78. <div class="section">
  79. <h1 id="clip">Initial BBB configuration</h1>
  80. <p>
  81. Refer to <a href="bbb_setup.html">bbb_setup.html</a> for how to
  82. set up the BBB for flashing.
  83. </p>
  84. <p>
  85. The following shows how to connect the clip to the BBB (on the P9 header), for SOIC-16 (clip: Pomona 5252):
  86. </p>
  87. <pre>
  88. POMONA 5252 (correlate with the BBB guide)
  89. === front (display) on your X200 ====
  90. NC - - 21
  91. 1 - - 17
  92. NC - - NC
  93. NC - - NC
  94. NC - - NC
  95. NC - - NC
  96. 18 - - 3.3V (PSU)
  97. 22 - - NC - this is pin 1 on the flash chip
  98. === back (palmrest) on your X200 ===
  99. <i>This is how you will connect. Numbers refer to pin numbers on the BBB, on the plugs near the DC jack.</i>
  100. Here is a photo of the SOIC-16 flash chip. Pins are labelled:<br/>
  101. <img src="images/x200/x200_pomona.jpg" alt="" />
  102. </pre>
  103. <p>
  104. The following shows how to connect the clip to the BBB (on the P9 header), for SOIC-8 (clip: Pomona 5250):
  105. </p>
  106. <pre>
  107. POMONA 5250 (correlate with the BBB guide)
  108. === left side of the X200 (where the VGA port is) ====
  109. 18 - - 1
  110. 22 - - NC
  111. NC - - 21
  112. 3.3V (PSU) - - 17 - this is pin 1 on the flash chip. in front of it is the screen.
  113. === right side of the X200 (where the audio jacks are) ===
  114. <i>This is how you will connect. Numbers refer to pin numbers on the BBB, on the plugs near the DC jack.</i>
  115. Here is a photo of the SOIC-8 flash chip. The pins are labelled:<br/>
  116. <img title="Copyright 2015 Patrick &quot;P. J.&quot; McDermott &lt;pj@pehjota.net&gt;, see license notice at the end of this document" src="images/x200/soic8.jpg" />
  117. Look at the pads in that photo, on the left and right. Those are for SOIC-16. Would it be possible to remove the SOIC-8 and solder a SOIC-16
  118. chip on those pins?
  119. </pre>
  120. <p>
  121. <b>On the X200S and X200 Tablet the flash chip is underneath the board, in a WSON package.
  122. The pinout is very much the same as a SOIC-8, except you need to solder (there are no clips available).<br/>
  123. The following image shows how this is done:</b><br/>
  124. <img src="images/x200/wson_soldered.jpg" title="Copyright 2014 Steve Shenton &lt;sgsit@libreboot.org&gt; see license notice at the end of this document" alt="" />
  125. <br/>
  126. In this image, a pin header was soldered onto the WSON. Another solution might be to de-solder the WSON-8 chip and put a SOIC-8 there instead.
  127. Check the list of SOIC-8 flash chips at <a href="../hcl/gm45_remove_me.html#flashchips">../hcl/gm45_remove_me.html#flashchips</a> but
  128. do note that these are only 4MiB (32Mb) chips. The only X200 SPI chips with 8MiB capacity are SOIC-16. For 8MiB capacity in this case,
  129. the X201 SOIC-8 flash chip (Macronix 25L6445E) might work.
  130. </p>
  131. <h2>
  132. The procedure
  133. </h2>
  134. <p>
  135. This section is for the X200. This does not apply to the X200S or X200 Tablet
  136. (for those systems, you have to remove the motherboard completely, since
  137. the flash chip is on the other side of the board).
  138. </p>
  139. <p>
  140. Remove these screws:<br/>
  141. <img src="images/x200/disassembly/0003.jpg" alt="" />
  142. </p>
  143. <p>
  144. Push the keyboard forward, gently, then lift it off and
  145. disconnect it from the board:<br/>
  146. <img src="images/x200/disassembly/0004.jpg" alt="" />
  147. <img src="images/x200/disassembly/0005.jpg" alt="" />
  148. </p>
  149. <p>
  150. Pull the palm rest off, lifting from the left and right side at the back of the
  151. palm rest:<br/>
  152. <img src="images/x200/disassembly/0006.jpg" alt="" />
  153. </p>
  154. <p>
  155. Lift back the tape that covers a part of the flash chip, and
  156. then connect the clip:<br/>
  157. <img src="images/x200/disassembly/0007.jpg" alt="" />
  158. <img src="images/x200/disassembly/0008.jpg" alt="" />
  159. </p>
  160. <p>
  161. On pin 2 of the BBB, where you have the ground (GND), connect the
  162. ground to your PSU:<br/>
  163. <img src="images/x200/disassembly/0009.jpg" alt="" />
  164. <img src="images/x200/disassembly/0010.jpg" alt="" />
  165. </p>
  166. <p>
  167. Connect the 3.3V supply from your PSU to the flash chip (via
  168. the clip):<br/>
  169. <img src="images/x200/disassembly/0011.jpg" alt="" />
  170. <img src="images/x200/disassembly/0012.jpg" alt="" />
  171. </p>
  172. <p>
  173. Of course, make sure that your PSU is also plugged in and
  174. turn on:<br/>
  175. <img src="images/x200/disassembly/0013.jpg" alt="" />
  176. </p>
  177. <p>
  178. This tutorial tells you to use an ATX PSU, for the 3.3V DC
  179. supply. The PSU used when taking these photos is actually
  180. not an ATX PSU, but a PSU that is designed specifically
  181. for providing 3.3V DC (an ATX PSU will also work):<br/>
  182. <img src="images/x200/disassembly/0014.jpg" alt="" />
  183. </p>
  184. <p>
  185. Now, you should be ready to install libreboot.
  186. </p>
  187. <p>
  188. Flashrom binaries for ARM (tested on a BBB) are distributed in libreboot_util. Alternatively,
  189. libreboot also distributes flashrom source code which can be built.
  190. </p>
  191. <p>
  192. Log in as root on your BBB, using the instructions in
  193. <a href="bbb_setup.html#bbb_access">bbb_setup.html#bbb_access</a>.
  194. </p>
  195. <p>
  196. Test that flashrom works:<br/>
  197. # <b>./flashrom -p linux_spi:dev=/dev/spidev1.0,spispeed=512</b><br/>
  198. In this case, the output was:
  199. </p>
  200. <pre>
  201. flashrom v0.9.7-r1854 on Linux 3.8.13-bone47 (armv7l)
  202. flashrom is free software, get the source code at http://www.flashrom.org
  203. Calibrating delay loop... OK.
  204. Found Macronix flash chip &quot;MX25L6405(D)&quot; (8192 kB, SPI) on linux_spi.
  205. Found Macronix flash chip &quot;MX25L6406E/MX25L6436E&quot; (8192 kB, SPI) on linux_spi.
  206. Found Macronix flash chip &quot;MX25L6445E/MX25L6473E&quot; (8192 kB, SPI) on linux_spi.
  207. Multiple flash chip definitions match the detected chip(s): &quot;MX25L6405(D)&quot;, &quot;MX25L6406E/MX25L6436E&quot;, &quot;MX25L6445E/MX25L6473E&quot;
  208. Please specify which chip definition to use with the -c &lt;chipname&gt; option.
  209. </pre>
  210. <p>
  211. How to backup factory.rom (change the -c option as neeed, for your flash chip):<br/>
  212. # <b>./flashrom -p linux_spi:dev=/dev/spidev1.0,spispeed=512 -r factory.rom</b><br/>
  213. # <b>./flashrom -p linux_spi:dev=/dev/spidev1.0,spispeed=512 -r factory1.rom</b><br/>
  214. # <b>./flashrom -p linux_spi:dev=/dev/spidev1.0,spispeed=512 -r factory2.rom</b><br/>
  215. Note: the <b>-c</b> option is not required in libreboot's patched flashrom, because
  216. the redundant flash chip definitions in <i>flashchips.c</i> have been removed.<br/>
  217. Now compare the 3 images:<br/>
  218. # <b>sha512sum factory*.rom</b><br/>
  219. If the hashes match, then just copy one of them (the factory.rom) to a safe place (on a drive connected to another system, not
  220. the BBB). This is useful for reverse engineering work, if there is a desirable behaviour in the original firmware
  221. that could be replicated in coreboot and libreboot.
  222. </p>
  223. <p>
  224. Follow the instructions at <a href="../hcl/gm45_remove_me.html#ich9gen">../hcl/gm45_remove_me.html#ich9gen</a>
  225. to change the MAC address inside the libreboot ROM image, before flashing it.
  226. Although there is a default MAC address inside the ROM image, this is not what you want. <b>Make sure
  227. to always change the MAC address to one that is correct for your system.</b>
  228. </p>
  229. <p>
  230. Now flash it:<br/>
  231. # <b>./flashrom -p linux_spi:dev=/dev/spidev1.0,spispeed=512 -w path/to/libreboot/rom/image.rom -V</b>
  232. </p>
  233. <p>
  234. <img src="images/x200/disassembly/0015.jpg" alt="" />
  235. </p>
  236. <p>
  237. You might see errors, but if it says <b>Verifying flash... VERIFIED</b> at the end, then it's flashed and should boot.
  238. If you see errors, try again (and again, and again); the message <b>Chip content is identical to the requested image</b>
  239. is also an indication of a successful installation.
  240. </p>
  241. <p>
  242. Example output from running the command (see above):
  243. </p>
  244. <pre>
  245. flashrom v0.9.7-r1854 on Linux 3.8.13-bone47 (armv7l)
  246. flashrom is free software, get the source code at http://www.flashrom.org
  247. Calibrating delay loop... OK.
  248. Found Macronix flash chip &quot;MX25L6405(D)&quot; (8192 kB, SPI) on linux_spi.
  249. Reading old flash chip contents... done.
  250. Erasing and writing flash chip... FAILED at 0x00001000! Expected=0xff, Found=0x00, failed byte count from 0x00000000-0x0000ffff: 0xd716
  251. ERASE FAILED!
  252. Reading current flash chip contents... done. Looking for another erase function.
  253. Erase/write done.
  254. Verifying flash... VERIFIED.
  255. </pre>
  256. <p>
  257. <a href="#pagetop">Back to top of page.</a>
  258. </p>
  259. </div>
  260. <div class="section">
  261. <h1 id="wifi">Wifi</h1>
  262. <p>
  263. The X200 typically comes with an Intel wifi chipset, which does not
  264. work without proprietary software. For a list of wifi chipsets that
  265. work without proprietary software, see
  266. <a href="../hcl/index.html#recommended_wifi">../hcl/index.html#recommended_wifi</a>.
  267. </p>
  268. <p>
  269. Some X200 laptops come with an Atheros chipset, but this is 802.11g only.
  270. </p>
  271. <p>
  272. It is recommended that you install a new wifi chipset. This can only
  273. be done after installing libreboot, because the original firmware has
  274. a whitelist of approved chips, and it will refuse to boot if you
  275. use an 'unauthorized' wifi card.
  276. </p>
  277. <p>
  278. The following photos show an Atheros AR5B95 being installed, to
  279. replace the Intel chip that this X200 came with:<br/>
  280. <img src="images/x200/disassembly/0016.jpg" alt="" />
  281. <img src="images/x200/disassembly/0017.jpg" alt="" />
  282. </p>
  283. </div>
  284. <div class="section">
  285. <h1 id="wwan">WWAN</h1>
  286. <p>
  287. If you have a WWAN/3G card and/or sim card reader, remove them permanently.
  288. The WWAN-3G card has proprietary firmware inside; the technology is
  289. identical to what is used in mobile phones, so it can also track your movements.
  290. </p>
  291. <p>
  292. Not to be confused with wifi (wifi is fine).
  293. </p>
  294. </div>
  295. <div class="section">
  296. <h1 id="memory">Memory</h1>
  297. <p>
  298. You need DDR3 SODIMM PC3-8500 RAM installed, in matching pairs
  299. (speed/size). Non-matching pairs won't work. You can also install a
  300. single module (meaning, one of the slots will be empty) in slot 0.
  301. </p>
  302. <p>
  303. NOTE: according to users repors, non matching pairs (e.g. 1+2 GiB) might work in some cases.
  304. </p>
  305. <p>
  306. Make sure that the RAM you buy is the 2Rx8 density.
  307. </p>
  308. <p>
  309. In this photo, 8GiB of RAM (2x4GiB) is installed:<br/>
  310. <img src="images/x200/disassembly/0018.jpg" alt="" />
  311. </p>
  312. </div>
  313. <div class="section">
  314. <h2 id="boot">
  315. Boot it!
  316. </h2>
  317. <p>
  318. You should see something like this:
  319. </p>
  320. <p>
  321. <img src="images/x200/disassembly/0019.jpg" alt="" />
  322. </p>
  323. <p>
  324. Now <a href="../gnulinux/index.html">install GNU/Linux</a>.
  325. </p>
  326. </div>
  327. <div class="section">
  328. <h2 id="gpio33">
  329. X200S and X200 Tablet users: GPIO33 trick will not work.
  330. </h2>
  331. <p>
  332. sgsit found out about a pin called GPIO33, which can be grounded to disable the flashing protections
  333. by the descriptor and stop the ME from starting (which itself interferes with flashing attempts).
  334. The theory was proven correct; however, it is still useless in practise.
  335. </p>
  336. <p>
  337. Look just above the 7 in TP37 (that's GPIO33):<br/>
  338. <img src="../hcl/images/x200/gpio33_location.jpg" alt="" />
  339. </p>
  340. <p>
  341. By default we would see this in lenovobios, when trying flashrom -p internal -w rom.rom:
  342. </p>
  343. <pre>
  344. FREG0: Warning: Flash Descriptor region (0x00000000-0x00000fff) is read-only.
  345. FREG2: Warning: Management Engine region (0x00001000-0x005f5fff) is locked.
  346. </pre>
  347. <p>
  348. With GPIO33 grounded during boot, this disabled the flash protections as set
  349. by descriptor, and stopped the ME from starting. The output changed to:
  350. </p>
  351. <pre>
  352. The Flash Descriptor Override Strap-Pin is set. Restrictions implied by
  353. the Master Section of the flash descriptor are NOT in effect. Please note
  354. that <b>Protected Range (PR) restrictions still apply.</b>
  355. </pre>
  356. <p>
  357. The part in bold is what got us. This was still observed:
  358. </p>
  359. <pre>
  360. PR0: Warning: 0x007e0000-0x01ffffff is read-only.
  361. PR4: Warning: 0x005f8000-0x005fffff is locked.
  362. </pre>
  363. <p>
  364. It is actually possible to disable these protections. Lenovobios does,
  365. when updating the BIOS (proprietary one). One possible way to go about this
  366. would be to debug the BIOS update utility from Lenovo, to find out
  367. how it's disabling these protections. Some more research is available here:
  368. <a href="http://www.coreboot.org/Board:lenovo/x200/internal_flashing_research">http://www.coreboot.org/Board:lenovo/x200/internal_flashing_research</a>
  369. </p>
  370. <p>
  371. On a related note, libreboot has a utility that could help with investigating this:
  372. <a href="../hcl/gm45_remove_me.html#demefactory">../hcl/gm45_remove_me.html#demefactory</a>
  373. </p>
  374. </div>
  375. <div class="section">
  376. <p>
  377. Copyright &copy; 2014, 2015 Leah Rowe &lt;info@minifree.org&gt;<br/>
  378. Permission is granted to copy, distribute and/or modify this document
  379. under the terms of the GNU Free Documentation License, Version 1.3
  380. or any later version published by the Free Software Foundation;
  381. with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
  382. A copy of the license can be found at <a href="../gfdl-1.3.txt">../gfdl-1.3.txt</a>
  383. </p>
  384. <p>
  385. Updated versions of the license (when available) can be found at
  386. <a href="https://www.gnu.org/licenses/licenses.html">https://www.gnu.org/licenses/licenses.html</a>
  387. </p>
  388. <p>
  389. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
  390. EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
  391. AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
  392. ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
  393. IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
  394. WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
  395. PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
  396. ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
  397. KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
  398. ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
  399. </p>
  400. <p>
  401. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
  402. TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
  403. NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
  404. INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
  405. COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
  406. USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
  407. ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
  408. DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
  409. IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
  410. </p>
  411. <p>
  412. The disclaimer of warranties and limitation of liability provided
  413. above shall be interpreted in a manner that, to the extent
  414. possible, most closely approximates an absolute disclaimer and
  415. waiver of all liability.
  416. </p>
  417. </div>
  418. </body>
  419. </html>