aboutsummaryrefslogtreecommitdiff
path: root/docs/install/rpi_setup.html
blob: 9c0e1c17d00419acd2a5459fc8011a37834437e6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">

	<style type="text/css">
		@import url('../css/main.css');
	</style>

	<title>How to program an SPI flash chip with the Raspberry Pi</title>
</head>

<body>

	<div class="section">
		<h1 id="pagetop">How to program an SPI flash chip with the Raspberry Pi</h1>
			<p>
				This document exists as a guide for reading from or writing to an SPI flash chip with the Raspberry Pi,
				using the <a href="http://flashrom.org/Flashrom">flashrom</a> software.  
                Most revisions of the RPi should work.
			</p>
            <p>
                This only covers SOIC-8 flash chips, for now. SOIC-16 guide coming later
                (for now, it should be easy enough for you to figure this out for SOIC-16).
            </p>
            <p>
                <a href="../">Back to previous index</a>
            </p>
	</div>

    <div class="section">

<h2>
<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>

<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>

<blockquote>
<p><strong>Note:</strong> The Raspberry Pi Model A is not supported, since it has no GPIO pins.</p>
</blockquote>

<h3>
<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>

<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>

<p>For photos, follow the <a href="http://libreboot.org/docs/install/t60_unbrick.html">Libreboot T60 Recovery Guide</a>.</p>

<ul>
<li>On the X60, the BIOS chip is on the bottom of the motherboard, under a layer of protective black tape.</li>
<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>
</ul>

<h3>
<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>

<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>

<p><img src="images/rpi/0012.png" alt="" data-canonical-src="http://i.imgur.com/GjuQaJN.png">
<img src="images/rpi/0013.png" alt="" data-canonical-src="http://i.imgur.com/WkNvOUy.png"></p>

<pre><code> 8-pin for X60:

~~~~ LCD (Front) ~~~~
        8765
        ----
        |  |
        ----
        1234
~~~ Palmrest (back) ~~
</code></pre>

<table>
<thead>
<tr>
<th align="center">Pin #</th>
<th align="center">SPI Pin Name</th>
<th align="center">BP (Seeed)</th>
<th align="center">BP (Spkfun)</th>
<th align="center"><a href="http://beagleboard.org/Support/bone101#headers">Beagleboard Black</a></th>
<th align="center"><a href="images/rpi/0000.jpg">Raspberry Pi</a></th>
</tr>
</thead>
<tbody>
<tr>
<td align="center">1</td>
<td align="center">CS</td>
<td align="center">White</td>
<td align="center">Red</td>
<td align="center">Pin 17</td>
<td align="center">24</td>
</tr>
<tr>
<td align="center">2</td>
<td align="center">MISO</td>
<td align="center">Black</td>
<td align="center">Brown</td>
<td align="center">Pin 21</td>
<td align="center">21</td>
</tr>
<tr>
<td align="center">3</td>
<td align="center"><em>not used</em></td>
<td align="center"><em>not used</em></td>
<td align="center"><em>not used</em></td>
<td align="center"><em>not used</em></td>
<td align="center"><em>not used</em></td>
</tr>
<tr>
<td align="center">4</td>
<td align="center">GND</td>
<td align="center">Brown</td>
<td align="center">Black</td>
<td align="center">Pin 1</td>
<td align="center">25</td>
</tr>
<tr>
<td align="center">5</td>
<td align="center">MOSI</td>
<td align="center">Gray</td>
<td align="center">Orange</td>
<td align="center">Pin 18</td>
<td align="center">19</td>
</tr>
<tr>
<td align="center">6</td>
<td align="center">CLK</td>
<td align="center">Purple</td>
<td align="center">Yellow</td>
<td align="center">Pin 22</td>
<td align="center">23</td>
</tr>
<tr>
<td align="center">7</td>
<td align="center"><em>not used</em></td>
<td align="center"><em>not used</em></td>
<td align="center"><em>not used</em></td>
<td align="center"><em>not used</em></td>
<td align="center"><em>not used</em></td>
</tr>
<tr>
<td align="center">8</td>
<td align="center">3.3V</td>
<td align="center"><em>red</em></td>
<td align="center">White</td>
<td align="center"><a href="http://libreboot.org/docs/install/bbb_setup.html">3.3V PSU RED</a></td>
<td align="center">17</td>
</tr>
</tbody>
</table>

