aboutsummaryrefslogtreecommitdiff
path: root/en/source/running.html
blob: b1b8670eb7ee04b238663b376d7709c6428f7f8f (plain)
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
<html devsite>
  <head>
    <title>Running Builds</title>
    <meta name="project_path" value="/_project.yaml" />
    <meta name="book_path" value="/_book.yaml" />
  </head>
  <body>
  <!--
      Copyright 2017 The Android Open Source Project

      Licensed under the Apache License, Version 2.0 (the "License");
      you may not use this file except in compliance with the License.
      You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

      Unless required by applicable law or agreed to in writing, software
      distributed under the License is distributed on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      See the License for the specific language governing permissions and
      limitations under the License.
  -->



<p>This page provides details for running builds on specific devices and is
designed to complement the information in
<a href="/source/building.html">Building the System</a>.</p>

<h2 id="building-fastboot-and-adb">Building fastboot and adb</h2>
<p>If you don't already have fastboot and adb, you can build them with the
regular build system. Use the instructions in
<a href="/source/building.html">Building a System</a> and replace the
main <code>make</code> command with:</p>
<pre><code>$ make fastboot adb
</code></pre>

<h2 id="booting-into-fastboot-mode">Booting into fastboot mode</h2>
<p><em>Fastboot</em> is a bootloader mode in which you can flash a device.
During a cold boot of a device, use the following key combinations to boot into
fastboot mode:</p>
<table>
<thead>
<tr>
<th>Codename</th>
<th>Device</th>
<th>Keys</th>
</tr>
</thead>
<tbody>
<tr>
<td>marlin</td><td>Pixel XL</td>
<td>Press and hold <em>Volume Down</em>, then press and hold <em>Power</em></td>
</tr>
<tr>
<td>sailfish</td>
<td>Pixel</td>
<td>Press and hold <em>Volume Down</em>, then press and hold <em>Power</em></td>
</tr>
<tr>
<td>hikey</td>
<td>hikey</td>
<td>Link pins 1 - 2 and 5 - 6 of J15</td>
</tr>
<tr>
<td>angler</td>
<td>Nexus 6P</td>
<td>Press and hold <em>Volume Down</em>, then press and hold <em>Power</em></td>
</tr>
<tr>
<td>bullhead</td>
<td>Nexus 5X</td>
<td>Press and hold <em>Volume Down</em>, then press and hold <em>Power</em></td>
</tr>
<tr>
<td>shamu</td>
<td>Nexus 6</td>
<td>Press and hold <em>Volume Down</em>, then press and hold <em>Power</em></td>
</tr>
<tr>
<td>fugu</td>
<td>Nexus Player</td>
<td>Press and hold <em>Power</em></td>
</tr>
<tr>
<td>volantis</td>
<td>Nexus 9</td>
<td>Press and hold <em>Volume Down</em>, then press and hold <em>Power</em></td>
</tr>
<tr>
<td>hammerhead</td>
<td>Nexus 5</td>
<td>Press and hold both <em>Volume Up</em> and <em>Volume Down</em>, then press
and hold <em>Power</em></td>
</tr>
<tr>
<td>flo</td>
<td>Nexus 7</td>
<td>Press and hold <em>Volume Down</em>, then press and hold <em>Power</em></td>
</tr>
<tr>
<td>deb</td>
<td>Nexus 7 3G</td>
<td>Press and hold <em>Volume Down</em>, then press and hold <em>Power</em></td>
</tr>
<tr>
<td>manta</td>
<td>Nexus 10</td>
<td>Press and hold both <em>Volume Up</em> and <em>Volume Down</em>, then press
and hold <em>Power</em></td>
</tr>
<tr>
<td>mako</td>
<td>Nexus 4</td>
<td>Press and hold <em>Volume Down</em>, then press and hold <em>Power</em></td>
</tr>
<tr>
<td>grouper</td>
<td>Nexus 7 (2012)</td>
<td>Press and hold <em>Volume Down</em>, then press and hold <em>Power</em></td>
</tr>
<tr>
<td>tilapia</td>
<td>Nexus 7 3G (2012)</td>
<td>Press and hold <em>Volume Down</em>, then press and hold <em>Power</em></td>
</tr>
<tr>
<td>phantasm</td>
<td>Nexus Q</td>
<td>Power the device, cover it with one hand after the LEDs light up and until
they turn red</td>
</tr>
<tr>
<td>maguro</td>
<td>Galaxy Nexus GSM</td>
<td>Press and hold both <em>Volume Up</em> and <em>Volume Down</em>, then press
and hold <em>Power</em></td>
</tr>
<tr>
<td>toro</td>
<td>Galaxy Nexus (Verizon)</td>
<td>Press and hold both <em>Volume Up</em> and <em>Volume Down</em>, then press
and hold <em>Power</em></td>
</tr>
<tr>
<td>toroplus</td>
<td>Galaxy Nexus (Sprint)</td>
<td>Press and hold both <em>Volume Up</em> and <em>Volume Down</em>, then press
and hold <em>Power</em></td>
</tr>
<tr>
<td>wingray</td>
<td>Motorola Xoom</td>
<td>Press and hold <em>Volume Down</em>, then press and hold <em>Power</em></td>
</tr>
<tr>
<td>crespo</td>
<td>Nexus S</td>
<td>Press and hold <em>Volume Up</em>, then press and hold <em>Power</em></td>
</tr>
<tr>
<td>crespo4g</td>
<td>Nexus SG</td>
<td>Press and hold <em>Volume Up</em>, then press and hold <em>Power</em></td>
</tr>
</tbody>
</table>
<p>You can also use the command <code>adb reboot bootloader</code> to reboot
from Android directly into the bootloader with no key combinations.</p>

