rpi_setup.html 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703
  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>How to program an SPI flash chip with the Raspberry Pi</title>
  10. </head>
  11. <body><div class="section"><p>If you're using libreboot from git, note that only CrOS devices build at the moment. We merged a newly rewritten build system recently, and we've yet to complete re-integration of older boards into Libreboot. Use Libreboot 20160907 for the time being, unless you're involved in libreboot development</p></div>
  12. <div class="section">
  13. <h1 id="pagetop">How to program an SPI flash chip with the Raspberry Pi</h1>
  14. <p>
  15. This document exists as a guide for reading from or writing to an SPI flash chip with the Raspberry Pi,
  16. using the <a href="http://flashrom.org/Flashrom">flashrom</a> software.
  17. Most revisions of the RPi should work.
  18. </p>
  19. <p>
  20. This only covers SOIC-8 flash chips, for now. SOIC-16 guide coming later
  21. (for now, it should be easy enough for you to figure this out for SOIC-16).
  22. </p>
  23. <p>
  24. <a href="../">Back to previous index</a>
  25. </p>
  26. </div>
  27. <div class="section">
  28. <h2>
  29. <a id="user-content-raspberry-pi-thinkpad-x60t60-and-macbook-21" class="anchor" href="#raspberry-pi-thinkpad-x60t60-and-macbook-21" aria-hidden="true"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Raspberry Pi (ThinkPad X60/T60 and Macbook 2,1)</h2>
  30. <p>The Raspberry Pi (a multipurpose $25 GNU+Linux computer) can be used as a BIOS flashing tool, thanks to its GPIO pins and SPI support.</p>
  31. <blockquote>
  32. <p><strong>Note:</strong> The Raspberry Pi Model A is not supported, since it has no GPIO pins.</p>
  33. </blockquote>
  34. <h3>
  35. <a id="user-content-disassembling-the-thinkpad" class="anchor" href="#disassembling-the-thinkpad" aria-hidden="true"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Disassembling the ThinkPad</h3>
  36. <p>Follow the <a href="http://download.lenovo.com/ibmdl/pub/pc/pccbbs/mobiles_pdf/42x3550_04.pdf">X60 Hardware Maintenance Manual</a> or <a href="http://download.lenovo.com/ibmdl/pub/pc/pccbbs/mobiles_pdf/42t7844_04.pdf">T60 Hardware Maintenance Manual</a> to disassemble the laptop, until you can access the BIOS chip.</p>
  37. <p>For photos, follow the <a href="http://libreboot.org/docs/install/t60_unbrick.html">Libreboot T60 Recovery Guide</a>.</p>
  38. <ul>
  39. <li>On the X60, the BIOS chip is on the bottom of the motherboard, under a layer of protective black tape.</li>
  40. <li>On the T60, the BIOS chip is just under the palmrest, but blocked by a magnesium frame (which you will have to remove).</li>
  41. </ul>
  42. <h3>
  43. <a id="user-content-pomona-clip-pinout" class="anchor" href="#pomona-clip-pinout" aria-hidden="true"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Pomona Clip Pinout</h3>
  44. <p>Diagram of the 26 GPIO Pins of the Raspberry Pi Model B (for the Model B+ with 40 pins, start counting from the right and leave 14 pins):</p>
  45. <p><img src="images/rpi/0012.png" alt="" data-canonical-src="http://i.imgur.com/GjuQaJN.png">
  46. <img src="images/rpi/0013.png" alt="" data-canonical-src="http://i.imgur.com/WkNvOUy.png"></p>
  47. <pre><code> 8-pin for X60:
  48. ~~~~ LCD (Front) ~~~~
  49. 8765
  50. ----
  51. | |
  52. ----
  53. 1234
  54. ~~~ Palmrest (back) ~~
  55. </code></pre>
  56. <table>
  57. <thead>
  58. <tr>
  59. <th align="center">Pin #</th>
  60. <th align="center">SPI Pin Name</th>
  61. <th align="center">BP (Seeed)</th>
  62. <th align="center">BP (Spkfun)</th>
  63. <th align="center"><a href="http://beagleboard.org/Support/bone101#headers">Beagleboard Black</a></th>
  64. <th align="center"><a href="images/rpi/0000.jpg">Raspberry Pi</a></th>
  65. </tr>
  66. </thead>
  67. <tbody>
  68. <tr>
  69. <td align="center">1</td>
  70. <td align="center">CS</td>
  71. <td align="center">White</td>
  72. <td align="center">Red</td>
  73. <td align="center">Pin 17</td>
  74. <td align="center">24</td>
  75. </tr>
  76. <tr>
  77. <td align="center">2</td>
  78. <td align="center">MISO</td>
  79. <td align="center">Black</td>
  80. <td align="center">Brown</td>
  81. <td align="center">Pin 21</td>
  82. <td align="center">21</td>
  83. </tr>
  84. <tr>
  85. <td align="center">3</td>
  86. <td align="center"><em>not used</em></td>
  87. <td align="center"><em>not used</em></td>
  88. <td align="center"><em>not used</em></td>
  89. <td align="center"><em>not used</em></td>
  90. <td align="center"><em>not used</em></td>
  91. </tr>
  92. <tr>
  93. <td align="center">4</td>
  94. <td align="center">GND</td>
  95. <td align="center">Brown</td>
  96. <td align="center">Black</td>
  97. <td align="center">Pin 1</td>
  98. <td align="center">25</td>
  99. </tr>
  100. <tr>
  101. <td align="center">5</td>
  102. <td align="center">MOSI</td>
  103. <td align="center">Gray</td>
  104. <td align="center">Orange</td>
  105. <td align="center">Pin 18</td>
  106. <td align="center">19</td>
  107. </tr>
  108. <tr>
  109. <td align="center">6</td>
  110. <td align="center">CLK</td>
  111. <td align="center">Purple</td>
  112. <td align="center">Yellow</td>
  113. <td align="center">Pin 22</td>
  114. <td align="center">23</td>
  115. </tr>
  116. <tr>
  117. <td align="center">7</td>
  118. <td align="center"><em>not used</em></td>
  119. <td align="center"><em>not used</em></td>
  120. <td align="center"><em>not used</em></td>
  121. <td align="center"><em>not used</em></td>
  122. <td align="center"><em>not used</em></td>
  123. </tr>
  124. <tr>
  125. <td align="center">8</td>
  126. <td align="center">3.3V</td>
  127. <td align="center"><em>red</em></td>
  128. <td align="center">White</td>
  129. <td align="center"><a href="http://libreboot.org/docs/install/bbb_setup.html">3.3V PSU RED</a></td>
  130. <td align="center">17</td>
  131. </tr>
  132. </tbody>
  133. </table>
  134. <p>Make sure the pinouts are correct; otherwise, Flashrom will fail to detect a chip, or it will "detect" a <code>0x0</code> chip. Finally, make sure that the Pomona clip makes contact with the metal wires of the chip. It can be a challenge, but keep trying.</p>
  135. <h3>
  136. <a id="user-content-how-to-supply-power-to-the-flashchip" class="anchor" href="#how-to-supply-power-to-the-flashchip" aria-hidden="true"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>How to supply power to the flashchip</h3>
  137. <p>There are two ways to supply power to the chip: plugging in an AC adapter (without turning the laptop on), and using the 8th 3.3v pin.</p>
  138. <p>I have found that the SST chips work best with the 8th pin, while the Macronix chips require an AC Adapter to power up.</p>
  139. <p><strong>Never connect both the 8th pin and the AC adapter at the same time.</strong></p>
  140. <p>Your results may vary.</p>
  141. <h2>
  142. <a id="user-content-reading-the-flashchip" class="anchor" href="#reading-the-flashchip" aria-hidden="true"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Reading the Flashchip</h2>
  143. <p>First, visually inspect (with a magnifying glass) the type of flashchip on the motherboard. </p>
  144. <p>Next, download and compile the latest Flashrom source code on the Raspberry Pi.</p>
  145. <pre><code>sudo apt-get install build-essential pciutils usbutils libpci-dev libusb-dev libftdi1 libftdi-dev zlib1g-dev subversion
  146. svn co svn://flashrom.org/flashrom/trunk flashrom
  147. cd flashrom
  148. make
  149. sudo modprobe spi_bcm2708
  150. sudo modprobe spidev
  151. </code></pre>
  152. <p>If your chip is an SST, run this command:</p>
  153. <pre><code>sudo ./flashrom -p linux_spi:dev=/dev/spidev0.0 -r test.rom
  154. </code></pre>
  155. <p>If your chip is a Macronix, run this command:</p>
  156. <pre><code>sudo ./flashrom -c "MX25L1605" -p linux_spi:dev=/dev/spidev0.0 -r test.rom
  157. </code></pre>
  158. <p>Next, check the md5sum of the dump:</p>
  159. <pre><code>md5sum test.rom
  160. </code></pre>
  161. <p>Run the <code>flashrom</code> command again to make a second dump. Then, check the md5sum of the second dump:</p>
  162. <pre><code>md5sum test.rom
  163. </code></pre>
  164. <p>If the md5sums match after three tries, <code>flashrom</code> has managed to read the flashchip precisely (but not always accurately). You may try and flash Libreboot now.</p>
  165. <h2>
  166. <a id="user-content-flashing-libreboot" class="anchor" href="#flashing-libreboot" aria-hidden="true"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Flashing Libreboot</h2>
  167. <blockquote>
  168. <p><strong>Note:</strong> replace <code>/path/to/libreboot.rom</code> with the location of your chosen ROM, such as <code>../bin/x60/libreboot_usqwerty.rom</code>):</p>
  169. </blockquote>
  170. <p>If your chip is an SST, run this command: </p>
  171. <pre><code>sudo ./flashrom -p linux_spi:dev=/dev/spidev0.0 -w /path/to/libreboot.rom
  172. </code></pre>
  173. <p>If your chip is a Macronix, run this command:</p>
  174. <pre><code>sudo ./flashrom -c "MX25L1605" -p linux_spi:dev=/dev/spidev0.0 -w /path/to/libreboot.rom
  175. </code></pre>
  176. <p>Once that command outputs the following, the flash has completed successfully. If not, just flash again.</p>
  177. <pre><code>Reading old flash chip contents... done.
  178. Erasing and writing flash chip... Erase/write done.
  179. Verifying flash... VERIFIED.
  180. </code></pre>
  181. <h3>
  182. <a id="user-content-sources" class="anchor" href="#sources" aria-hidden="true"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Sources</h3>
  183. <ul>
  184. <li><a href="http://scruss.com/blog/2013/02/02/simple-adc-with-the-raspberry-pi/">Scruss - Simple ADC with the Raspberry Pi</a></li>
  185. <li><a href="https://blogs.fsfe.org/the_unconventional/2015/05/08/flashing-coreboot-on-a-t60-with-a-raspberry-pi/">Flashing coreboot on a T60 with a Raspberry Pi - the_unconventional's blog</a></li>
  186. <li>
  187. <strong>Pomona SOIC Clip flashing</strong>
  188. <ul>
  189. <li><a href="https://wiki.archlinux.org/index.php/Chromebook">Arch Linux Wiki - Installing Arch Linux on Chromebook</a></li>
  190. <li><a href="https://drive.google.com/folderview?id=0B9f62MH0umbmRTA2Xzd5WHhjWEU&amp;usp=sharing">Google Drive - Raspberry Pi SOIC Clip connection</a></li>
  191. <li><a href="http://satxhackers.org/wp/hack-content/uploads/2013/04/rPI_flashrom.pdf">rPI with Flashrom and SOIC Clip Powerpoint</a></li>
  192. </ul>
  193. </li>
  194. </ul>
  195. <h3>
  196. <a id="user-content-raspberry-pi-pinout-diagrams" class="anchor" href="#raspberry-pi-pinout-diagrams" aria-hidden="true"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Raspberry Pi Pinout Diagrams</h3>
  197. <table>
  198. <thead>
  199. <tr>
  200. <th>MCP</th>
  201. <th>3008 Pin</th>
  202. <th>Pi GPIO Pin #</th>
  203. <th>Pi Pin Name</th>
  204. </tr>
  205. </thead>
  206. <tbody>
  207. <tr>
  208. <td>16</td>
  209. <td><code>VDD</code></td>
  210. <td>1</td>
  211. <td><code>3.3 V</code></td>
  212. </tr>
  213. <tr>
  214. <td>15</td>
  215. <td><code>VREF</code></td>
  216. <td>1</td>
  217. <td><code>3.3 V</code></td>
  218. </tr>
  219. <tr>
  220. <td>14</td>
  221. <td><code>AGND</code></td>
  222. <td>6</td>
  223. <td><code>GND</code></td>
  224. </tr>
  225. <tr>
  226. <td>13</td>
  227. <td><code>CLK</code></td>
  228. <td>23</td>
  229. <td><code>GPIO11 SPI0_SCLK</code></td>
  230. </tr>
  231. <tr>
  232. <td>12</td>
  233. <td><code>DOUT</code></td>
  234. <td>21</td>
  235. <td><code>GPIO09 SPI0_MISO</code></td>
  236. </tr>
  237. <tr>
  238. <td>11</td>
  239. <td><code>DIN</code></td>
  240. <td>19</td>
  241. <td><code>GPIO10 SPI0_MOSI</code></td>
  242. </tr>
  243. <tr>
  244. <td>10</td>
  245. <td><code>CS</code></td>
  246. <td>24</td>
  247. <td><code>GPIO08 CE0</code></td>
  248. </tr>
  249. <tr>
  250. <td>9</td>
  251. <td><code>DGND</code></td>
  252. <td>6</td>
  253. <td><code>GND</code></td>
  254. </tr>
  255. </tbody>
  256. </table>
  257. <ul>
  258. <li>Source: <a href="http://raspberrypi.znix.com/hipidocs/topic_gpiopins.htm">Perl &amp; Raspberry Pi - Raspberry Pi GPIO Pinout</a>
  259. </li>
  260. </ul>
  261. <h2>
  262. <a id="user-content-raspberry-pi-thinkpad-x200" class="anchor" href="#raspberry-pi-thinkpad-x200" aria-hidden="true"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Raspberry Pi (ThinkPad X200)</h2>
  263. <h3>
  264. <a id="user-content-requirements" class="anchor" href="#requirements" aria-hidden="true"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Requirements:</h3>
  265. <ul>
  266. <li>An x86, x86_64, or arm7l (for changing the libreboot.rom image mac address)</li>
  267. <li>Raspberry Pi and peripherals</li>
  268. <li>Relevant SOIC clip</li>
  269. <li>6 female - female jumpers</li>
  270. <li>Internet connection</li>
  271. <li>Screw drivers</li>
  272. </ul>
  273. <p>Follow the <a href="http://libreboot.org/docs/install/x200_external.html">ThinkPad X200: Initial installation guide</a> to disassemble the laptop, and access the BIOS rom chip.</p>
  274. <blockquote>
  275. <p><strong>Note:</strong> <code>x86#</code> refers to commands to be run on the x86 computer, and <code>pi#</code> refers to commands to be run on the pi.
  276. A good practice is to make a work directory to keep your libreboot stuff inside.</p>
  277. </blockquote>
  278. <pre><code>x86# mkdir ~/work
  279. </code></pre>
  280. <p>Download NOOBS from <a href="https://www.raspberrypi.org/downloads/">The Raspberry Pi Foundation.</a> Torrent download recommended, and remember to seed. :)</p>
  281. <p>
  282. If you're running Raspian, you can do <strong>sudo raspi-config</strong>, enable SPI under Advanced and then
  283. spidev will be enabled. Simple, eh?
  284. </p>
  285. <p><a href="http://www.libreboot.org/download/">Download Libreboot from their releases page</a>. For your safety, verify the GPG signature as well. </p>
  286. <pre><code>x86# gpg --keyserver prefered.keyserver.org --recv-keys 0x656F212E
  287. x86# for signature in $(ls *.sig); do gpg --verify $signature; done
  288. </code></pre>
  289. <p>Extract NOOBS and libreboot.</p>
  290. <pre><code>x86# mkdir ~/work/noobs
  291. x86# unzip ~/Downloads/NOOBS_v1_4_1.zip -d ~/work/noobs/
  292. x86# cd ~/work &amp;&amp; tar -xvJf ~/Downloads/libreboot_bin.tar.xz
  293. </code></pre>
  294. <p>Install Noobs to your fat32 formatted SD card</p>
  295. <pre><code>x86# cp -R ~/work/noobs/* /path/to/mounted/SDcard/
  296. </code></pre>
  297. <h3>
  298. <a id="user-content-set-up-noobs-on-raspberry-pi" class="anchor" href="#set-up-noobs-on-raspberry-pi" aria-hidden="true"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Set up NOOBS on Raspberry Pi</h3>
  299. <p>Plug in the NOOBs SDCard to your Raspberry Pi, and enable the following under 'Advanced Options':</p>
  300. <p>SSH server</p>
  301. <p>SPI</p>
  302. <p>I2C</p>
  303. <p>On first boot</p>
  304. <pre><code>pi# sudo apt-get update &amp;&amp; sudo apt-get dist-upgrade &amp;&amp; reboot
  305. </code></pre>
  306. <p>On second boot</p>
  307. <pre><code>pi# sudo apt-get update &amp;&amp; sudo apt-get install libftdi1 libftdi-dev libusb-dev libpci-dev subversion
  308. </code></pre>
  309. <p>Other dependencies that should already be installed with the noobs base install include:</p>
  310. <p>pciutils, zlib, libusb, build-essential</p>
  311. <p>If they are missing then install them.</p>
  312. <p>Download and build flashrom.</p>
  313. <pre><code>pi# svn co svn://flashrom.org/flashrom/trunk ~/flashrom
  314. pi# cd ~/flashrom
  315. pi# make
  316. pi# sudo make install
  317. </code></pre>
  318. <p>On your x86 box change the libreboot.rom mac address</p>
  319. <pre><code>x86# cd ~/work/libreboot_bin/
  320. </code></pre>
  321. <p>Change the mac address on the libreboot images to match yours.</p>
  322. <pre><code>x86# ./ich9macchange XX:XX:XX:XX:XX:XX
  323. </code></pre>
  324. <p>Move the libreboot.rom image over to your pi</p>
  325. <pre><code>x86# scp ~/work/libreboot_bin/&lt;path_to_your_bin&gt; pi@your.pi.address:~/flashrom/libreboot.rom
  326. </code></pre>
  327. <p>Shutdown your pi, write down your rom chip model, and wire up the clip</p>
  328. <pre><code>pi# sudo shutdown now -hP
  329. </code></pre>
  330. <p>Chip model name</p>
  331. <p><img src="images/rpi/0001.jpg" alt="" data-canonical-src="http://i.imgur.com/GMbcbqS.jpg"></p>
  332. <p>Pinout. You may want to download the image so you can zoom in on the text.</p>
  333. <p><img src="images/rpi/0002.jpg" alt="" data-canonical-src="http://i.imgur.com/QkoInwr.jpg"></p>
  334. <table>
  335. <thead>
  336. <tr>
  337. <th align="center">Pin #</th>
  338. <th align="center">SPI Pin Name</th>
  339. <th align="center">Raspberry Pi Pin #</th>
  340. </tr>
  341. </thead>
  342. <tbody>
  343. <tr>
  344. <td align="center">1</td>
  345. <td align="center"><em>not used</em></td>
  346. <td align="center"><em>not used</em></td>
  347. </tr>
  348. <tr>
  349. <td align="center">2</td>
  350. <td align="center">3.3V</td>
  351. <td align="center">1</td>
  352. </tr>
  353. <tr>
  354. <td align="center">3</td>
  355. <td align="center"><em>not used</em></td>
  356. <td align="center"><em>not used</em></td>
  357. </tr>
  358. <tr>
  359. <td align="center">4</td>
  360. <td align="center"><em>not used</em></td>
  361. <td align="center"><em>not used</em></td>
  362. </tr>
  363. <tr>
  364. <td align="center">5</td>
  365. <td align="center"><em>not used</em></td>
  366. <td align="center"><em>not used</em></td>
  367. </tr>
  368. <tr>
  369. <td align="center">6</td>
  370. <td align="center"><em>not used</em></td>
  371. <td align="center"><em>not used</em></td>
  372. </tr>
  373. <tr>
  374. <td align="center">7</td>
  375. <td align="center">CS#</td>
  376. <td align="center">24</td>
  377. </tr>
  378. <tr>
  379. <td align="center">8</td>
  380. <td align="center">S0/SIO1</td>
  381. <td align="center">21</td>
  382. </tr>
  383. <tr>
  384. <td align="center">9</td>
  385. <td align="center"><em>not used</em></td>
  386. <td align="center"><em>not used</em></td>
  387. </tr>
  388. <tr>
  389. <td align="center">10</td>
  390. <td align="center">GND</td>
  391. <td align="center">25</td>
  392. </tr>
  393. <tr>
  394. <td align="center">11</td>
  395. <td align="center"><em>not used</em></td>
  396. <td align="center"><em>not used</em></td>
  397. </tr>
  398. <tr>
  399. <td align="center">12</td>
  400. <td align="center"><em>not used</em></td>
  401. <td align="center"><em>not used</em></td>
  402. </tr>
  403. <tr>
  404. <td align="center">13</td>
  405. <td align="center"><em>not used</em></td>
  406. <td align="center"><em>not used</em></td>
  407. </tr>
  408. <tr>
  409. <td align="center">14</td>
  410. <td align="center"><em>not used</em></td>
  411. <td align="center"><em>not used</em></td>
  412. </tr>
  413. <tr>
  414. <td align="center">15</td>
  415. <td align="center">S1/SIO0</td>
  416. <td align="center">19</td>
  417. </tr>
  418. <tr>
  419. <td align="center">16</td>
  420. <td align="center">SCLK</td>
  421. <td align="center">23</td>
  422. </tr>
  423. </tbody>
  424. </table>
  425. <blockquote>
  426. <p><strong>Note:</strong> The raspberry pi 3.3V rail should be sufficient to power the chip during flashing, so no external power supply should be required; however, at the time of writing that has only been tested and confirmed for one chip, the MX25L6405D.</p>
  427. </blockquote>
  428. <p>Macronix Spec sheet so you can adjust your pinout for 8 pin 4Mb chips as necessary</p>
  429. <p><img src="images/rpi/0014.gif" alt="" data-canonical-src="http://i.imgur.com/IQI0Shj.gif"></p>
  430. <p>At this point connect your SOIC clip to the rom chip before powering on your PI.</p>
  431. <p>Power on your Pi, and run the following. Ensure you swap out "your_chip_name" with the proper name/model of your chip. Check that it can be read successfully. If you cannot read the chip and receive an error similar to "no EEPROM Detected" or "0x0 Chip detected" then you may want to try powering off your PI, and switching the two pins which are connected to the IO ports. I.E. Connect pins (clip)8 to (pi)19 and pins (clip)15 to (pi)21</p>
  432. <pre><code>pi# cd ~/flashrom
  433. pi# ./flashrom -p linux_spi:dev=/dev/spidev0.0,spispeed=512 --chip &lt;your_chip_name&gt; -r romread1.rom
  434. pi# ./flashrom -p linux_spi:dev=/dev/spidev0.0,spispeed=512 --chip &lt;your_chip_name&gt; -r romread2.rom
  435. pi# ./flashrom -p linux_spi:dev=/dev/spidev0.0,spispeed=512 --chip &lt;your_chip_name&gt; -r romread3.rom
  436. pi# sha512sum romread*.rom
  437. </code></pre>
  438. <p>If they are identical sha512 hashes then you can generally assume that it's safe to flash your rom.</p>
  439. <pre><code>pi# ./flashrom -p linux_spi:dev=/dev/spidev0.0,spispeed=512 --chip &lt;your_chip_name&gt; -w libreboot.rom
  440. </code></pre>
  441. <p>It may fail a couple times, but keep at it and when you get the message <code>Verifying flash... Verified</code> or <code>Warning: Chip content is identical to the requested image</code> then you're done. </p>
  442. <p>Shut down your pi, put your box back together, and install a libre OS for great good!</p>
  443. <h2>
  444. <a id="user-content-raspberry-pi-c720-chromebook" class="anchor" href="#raspberry-pi-c720-chromebook" aria-hidden="true"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Raspberry Pi (C720 Chromebook)</h2>
  445. <p>The Raspberry Pi (a multipurpose $25 GNU+Linux computer) can be used as a BIOS flashing tool, thanks to its GPIO pins and SPI support.</p>
  446. <h3>
  447. <a id="user-content-what-you-need" class="anchor" href="#what-you-need" aria-hidden="true"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>What you need</h3>
  448. <ul>
  449. <li>$25 - Raspberry Pi Model B (Rev.2 or higher)</li>
  450. <li>$10-20 - SOIC-8 Pomona Clip
  451. <ul>
  452. <li>Usually comes bundled with nice, color-colored <em>female to female</em> wires</li>
  453. </ul>
  454. </li>
  455. </ul>
  456. <h3>
  457. <a id="user-content-raspberry-pi-pinouts" class="anchor" href="#raspberry-pi-pinouts" aria-hidden="true"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Raspberry Pi Pinouts</h3>
  458. <p>GPIO Pinouts:</p>
  459. <p><img src="images/rpi/0009.png" alt="" data-canonical-src="http://i.imgur.com/GjuQaJN.png">
  460. <img src="images/rpi/0010.png" alt="" data-canonical-src="http://i.imgur.com/WkNvOUy.png"></p>
  461. <blockquote>
  462. <p>*Diagram made by <a href="http://www.win-raid.com/t58f16-Guide-Recover-from-failed-BIOS-flash-using-Raspberry-PI.html">"Pacman" from Win-Raid Forums*</a></p>
  463. </blockquote>
  464. <p>SOIC Pinouts:</p>
  465. <p><img src="docs/rpi/0011.png" alt="" data-canonical-src="http://i.imgur.com/2Z9tveR.png"></p>
  466. <h3>
  467. <a id="user-content-plugging-in-the-soic-clip" class="anchor" href="#plugging-in-the-soic-clip" aria-hidden="true"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Plugging in the SOIC Clip</h3>
  468. <p>We have to connect the Raspberry Pi to the SOIC Clip as shown in the below diagram (using the f-f wires usually included with the Pomona clip).</p>
  469. <p><img src="images/rpi/0003.png" alt="SOIC Pinouts for C720 Chromebook" data-canonical-src="http://i.imgur.com/2Z9tveR.png"></p>
  470. <p>(C720 Only?) The diagram depicts a "bridged" connection. You will need to fashion one with some copper wire:</p>
  471. <p><img src="images/rpi/0004.jpg" alt="Bridged wires" data-canonical-src="http://i.imgur.com/iDJQu0x.jpg"></p>
  472. <p>Plug in the wires to the clip as shown below:</p>
  473. <p><img src="images/rpi/0005.jpg" alt="Pomona Clip connections" data-canonical-src="http://i.imgur.com/zQjqQCk.jpg"></p>
  474. <p>Plug in the other end of the wires to the Raspberry Pi as shown below:</p>
  475. <p><img src="images/rpi/0006.jpg" alt="Raspberry Pi connections" data-canonical-src="http://i.imgur.com/c7CcppU.jpg"></p>
  476. <p>(C720 only?) Plug in the "bridged" wires as shown below:</p>
  477. <p><img src="images/rpi/0007.jpg" alt="Bridged wires connected" data-canonical-src="http://i.imgur.com/MCvpyDi.jpg"></p>
  478. <p>Finally, put the Pomona SOIC clip on the chip:</p>
  479. <p><img src="images/rpi/0008.jpg" alt="Pomona Clip Connected" data-canonical-src="http://i.imgur.com/BBZlEgh.jpg"></p>
  480. <h3>
  481. <a id="user-content-flashrom" class="anchor" href="#flashrom" aria-hidden="true"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Flashrom</h3>
  482. <p><a href="http://www.flashrom.org/RaspberryPi">Once it's all set up, flashrom works out of the box.</a></p>
  483. <h3>
  484. <a id="user-content-sources-1" class="anchor" href="#sources-1" aria-hidden="true"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Sources</h3>
  485. <ul>
  486. <li>
  487. <strong>Pomona SOIC Clip flashing</strong>
  488. <ul>
  489. <li><a href="https://wiki.archlinux.org/index.php/Chromebook">Arch Linux Wiki - Installing Arch Linux on Chromebook</a></li>
  490. <li><a href="https://drive.google.com/folderview?id=0B9f62MH0umbmRTA2Xzd5WHhjWEU&amp;usp=sharing">Google Drive - Raspberry Pi SOIC Clip connection</a></li>
  491. <li><a href="http://satxhackers.org/wp/hack-content/uploads/2013/04/rPI_flashrom.pdf">rPI with Flashrom and SOIC Clip Powerpoint</a></li>
  492. <li>
  493. <a href="http://www.tnhh.net/2014/08/25/unbricking-chromebook-with-beaglebone.html">Tnhh - Unbricking Chromebook with Beaglebone</a> </li>
  494. </ul>
  495. </li>
  496. <li>
  497. <strong>Use a DIY DIP System to flash an desoldered BIOS chip</strong>
  498. <ul>
  499. <li><a href="http://diy.viktak.com/2014/07/how-to-recover-laptop-after-failed-bios.html">Viktak - How to recover laptop after failed BIOS flash</a></li>
  500. <li><a href="http://www.win-raid.com/t58f16-Guide-Recover-from-failed-BIOS-flash-using-Raspberry-PI.html">Win-Raid - Recover from Failed BIOS Flashing using Raspberry Pi</a></li>
  501. </ul>
  502. </li>
  503. </ul>
  504. </div>
  505. <div class="section">
  506. <p>
  507. Copyright &copy; 2014, 2015 Lawrence Wu &lt;sagnessagiel@gmail.com&gt;<br/>
  508. Copyright &copy; 2015 snuffeluffegus &lt;&gt;<br/>
  509. Copyright &copy; 2015 Kevin Keijzer &lt;&gt;<br/>
  510. Copyright &copy; 2016 Leah Rowe &lt;info@minifree.org&gt;<br/>
  511. Permission is granted to copy, distribute and/or modify this document
  512. under the terms of the Creative Commons Attribution-ShareAlike 4.0 International license
  513. or any later version published by Creative Commons;
  514. A copy of the license can be found at <a href="../cc-by-sa-4.0.txt">../cc-by-sa-4.0.txt</a>
  515. </p>
  516. <p>
  517. Updated versions of the license (when available) can be found at
  518. <a href="https://creativecommons.org/licenses/by-sa/4.0/legalcode">https://creativecommons.org/licenses/by-sa/4.0/legalcode</a>
  519. </p>
  520. <p>
  521. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
  522. EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
  523. AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
  524. ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
  525. IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
  526. WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
  527. PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
  528. ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
  529. KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
  530. ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
  531. </p>
  532. <p>
  533. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
  534. TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
  535. NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
  536. INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
  537. COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
  538. USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
  539. ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
  540. DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
  541. IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
  542. </p>
  543. <p>
  544. The disclaimer of warranties and limitation of liability provided
  545. above shall be interpreted in a manner that, to the extent
  546. possible, most closely approximates an absolute disclaimer and
  547. waiver of all liability.
  548. </p>
  549. </div>
  550. </body>
  551. </html>