<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>

<h3>
<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>

<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>

<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>

<p><strong>Never connect both the 8th pin and the AC adapter at the same time.</strong></p>

<p>Your results may vary.</p>

<h2>
<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>

<p>First, visually inspect (with a magnifying glass) the type of flashchip on the motherboard. </p>

<p>Next, download and compile the latest Flashrom source code on the Raspberry Pi.</p>

<pre><code>sudo apt-get install build-essential pciutils usbutils libpci-dev libusb-dev libftdi1 libftdi-dev zlib1g-dev subversion
svn co svn://flashrom.org/flashrom/trunk flashrom
cd flashrom
make
sudo modprobe spi_bcm2708
sudo modprobe spidev
</code></pre>

<p>If your chip is an SST, run this command:</p>

<pre><code>sudo ./flashrom -p linux_spi:dev=/dev/spidev0.0 -r test.rom
</code></pre>

<p>If your chip is a Macronix, run this command:</p>

<pre><code>sudo ./flashrom -c "MX25L1605" -p linux_spi:dev=/dev/spidev0.0 -r test.rom
</code></pre>

<p>Next, check the md5sum of the dump:</p>

<pre><code>md5sum test.rom
</code></pre>

<p>Run the <code>flashrom</code> command again to make a second dump. Then, check the md5sum of the second dump:</p>

<pre><code>md5sum test.rom
</code></pre>

<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>

<h2>
<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>

<blockquote>
<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>
</blockquote>

<p>If your chip is an SST, run this command: </p>

<pre><code>sudo ./flashrom -p linux_spi:dev=/dev/spidev0.0 -w /path/to/libreboot.rom
</code></pre>

<p>If your chip is a Macronix, run this command:</p>

<pre><code>sudo ./flashrom -c "MX25L1605" -p linux_spi:dev=/dev/spidev0.0 -w /path/to/libreboot.rom
</code></pre>

<p>Once that command outputs the following, the flash has completed successfully. If not, just flash again.</p>

<pre><code>Reading old flash chip contents... done.
Erasing and writing flash chip... Erase/write done.
Verifying flash... VERIFIED.
</code></pre>

<h3>
<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>

<ul>
<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>
<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>
<li>
<strong>Pomona SOIC Clip flashing</strong>

<ul>
<li><a href="https://wiki.archlinux.org/index.php/Chromebook">Arch Linux Wiki - Installing Arch Linux on Chromebook</a></li>
<li><a href="https://drive.google.com/folderview?id=0B9f62MH0umbmRTA2Xzd5WHhjWEU&amp;usp=sharing">Google Drive - Raspberry Pi SOIC Clip connection</a></li>
<li><a href="http://satxhackers.org/wp/hack-content/uploads/2013/04/rPI_flashrom.pdf">rPI with Flashrom and SOIC Clip Powerpoint</a></li>
</ul>
</li>
</ul>

<h3>
<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>

<table>
<thead>
<tr>
<th>MCP</th>
<th>3008 Pin</th>
<th>Pi GPIO Pin #</th>
<th>Pi Pin Name</th>
</tr>
</thead>
<tbody>
<tr>
<td>16</td>
<td><code>VDD</code></td>
<td>1</td>
<td><code>3.3 V</code></td>
</tr>
<tr>
<td>15</td>
<td><code>VREF</code></td>
<td>1</td>
<td><code>3.3 V</code></td>
</tr>
<tr>
<td>14</td>
<td><code>AGND</code></td>
<td>6</td>
<td><code>GND</code></td>
</tr>
<tr>
<td>13</td>
<td><code>CLK</code></td>
<td>23</td>
<td><code>GPIO11 SPI0_SCLK</code></td>
</tr>
<tr>
<td>12</td>
<td><code>DOUT</code></td>
<td>21</td>
<td><code>GPIO09 SPI0_MISO</code></td>
</tr>
<tr>
<td>11</td>
<td><code>DIN</code></td>
<td>19</td>
<td><code>GPIO10 SPI0_MOSI</code></td>
</tr>
<tr>
<td>10</td>
<td><code>CS</code></td>
<td>24</td>
<td><code>GPIO08 CE0</code></td>
</tr>
<tr>
<td>9</td>
<td><code>DGND</code></td>
<td>6</td>
<td><code>GND</code></td>
</tr>
</tbody>
</table>