<h2 id="unlocking-the-bootloader">Unlocking the bootloader</h2>

<p>You can flash a custom system only if the bootloader allows it, and the
bootloader is locked by default. You can unlock the bootloader, but doing so
deletes user data for privacy reasons. After unlocking, <em>all</em> data on the
device is erased, i.e. both application private data and shared data accessible
over USB (including photos and movies). Before attempting to unlock the
bootloader, be sure to back up any important files on the device.</p>

<p>You need to unlock the bootloader only once, and you can re-lock it if
necessary.</p>

<h3>Unlocking recent devices</h3>
<p>All Nexus and Pixel devices released since 2014 (starting with Nexus 6 and
Nexus 9) have factory reset protection and require a multi-step process to
unlock the bootloader.</p>

<ol>
<li>Enable OEM unlocking on the device:
<ol style="list-style-type:lower-alpha">
<li>In Settings, tap <strong>About phone</strong>, then tap <strong>Build
number</strong> seven (7) times.</li>
<li>When you see the message "You are a developer", tap the back button.</li>
<li>Tap <strong>Developer options</strong> and enable
<strong>OEM unlocking</strong> and <strong>USB debugging</strong>.
(If OEM unlocking is disabled, connect to the Internet so the device can check
in at least once. If it remains disabled, your device may be SIM locked by your
carrier and the bootloader cannot be unlocked.)</li></ol></li>
<li>Reboot into the bootloader and use fastboot to unlock it.
<ul>
<li>For new devices (2015 and later): <code>$ fastboot flashing unlock</code>
</li>
<li>For older devices (2014 and earlier): <code>$ fastboot oem
unlock</code></li></ul>
You must confirm the unlock onscreen.</li></ol>

<p class="note"><strong>Note</strong> On Nexus 10, after unlocking the
bootloader, the internal storage remains unformatted. You can format the device
using <code>fastboot format cache</code> followed by <code>fastboot format userdata</code></p>

<h3 id="relocking-the-bootloader">Re-locking the bootloader</h3>
<p>To re-lock the bootloader:</p>
<ul>
<li>For new devices (2015 and later): <code>$ fastboot flashing lock</code></li>
<li>For older devices (2014 and earlier): <code>$ fastboot oem lock</code></li>
</ul>

