Home | History | Annotate | Download | only in source
      1 <html devsite>
      2   <head>
      3     <title>Running Builds</title>
      4     <meta name="project_path" value="/_project.yaml" />
      5     <meta name="book_path" value="/_book.yaml" />
      6   </head>
      7   <body>
      8   <!--
      9       Copyright 2017 The Android Open Source Project
     10 
     11       Licensed under the Apache License, Version 2.0 (the "License");
     12       you may not use this file except in compliance with the License.
     13       You may obtain a copy of the License at
     14 
     15           http://www.apache.org/licenses/LICENSE-2.0
     16 
     17       Unless required by applicable law or agreed to in writing, software
     18       distributed under the License is distributed on an "AS IS" BASIS,
     19       WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     20       See the License for the specific language governing permissions and
     21       limitations under the License.
     22   -->
     23 
     24 
     25 
     26 <p>This page provides details for running builds on specific devices and is
     27 designed to complement the information in
     28 <a href="/source/building.html">Building the System</a>.</p>
     29 
     30 <h2 id="building-fastboot-and-adb">Building fastboot and adb</h2>
     31 <p>If you don't already have fastboot and adb, you can build them with the
     32 regular build system. Use the instructions in
     33 <a href="/source/building.html">Building a System</a> and replace the
     34 main <code>make</code> command with:</p>
     35 <pre class="devsite-terminal devsite-click-to-copy">
     36 make fastboot adb
     37 </pre>
     38 
     39 <h2 id="booting-into-fastboot-mode">Booting into fastboot mode</h2>
     40 <p><em>Fastboot</em> is a bootloader mode in which you can flash a device.
     41 During a cold boot of a device, use the following key combinations to boot into
     42 fastboot mode:</p>
     43 <table>
     44 <thead>
     45 <tr>
     46 <th>Codename</th>
     47 <th>Device</th>
     48 <th>Keys</th>
     49 </tr>
     50 </thead>
     51 <tbody>
     52 <tr>
     53 <td>marlin</td><td>Pixel XL</td>
     54 <td>Press and hold <em>Volume Down</em>, then press and hold <em>Power</em></td>
     55 </tr>
     56 <tr>
     57 <td>sailfish</td>
     58 <td>Pixel</td>
     59 <td>Press and hold <em>Volume Down</em>, then press and hold <em>Power</em></td>
     60 </tr>
     61 <tr>
     62 <td>hikey</td>
     63 <td>hikey</td>
     64 <td>Link pins 1 - 2 and 5 - 6 of J15</td>
     65 </tr>
     66 <tr>
     67 <td>angler</td>
     68 <td>Nexus 6P</td>
     69 <td>Press and hold <em>Volume Down</em>, then press and hold <em>Power</em></td>
     70 </tr>
     71 <tr>
     72 <td>bullhead</td>
     73 <td>Nexus 5X</td>
     74 <td>Press and hold <em>Volume Down</em>, then press and hold <em>Power</em></td>
     75 </tr>
     76 <tr>
     77 <td>shamu</td>
     78 <td>Nexus 6</td>
     79 <td>Press and hold <em>Volume Down</em>, then press and hold <em>Power</em></td>
     80 </tr>
     81 <tr>
     82 <td>fugu</td>
     83 <td>Nexus Player</td>
     84 <td>Press and hold <em>Power</em></td>
     85 </tr>
     86 <tr>
     87 <td>volantis</td>
     88 <td>Nexus 9</td>
     89 <td>Press and hold <em>Volume Down</em>, then press and hold <em>Power</em></td>
     90 </tr>
     91 <tr>
     92 <td>hammerhead</td>
     93 <td>Nexus 5</td>
     94 <td>Press and hold both <em>Volume Up</em> and <em>Volume Down</em>, then press
     95 and hold <em>Power</em></td>
     96 </tr>
     97 <tr>
     98 <td>flo</td>
     99 <td>Nexus 7</td>
    100 <td>Press and hold <em>Volume Down</em>, then press and hold <em>Power</em></td>
    101 </tr>
    102 <tr>
    103 <td>deb</td>
    104 <td>Nexus 7 3G</td>
    105 <td>Press and hold <em>Volume Down</em>, then press and hold <em>Power</em></td>
    106 </tr>
    107 <tr>
    108 <td>manta</td>
    109 <td>Nexus 10</td>
    110 <td>Press and hold both <em>Volume Up</em> and <em>Volume Down</em>, then press
    111 and hold <em>Power</em></td>
    112 </tr>
    113 <tr>
    114 <td>mako</td>
    115 <td>Nexus 4</td>
    116 <td>Press and hold <em>Volume Down</em>, then press and hold <em>Power</em></td>
    117 </tr>
    118 <tr>
    119 <td>grouper</td>
    120 <td>Nexus 7 (2012)</td>
    121 <td>Press and hold <em>Volume Down</em>, then press and hold <em>Power</em></td>
    122 </tr>
    123 <tr>
    124 <td>tilapia</td>
    125 <td>Nexus 7 3G (2012)</td>
    126 <td>Press and hold <em>Volume Down</em>, then press and hold <em>Power</em></td>
    127 </tr>
    128 <tr>
    129 <td>phantasm</td>
    130 <td>Nexus Q</td>
    131 <td>Power the device, cover it with one hand after the LEDs light up and until
    132 they turn red</td>
    133 </tr>
    134 <tr>
    135 <td>maguro</td>
    136 <td>Galaxy Nexus GSM</td>
    137 <td>Press and hold both <em>Volume Up</em> and <em>Volume Down</em>, then press
    138 and hold <em>Power</em></td>
    139 </tr>
    140 <tr>
    141 <td>toro</td>
    142 <td>Galaxy Nexus (Verizon)</td>
    143 <td>Press and hold both <em>Volume Up</em> and <em>Volume Down</em>, then press
    144 and hold <em>Power</em></td>
    145 </tr>
    146 <tr>
    147 <td>toroplus</td>
    148 <td>Galaxy Nexus (Sprint)</td>
    149 <td>Press and hold both <em>Volume Up</em> and <em>Volume Down</em>, then press
    150 and hold <em>Power</em></td>
    151 </tr>
    152 <tr>
    153 <td>wingray</td>
    154 <td>Motorola Xoom</td>
    155 <td>Press and hold <em>Volume Down</em>, then press and hold <em>Power</em></td>
    156 </tr>
    157 <tr>
    158 <td>crespo</td>
    159 <td>Nexus S</td>
    160 <td>Press and hold <em>Volume Up</em>, then press and hold <em>Power</em></td>
    161 </tr>
    162 <tr>
    163 <td>crespo4g</td>
    164 <td>Nexus SG</td>
    165 <td>Press and hold <em>Volume Up</em>, then press and hold <em>Power</em></td>
    166 </tr>
    167 </tbody>
    168 </table>
    169 <p>You can also use the command <code>adb reboot bootloader</code> to reboot
    170 from Android directly into the bootloader with no key combinations.</p>
    171 
    172 <h2 id="unlocking-the-bootloader">Unlocking the bootloader</h2>
    173 
    174 <p>You can flash a custom system only if the bootloader allows it, and the
    175 bootloader is locked by default. You can unlock the bootloader, but doing so
    176 deletes user data for privacy reasons. After unlocking, <em>all</em> data on the
    177 device is erased, i.e. both application private data and shared data accessible
    178 over USB (including photos and movies). Before attempting to unlock the
    179 bootloader, be sure to back up any important files on the device.</p>
    180 
    181 <p>You need to unlock the bootloader only once, and you can re-lock it if
    182 necessary.</p>
    183 
    184 <h3>Unlocking recent devices</h3>
    185 <p>All Nexus and Pixel devices released since 2014 (starting with Nexus 6 and
    186 Nexus 9) have factory reset protection and require a multi-step process to
    187 unlock the bootloader.</p>
    188 
    189 <ol>
    190   <li>Enable OEM unlocking on the device:
    191     <ol style="list-style-type:lower-alpha">
    192       <li>In Settings, tap <strong>About phone</strong>, then tap <strong>Build number</strong> seven (7) times.</li>
    193       <li>When you see the message "You are a developer", tap the back button.</li>
    194       <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>
    195     </ol>
    196   </li>
    197   <li>Reboot into the bootloader and use fastboot to unlock it.
    198     <ul>
    199       <li>For new devices (2015 and later):
    200 <pre class="devsite-terminal devsite-click-to-copy">
    201 fastboot flashing unlock
    202 </pre>
    203       </li>
    204       <li>For older devices (2014 and earlier):
    205 <pre class="devsite-terminal devsite-click-to-copy">
    206 fastboot oem unlock
    207 </pre>
    208       </li>
    209     </ul>
    210     You must confirm the unlock onscreen.
    211   </li>
    212 </ol>
    213 
    214 <p class="note"><strong>Note:</strong> On Nexus 10, after unlocking the
    215 bootloader, the internal storage remains unformatted. You can format the device
    216 using <code>fastboot format cache</code> followed by <code>fastboot format userdata</code></p>
    217 
    218 <h3 id="relocking-the-bootloader">Re-locking the bootloader</h3>
    219 <p>To re-lock the bootloader:</p>
    220 <ul>
    221   <li>For new devices (2015 and later):
    222 <pre class="devsite-terminal devsite-click-to-copy">
    223 fastboot flashing lock
    224 </pre>
    225   </li>
    226   <li>For older devices (2014 and earlier):
    227 <pre class="devsite-terminal devsite-click-to-copy">
    228 fastboot oem lock
    229 </pre>
    230   </li>
    231 </ul>
    232 
    233 <p class="note"><strong>Note</strong>: Re-locking the bootloading on a Motorola
    234 Xoom erases user data (including the shared USB data).</p>
    235 
    236 <h2 id="flash-unlock">Using Flash Unlock</h2>
    237 
    238 <p>Android 7.0 includes a new system API, <code>getFlashLockState()</code>, to
    239 transmit bootloader state, as well as the following system API that returns the
    240 bootloaders lock status on compliant devices:</p>
    241 
    242 <pre>
    243 PersistentDataBlockManager.getFlashLockState()
    244 </pre>
    245 
    246 <table>
    247 <tr>
    248 <th>Return value</th>
    249 <th>Conditions</th>
    250 </tr>
    251 <tr>
    252 <td><code>FLASH_LOCK_UNKNOWN</code>
    253 </td>
    254 <td><p>Returned only by devices upgrading to Android 7.0 that have not supported
    255 bootloader changes required to get the flash lock status if they support
    256 flashing lock/unlock capability.</p>
    257 <p>New Android 7.0 devices must be in either <code>FLASH_LOCK_LOCKED</code> or
    258 <code>FLASH_LOCK_UNLOCKED</code> state. If a device is upgrading to Android 7.0
    259 and does not support flashing unlock/lock capability, it should simply return
    260 <code>FLASH_LOCK_LOCKED</code> state.</p>
    261 </td>
    262 </tr>
    263 <tr>
    264 <td><code>FLASH_LOCK_LOCKED</code>
    265 </td>
    266 <td>Should be returned by any device that does not support flashing
    267 lock/unlock (i.e. the device is always locked), or any device that does support
    268 flashing lock/unlock and is in the locked state.
    269 </td>
    270 </tr>
    271 <tr>
    272 <td><code>FLASH_LOCK_UNLOCKED</code>
    273 </td>
    274 <td>Returned by any device that supports flashing lock/unlock and is
    275 currently in the unlocked state.
    276 </td>
    277 </tr>
    278 </table>
    279 
    280 <h3 id="examples-and-source">Examples and source</h3>
    281 
    282 <p>AOSP contains a reference implementation that returns a value based on the
    283 <code>ro.boot.flash.locked</code> boot property. The code lives in the following
    284 directories:</p>
    285 
    286 <pre>
    287 frameworks/base/services/core/java/com/android/server/PersistentDataBlockService.java
    288 frameworks/base/core/java/android/service/persistentdata/PersistentDataBlockManager.java
    289 </pre>
    290 
    291 <h3 id="validation">Validation</h3>
    292 <p>Manufacturers should test the values returned by devices with locked and
    293 unlocked bootloaders.</p>
    294 
    295 <h2 id="selecting-device-build">Selecting a device build</h2>
    296 
    297 <p>The recommended builds for devices are available from the lunch menu,
    298 accessed when running the <code>lunch</code> command with no arguments. You can
    299 download factory images and binaries for Nexus devices from
    300 developers.google.com:</p>
    301 
    302 <ul>
    303 <li><a href="https://developers.google.com/android/nexus/blobs-preview">Preview
    304 binaries (blobs)</a></li>
    305 <li><a href="https://developers.google.com/android/nexus/images">Factory images
    306 for released devices</a></li>
    307 <li><a href="https://developers.google.com/android/nexus/drivers">Support
    308 binaries (drivers) for release devices</a></li>
    309 </ul>
    310 
    311 <p>For details and additional resources, see
    312 <a href="building.html#obtaining-proprietary-binaries">Obtaining proprietary
    313 binaries</a> and <a href="requirements.html#binaries">Device binaries
    314 requirements</a>.</p>
    315 
    316 <table>
    317 <thead>
    318 <tr>
    319 <th>Device</th>
    320 <th>Code name</th>
    321 <th>Build configuration</th>
    322 </tr>
    323 </thead>
    324 <tbody>
    325 <tr>
    326 <td>Pixel XL</td>
    327 <td>marlin</td>
    328 <td>aosp_marlin-userdebug</td>
    329 </tr>
    330 <tr>
    331 <td>Pixel</td>
    332 <td>sailfish</td>
    333 <td>aosp_sailfish-userdebug</td>
    334 </tr>
    335 <tr>
    336 <td>HiKey</td>
    337 <td>hikey</td>
    338 <td>hikey-userdebug</td>
    339 </tr>
    340 <tr>
    341 <td>Nexus 6P</td>
    342 <td>angler</td>
    343 <td>aosp_angler-userdebug</td>
    344 </tr>
    345 <tr>
    346 <td>Nexus 5X</td>
    347 <td>bullhead</td>
    348 <td>aosp_bullhead-userdebug</td>
    349 </tr>
    350 <tr>
    351 <td>Nexus 6</td>
    352 <td>shamu</td>
    353 <td>aosp_shamu-userdebug</td>
    354 </tr>
    355 <tr>
    356 <td>Nexus Player</td>
    357 <td>fugu</td>
    358 <td>aosp_fugu-userdebug</td>
    359 </tr>
    360 <tr>
    361 <td>Nexus 9</td>
    362 <td>volantis (flounder)</td>
    363 <td>aosp_flounder-userdebug</td>
    364 </tr>
    365 <tr>
    366 <td>Nexus 5 (GSM/LTE)</td>
    367 <td>hammerhead</td>
    368 <td>aosp_hammerhead-userdebug</td>
    369 </tr>
    370 <tr>
    371 <td>Nexus 7 (Wi-Fi)</td>
    372 <td>razor (flo)</td>
    373 <td>aosp_flo-userdebug</td>
    374 </tr>
    375 <tr>
    376 <td>Nexus 7 (Mobile)</td>
    377 <td>razorg (deb)</td>
    378 <td>aosp_deb-userdebug</td>
    379 </tr>
    380 <tr>
    381 <td>Nexus 10</td>
    382 <td>mantaray (manta)</td>
    383 <td>full_manta-userdebug</td>
    384 </tr>
    385 <tr>
    386 <td>Nexus 4</td>
    387 <td>occam (mako)</td>
    388 <td>full_mako-userdebug</td>
    389 </tr>
    390 <tr>
    391 <td>Nexus 7 (Wi-Fi)</td>
    392 <td>nakasi (grouper)</td>
    393 <td>full_grouper-userdebug</td>
    394 </tr>
    395 <tr>
    396 <td>Nexus 7 (Mobile)</td>
    397 <td>nakasig (tilapia)</td>
    398 <td>full_tilapia-userdebug</td>
    399 </tr>
    400 <tr>
    401 <td>Galaxy Nexus (GSM/HSPA+)</td>
    402 <td>yakju (maguro)</td>
    403 <td>full_maguro-userdebug</td>
    404 </tr>
    405 <tr>
    406 <td>Galaxy Nexus (Verizon)</td>
    407 <td>mysid (toro)</td>
    408 <td>aosp_toro-userdebug</td>
    409 </tr>
    410 <tr>
    411 <td>Galaxy Nexus (Experimental)</td>
    412 <td>mysidspr (toroplus)</td>
    413 <td>aosp_toroplus-userdebug</td>
    414 </tr>
    415 <tr>
    416 <td>Motorola Xoom (U.S. Wi-Fi)</td>
    417 <td>wingray</td>
    418 <td>full_wingray-userdebug</td>
    419 </tr>
    420 <tr>
    421 <td>Nexus S</td>
    422 <td>soju (crespo)</td>
    423 <td>full_crespo-userdebug</td>
    424 </tr>
    425 <tr>
    426 <td>Nexus S 4G</td>
    427 <td>sojus (crespo4g)</td>
    428 <td>full_crespo4g-userdebug</td>
    429 </tr>
    430 </tbody>
    431 </table>
    432 
    433 <p class="note"><b>Note</b>: Do not use Android 4.1.1 on a Nexus 7 originally
    434 sold with Android 4.1.2 or newer.</p>
    435 
    436 <h2 id="flashing-a-device">Flashing a device</h2>
    437 
    438 <p>You can flash an entire Android system in a single command; doing so verifies
    439 the system being flashed is compatible with the installed bootloader and radio,
    440 writes the boot, recovery, and system partitions together, then reboots the
    441 system. Flashing also erases all user data, similarly to <code>fastboot oem
    442 unlock</code>.</p>
    443 
    444 <p>Place the device in fastboot mode either manually by holding the appropriate
    445 key combination at boot, or from the shell with:</p>
    446 
    447 <pre class="devsite-terminal devsite-click-to-copy">
    448 adb reboot bootloader
    449 </pre>
    450 
    451 <p>After the device is in fastboot mode, run:</p>
    452 
    453 <pre class="devsite-terminal devsite-click-to-copy">
    454 fastboot flashall -w
    455 </pre>
    456 
    457 <p>The <code>-w</code> option wipes the <code>/data</code> partition on the
    458 device; this is useful for your first time flashing a particular device but is
    459 otherwise unnecessary.</p>
    460 
    461 <p class="note"><strong>Note</strong>: Filesystems created via fastboot on
    462 Motorola Xoom do not function optimally. We recommend re-creating filesystems
    463 through recovery, using: <code>$ adb reboot recovery</code>. While in recovery,
    464 open the menu (press Power + Volume Up), wipe the cache partition, then wipe
    465 data.</p>
    466 
    467 
    468 <h2 id="restoring-devices-to-factory-state">Restoring devices to factory
    469 state</h2>
    470 
    471 <p>Factory images for Nexus 5, Nexus 10, Nexus 4, Nexus Q, Nexus 7, Galaxy Nexus
    472 (GSM/HSPA+ "yakju" and "takju", and CDMA/LTE "mysid" and "mysidspr"), Nexus S,
    473 and Nexus S 4G are available from
    474 <a href="https://developers.google.com/android/nexus/images">Google's factory
    475 image</a> page.</p>
    476 
    477 <p>Factory images for the Motorola Xoom are distributed directly by Motorola.</p>
    478 
    479   </body>
    480 </html>
    481