<ul>
<li>Source: <a href="http://raspberrypi.znix.com/hipidocs/topic_gpiopins.htm">Perl &amp; Raspberry Pi - Raspberry Pi GPIO Pinout</a>
</li>
</ul>

<h2>
<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>

<h3>
<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>

<ul>
<li>An x86, x86_64, or arm7l (for changing the libreboot.rom image mac address)</li>
<li>Raspberry Pi and peripherals</li>
<li>Relevant SOIC clip</li>
<li>6 female - female jumpers</li>
<li>Internet connection</li>
<li>Screw drivers</li>
</ul>

<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>

<blockquote>
<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.
A good practice is to make a work directory to keep your libreboot stuff inside.</p>
</blockquote>

<pre><code>x86# mkdir ~/work
</code></pre>

<p>Download NOOBS from <a href="https://www.raspberrypi.org/downloads/">The Raspberry Pi Foundation.</a> Torrent download recommended, and remember to seed.  :)</p>

<p>
If you're running Raspian, you can do <strong>sudo raspi-config</strong>, enable SPI under Advanced and then
spidev will be enabled. Simple, eh?
</p>

<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>

<pre><code>x86# gpg --keyserver prefered.keyserver.org --recv-keys 0x656F212E

x86# for signature in $(ls *.sig); do gpg --verify $signature; done
</code></pre>

<p>Extract NOOBS and libreboot.</p>

<pre><code>x86# mkdir ~/work/noobs

x86# unzip ~/Downloads/NOOBS_v1_4_1.zip -d ~/work/noobs/

x86# cd ~/work &amp;&amp; tar -xvJf ~/Downloads/libreboot_bin.tar.xz
</code></pre>

<p>Install Noobs to your fat32 formatted SD card</p>

<pre><code>x86# cp -R ~/work/noobs/* /path/to/mounted/SDcard/
</code></pre>

<h3>
<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>

<p>Plug in the NOOBs SDCard to your Raspberry Pi, and enable the following under 'Advanced Options':</p>

<p>SSH server</p>

<p>SPI</p>

<p>I2C</p>

<p>On first boot</p>

<pre><code>pi# sudo apt-get update &amp;&amp; sudo apt-get dist-upgrade &amp;&amp; reboot
</code></pre>

<p>On second boot</p>

<pre><code>pi# sudo apt-get update &amp;&amp; sudo apt-get install libftdi1 libftdi-dev libusb-dev libpci-dev subversion
</code></pre>

<p>Other dependencies that should already be installed with the noobs base install include:</p>

<p>pciutils, zlib, libusb, build-essential</p>

<p>If they are missing then install them.</p>

<p>Download and build flashrom.</p>

<pre><code>pi# svn co svn://flashrom.org/flashrom/trunk ~/flashrom

pi# cd ~/flashrom

pi# make

pi# sudo make install
</code></pre>

<p>On your x86 box change the libreboot.rom mac address</p>

<pre><code>x86# cd ~/work/libreboot_bin/
</code></pre>

<p>Change the mac address on the libreboot images to match yours.</p>

<pre><code>x86# ./ich9macchange XX:XX:XX:XX:XX:XX
</code></pre>

<p>Move the libreboot.rom image over to your pi</p>

<pre><code>x86# scp ~/work/libreboot_bin/&lt;path_to_your_bin&gt; pi@your.pi.address:~/flashrom/libreboot.rom
</code></pre>

<p>Shutdown your pi, write down your rom chip model, and wire up the clip</p>

<pre><code>pi# sudo shutdown now -hP
</code></pre>

<p>Chip model name</p>

<p><img src="images/rpi/0001.jpg" alt="" data-canonical-src="http://i.imgur.com/GMbcbqS.jpg"></p>

<p>Pinout. You may want to download the image so you can zoom in on the text.</p>

<p><img src="images/rpi/0002.jpg" alt="" data-canonical-src="http://i.imgur.com/QkoInwr.jpg"></p>