<p class="note"><strong>Note</strong>: Re-locking the bootloading on a Motorola
Xoom erases user data (including the shared USB data).</p>

<h2 id="flash-unlock">Using Flash Unlock</h2>

<p>Android 7.0 includes a new system API, <code>getFlashLockState()</code>, to
transmit bootloader state, as well as the following system API that returns the
bootloader’s lock status on compliant devices:</p>

<pre>
PersistentDataBlockManager.getFlashLockState()
</pre>

<table>
<tr>
<th>Return value</th>
<th>Conditions</th>
</tr>
<tr>
<td><code>FLASH_LOCK_UNKNOWN</code>
</td>
<td><p>Returned only by devices upgrading to Android 7.0 that have not supported
bootloader changes required to get the flash lock status if they support
flashing lock/unlock capability.</p>
<p>New Android 7.0 devices must be in either <code>FLASH_LOCK_LOCKED</code> or
<code>FLASH_LOCK_UNLOCKED</code> state. If a device is upgrading to Android 7.0
and does not support flashing unlock/lock capability, it should simply return
<code>FLASH_LOCK_LOCKED</code> state.</p>
</td>
</tr>
<tr>
<td><code>FLASH_LOCK_LOCKED</code>
</td>
<td>Should be returned by any device that does not support flashing
lock/unlock (i.e. the device is always locked), or any device that does support
flashing lock/unlock and is in the locked state.
</td>
</tr>
<tr>
<td><code>FLASH_LOCK_UNLOCKED</code>
</td>
<td>Returned by any device that supports flashing lock/unlock and is
currently in the unlocked state.
</td>
</tr>
</table>

<h3 id="examples-and-source">Examples and source</h3>

<p>AOSP contains a reference implementation that returns a value based on the
<code>ro.boot.flash.locked</code> boot property. The code lives in the following
directories:</p>

<pre>
frameworks/base/services/core/java/com/android/server/PersistentDataBlockService.java
frameworks/base/core/java/android/service/persistentdata/PersistentDataBlockManager.java
</pre>

<h3 id="validation">Validation</h3>
<p>Manufacturers should test the values returned by devices with locked and
unlocked bootloaders.</p>

<h2 id="selecting-device-build">Selecting a device build</h2>

<p>The recommended builds for devices are available from the lunch menu,
accessed when running the <code>lunch</code> command with no arguments. You can
download factory images and binaries for Nexus devices from
developers.google.com:</p>

<ul>
<li><a href="https://developers.google.com/android/nexus/blobs-preview">Preview
binaries (blobs)</a></li>
<li><a href="https://developers.google.com/android/nexus/images">Factory images
for released devices</a></li>
<li><a href="https://developers.google.com/android/nexus/drivers">Support
binaries (drivers) for release devices</a></li>
</ul>

<p>For details and additional resources, see
<a href="building.html#obtaining-proprietary-binaries">Obtaining proprietary
binaries</a> and <a href="requirements.html#binaries">Device binaries
requirements</a>.</p>

<table>
<thead>
<tr>
<th>Device</th>
<th>Code name</th>
<th>Build configuration</th>
</tr>
</thead>
<tbody>
<tr>
<td>Pixel XL</td>
<td>marlin</td>
<td>aosp_marlin-userdebug</td>
</tr>
<tr>
<td>Pixel</td>
<td>sailfish</td>
<td>aosp_sailfish-userdebug</td>
</tr>
<tr>
<td>HiKey</td>
<td>hikey</td>
<td>hikey-userdebug</td>
</tr>
<tr>
<td>Nexus 6P</td>
<td>angler</td>
<td>aosp_angler-userdebug</td>
</tr>
<tr>
<td>Nexus 5X</td>
<td>bullhead</td>
<td>aosp_bullhead-userdebug</td>
</tr>
<tr>
<td>Nexus 6</td>
<td>shamu</td>
<td>aosp_shamu-userdebug</td>
</tr>
<tr>
<td>Nexus Player</td>
<td>fugu</td>
<td>aosp_fugu-userdebug</td>
</tr>
<tr>
<td>Nexus 9</td>
<td>volantis (flounder)</td>
<td>aosp_flounder-userdebug</td>
</tr>
<tr>
<td>Nexus 5 (GSM/LTE)</td>
<td>hammerhead</td>
<td>aosp_hammerhead-userdebug</td>
</tr>
<tr>
<td>Nexus 7 (Wi-Fi)</td>
<td>razor (flo)</td>
<td>aosp_flo-userdebug</td>
</tr>
<tr>
<td>Nexus 7 (Mobile)</td>
<td>razorg (deb)</td>
<td>aosp_deb-userdebug</td>
</tr>
<tr>
<td>Nexus 10</td>
<td>mantaray (manta)</td>
<td>full_manta-userdebug</td>
</tr>
<tr>
<td>Nexus 4</td>
<td>occam (mako)</td>
<td>full_mako-userdebug</td>
</tr>
<tr>
<td>Nexus 7 (Wi-Fi)</td>
<td>nakasi (grouper)</td>
<td>full_grouper-userdebug</td>
</tr>
<tr>
<td>Nexus 7 (Mobile)</td>
<td>nakasig (tilapia)</td>
<td>full_tilapia-userdebug</td>
</tr>
<tr>
<td>Galaxy Nexus (GSM/HSPA+)</td>
<td>yakju (maguro)</td>
<td>full_maguro-userdebug</td>
</tr>
<tr>
<td>Galaxy Nexus (Verizon)</td>
<td>mysid (toro)</td>
<td>aosp_toro-userdebug</td>
</tr>
<tr>
<td>Galaxy Nexus (Experimental)</td>
<td>mysidspr (toroplus)</td>
<td>aosp_toroplus-userdebug</td>
</tr>
<tr>
<td>Motorola Xoom (U.S. Wi-Fi)</td>
<td>wingray</td>
<td>full_wingray-userdebug</td>
</tr>
<tr>
<td>Nexus S</td>
<td>soju (crespo)</td>
<td>full_crespo-userdebug</td>
</tr>
<tr>
<td>Nexus S 4G</td>
<td>sojus (crespo4g)</td>
<td>full_crespo4g-userdebug</td>
</tr>
</tbody>
</table>

<p class="note"><b>Note</b>: Do not use Android 4.1.1 on a Nexus 7 originally
sold with Android 4.1.2 or newer.</p>

<h2 id="flashing-a-device">Flashing a device</h2>

<p>You can flash an entire Android system in a single command; doing so verifies
the system being flashed is compatible with the installed bootloader and radio,
writes the boot, recovery, and system partitions together, then reboots the
system. Flashing also erases all user data, similarly to <code>fastboot oem
unlock</code>.</p>

<p>Place the device in fastboot mode either manually by holding the appropriate
key combination at boot, or from the shell with:</p>

<pre>
$ adb reboot bootloader
</pre>

<p>After the device is in fastboot mode, run:</p>

<pre>
$ fastboot flashall -w
</pre>

<p>The <code>-w</code> option wipes the <code>/data</code> partition on the
device; this is useful for your first time flashing a particular device but is
otherwise unnecessary.</p>

<p class="note"><strong>Note</strong>: Filesystems created via fastboot on
Motorola Xoom do not function optimally. We recommend re-creating filesystems
through recovery, using: <code>$ adb reboot recovery</code>. While in recovery,
open the menu (press Power + Volume Up), wipe the cache partition, then wipe
data.</p>


<h2 id="restoring-devices-to-factory-state">Restoring devices to factory
state</h2>

<p>Factory images for Nexus 5, Nexus 10, Nexus 4, Nexus Q, Nexus 7, Galaxy Nexus
(GSM/HSPA+ "yakju" and "takju", and CDMA/LTE "mysid" and "mysidspr"), Nexus S,
and Nexus S 4G are available from
<a href="https://developers.google.com/android/nexus/images">Google's factory
image</a> page.</p>

<p>Factory images for the Motorola Xoom are distributed directly by Motorola.</p>

  </body>
</html>