<table>
<thead>
<tr>
<th align="center">Pin #</th>
<th align="center">SPI Pin Name</th>
<th align="center">Raspberry Pi Pin #</th>
</tr>
</thead>
<tbody>
<tr>
<td align="center">1</td>
<td align="center"><em>not used</em></td>
<td align="center"><em>not used</em></td>
</tr>
<tr>
<td align="center">2</td>
<td align="center">3.3V</td>
<td align="center">1</td>
</tr>
<tr>
<td align="center">3</td>
<td align="center"><em>not used</em></td>
<td align="center"><em>not used</em></td>
</tr>
<tr>
<td align="center">4</td>
<td align="center"><em>not used</em></td>
<td align="center"><em>not used</em></td>
</tr>
<tr>
<td align="center">5</td>
<td align="center"><em>not used</em></td>
<td align="center"><em>not used</em></td>
</tr>
<tr>
<td align="center">6</td>
<td align="center"><em>not used</em></td>
<td align="center"><em>not used</em></td>
</tr>
<tr>
<td align="center">7</td>
<td align="center">CS#</td>
<td align="center">24</td>
</tr>
<tr>
<td align="center">8</td>
<td align="center">S0/SIO1</td>
<td align="center">21</td>
</tr>
<tr>
<td align="center">9</td>
<td align="center"><em>not used</em></td>
<td align="center"><em>not used</em></td>
</tr>
<tr>
<td align="center">10</td>
<td align="center">GND</td>
<td align="center">25</td>
</tr>
<tr>
<td align="center">11</td>
<td align="center"><em>not used</em></td>
<td align="center"><em>not used</em></td>
</tr>
<tr>
<td align="center">12</td>
<td align="center"><em>not used</em></td>
<td align="center"><em>not used</em></td>
</tr>
<tr>
<td align="center">13</td>
<td align="center"><em>not used</em></td>
<td align="center"><em>not used</em></td>
</tr>
<tr>
<td align="center">14</td>
<td align="center"><em>not used</em></td>
<td align="center"><em>not used</em></td>
</tr>
<tr>
<td align="center">15</td>
<td align="center">S1/SIO0</td>
<td align="center">19</td>
</tr>
<tr>
<td align="center">16</td>
<td align="center">SCLK</td>
<td align="center">23</td>
</tr>
</tbody>
</table>

<blockquote>
<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>
</blockquote>

<p>Macronix Spec sheet so you can adjust your pinout for 8 pin 4Mb chips as necessary</p>

<p><img src="images/rpi/0014.gif" alt="" data-canonical-src="http://i.imgur.com/IQI0Shj.gif"></p>

<p>At this point connect your SOIC clip to the rom chip before powering on your PI.</p>

<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>

<pre><code>pi# cd ~/flashrom

pi# ./flashrom -p linux_spi:dev=/dev/spidev0.0,spispeed=512 --chip &lt;your_chip_name&gt; -r romread1.rom

pi# ./flashrom -p linux_spi:dev=/dev/spidev0.0,spispeed=512 --chip &lt;your_chip_name&gt; -r romread2.rom

pi# ./flashrom -p linux_spi:dev=/dev/spidev0.0,spispeed=512 --chip &lt;your_chip_name&gt; -r romread3.rom

pi# sha512sum romread*.rom
</code></pre>

<p>If they are identical sha512 hashes then you can generally assume that it's safe to flash your rom.</p>

<pre><code>pi# ./flashrom -p linux_spi:dev=/dev/spidev0.0,spispeed=512 --chip &lt;your_chip_name&gt; -w libreboot.rom
</code></pre>

<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>

<p>Shut down your pi, put your box back together, and install a libre OS for great good!</p>

<h2>
<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>

<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>

<h3>
<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>

<ul>
<li>$25 - Raspberry Pi Model B (Rev.2 or higher)</li>
<li>$10-20 - SOIC-8 Pomona Clip 

<ul>
<li>Usually comes bundled with nice, color-colored <em>female to female</em> wires</li>
</ul>
</li>
</ul>

<h3>
<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>

<p>GPIO Pinouts:</p>

<p><img src="images/rpi/0009.png" alt="" data-canonical-src="http://i.imgur.com/GjuQaJN.png">
<img src="images/rpi/0010.png" alt="" data-canonical-src="http://i.imgur.com/WkNvOUy.png"></p>

<blockquote>
<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>
</blockquote>

<p>SOIC Pinouts:</p>

<p><img src="docs/rpi/0011.png" alt="" data-canonical-src="http://i.imgur.com/2Z9tveR.png"></p>

<h3>
<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>

<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>

<p><img src="images/rpi/0003.png" alt="SOIC Pinouts for C720 Chromebook" data-canonical-src="http://i.imgur.com/2Z9tveR.png"></p>

<p>(C720 Only?) The diagram depicts a "bridged" connection. You will need to fashion one with some copper wire:</p>

<p><img src="images/rpi/0004.jpg" alt="Bridged wires" data-canonical-src="http://i.imgur.com/iDJQu0x.jpg"></p>

<p>Plug in the wires to the clip as shown below:</p>

<p><img src="images/rpi/0005.jpg" alt="Pomona Clip connections" data-canonical-src="http://i.imgur.com/zQjqQCk.jpg"></p>

<p>Plug in the other end of the wires to the Raspberry Pi as shown below:</p>

<p><img src="images/rpi/0006.jpg" alt="Raspberry Pi connections" data-canonical-src="http://i.imgur.com/c7CcppU.jpg"></p>

<p>(C720 only?) Plug in the "bridged" wires as shown below:</p>

<p><img src="images/rpi/0007.jpg" alt="Bridged wires connected" data-canonical-src="http://i.imgur.com/MCvpyDi.jpg"></p>

<p>Finally, put the Pomona SOIC clip on the chip:</p>

<p><img src="images/rpi/0008.jpg" alt="Pomona Clip Connected" data-canonical-src="http://i.imgur.com/BBZlEgh.jpg"></p>

<h3>
<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>

<p><a href="http://www.flashrom.org/RaspberryPi">Once it's all set up, flashrom works out of the box.</a></p>

<h3>
<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>

<ul>
<li>
<strong>Pomona SOIC Clip flashing</strong>

<ul>
<li><a href="https://wiki.archlinux.org/index.php/Chromebook">Arch Linux Wiki - Installing Arch Linux on Chromebook</a></li>
<li><a href="https://drive.google.com/folderview?id=0B9f62MH0umbmRTA2Xzd5WHhjWEU&amp;usp=sharing">Google Drive - Raspberry Pi SOIC Clip connection</a></li>
<li><a href="http://satxhackers.org/wp/hack-content/uploads/2013/04/rPI_flashrom.pdf">rPI with Flashrom and SOIC Clip Powerpoint</a></li>
<li>
<a href="http://www.tnhh.net/2014/08/25/unbricking-chromebook-with-beaglebone.html">Tnhh - Unbricking Chromebook with Beaglebone</a> </li>
</ul>
</li>
<li>
<strong>Use a DIY DIP System to flash an desoldered BIOS chip</strong>

<ul>
<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>
<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>
</ul>
</li>
</ul>


			</div>

	<div class="section">

		<p> 
			Copyright &copy; 2014, 2015 Lawrence Wu &lt;sagnessagiel@gmail.com&gt;<br/>
			Copyright &copy; 2015 snuffeluffegus &lt;&gt;<br/>
			Copyright &copy; 2015 Kevin Keijzer &lt;&gt;<br/>
			Copyright &copy; 2016 Leah Rowe &lt;info@minifree.org&gt;<br/>
			Permission is granted to copy, distribute and/or modify this document
			under the terms of the Creative Commons Attribution-ShareAlike 4.0 International license
			or any later version published by Creative Commons;
			
			A copy of the license can be found at <a href="../cc-by-sa-4.0.txt">../cc-by-sa-4.0.txt</a>
		</p>

		<p>
			Updated versions of the license (when available) can be found at
			<a href="https://creativecommons.org/licenses/by-sa/4.0/legalcode">https://creativecommons.org/licenses/by-sa/4.0/legalcode</a>
		</p>

		<p>
			UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
			EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
			AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
			ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
			IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
			WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
			PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
			ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
			KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
			ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
		</p>
		<p>
			TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
			TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
			NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
			INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
			COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
			USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
			ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
			DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
			IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
		</p>
		<p>
			The disclaimer of warranties and limitation of liability provided
			above shall be interpreted in a manner that, to the extent
			possible, most closely approximates an absolute disclaimer and
			waiver of all liability.
		</p>
		
	</div>

</body>
</html>