1page.title=Selecting Devices 2@jd:body 3 4<!-- 5 Copyright 2016 The Android Open Source Project 6 7 Licensed under the Apache License, Version 2.0 (the "License"); 8 you may not use this file except in compliance with the License. 9 You may obtain a copy of the License at 10 11 http://www.apache.org/licenses/LICENSE-2.0 12 13 Unless required by applicable law or agreed to in writing, software 14 distributed under the License is distributed on an "AS IS" BASIS, 15 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 See the License for the specific language governing permissions and 17 limitations under the License. 18--> 19<div id="qv-wrapper"> 20 <div id="qv"> 21 <h2>In this document</h2> 22 <ol id="auto-toc"> 23 </ol> 24 </div> 25</div> 26 27 28<p>You can create builds for Nexus devices using Android Open Source Project 29(AOSP) builds and the relevant hardware-specific binaries. For available Android 30builds and targeted Nexus devices, see 31<a href="{@docRoot}source/build-numbers.html#source-code-tags-and-builds">Source 32Code, Tags, and Builds</a>.</p> 33 34<p class="note"><b>Note:</b> Due to hardware differences, do not use Android 354.1.1 on a Nexus 7 originally sold with Android 4.1.2 or newer.</p> 36 37<p>You can also create builds for the 38<a href="https://android.googlesource.com/device/linaro/hikey/">HiKey</a> 39Android reference board (described below). Reference boards are designed to help 40non-Nexus component vendors develop and port drivers to Android releases. Using 41a reference board can ease upgrade efforts, reduce time-to-market for new 42Android devices, lower device costs by enabling ODM/OEMs to choose from a wider 43range of compatible components, and increase the speed of innovation among 44component suppliers.</p> 45 46<h2 id="hikey-boards">HiKey boards</h2> 47 48<p>Google supports 49<a href="https://www.96boards.org/products/ce/hikey/">HiKey</a>, a certified 50<a href="http://www.96boards.org/">96Board</a>, as an Android reference board. 51AOSP provides kernel source and board support for HiKey to enable developers to 52easily create and debug new and existing peripheral drivers, do kernel 53development, and perform other tasks with fewer OEM encumbrances.</p> 54 55<p>HiKey boards</a> are available in 56<a href="http://www.lenovator.com/product/86.html">1GB RAM</a> and 57<a href="http://www.lenovator.com/product/90.html">2GB RAM</a> configurations from 58<a href="http://www.lenovator.com">Lenovator</a>:</p> 59 60<img src="images/hikey-board.png" alt="HiKey board image" /> 61<p class="img-caption"><strong>Figure 1.</strong> HiKey board by Lenovator</p> 62 63<p>Additional resources:</p> 64<ul> 65<li> 66<a href="https://www.96boards.org/wp-content/uploads/2015/02/96Boards-Hikey-Rev-A1.pdf">HiKey 67schematics</a></li> 68<li> 69<a href="https://www.96boards.org/wp-content/uploads/2015/02/HiKey_User_Guide_Rev0.2.pdf">HiKey 70User Guide</a></li> 71<li> 72<a href="https://github.com/96boards/documentation/wiki/HiKey-Home">HiKey 73wiki</a></li> 74</ul> 75 76<h2 id="running-android-hikey">Running Android on HiKey</h2> 77 78<p>Use the following commands to download, build, and run Android on a HiKey 79board.</p> 80 81<h3 id="compiling-userspace">Compiling userspace</h3> 82<ol> 83<li>Download the Android source tree:<br> 84<pre><code>$ repo init -u <a href="https://android.googlesource.com/platform/manifest">https://android.googlesource.com/platform/manifest</a> -b master<br> 85$ repo sync -j24</code></pre></li> 86<li>Download and extract HDMI binaries into the Android source tree:<br> 87<pre><code>$ wget <a href="https://dl.google.com/dl/android/aosp/linaro-hikey-20160226-67c37b1a.tgz">https://dl.google.com/dl/android/aosp/linaro-hikey-20160226-67c37b1a.tgz</a><br> 88$ tar xzf linaro-hikey-20160226-67c37b1a.tgz<br> 89$ ./extract-linaro-hikey.sh</code></pre></li> 90<li>Install mcopy utility:<br> 91<pre><code>$ apt-get install mtools</code></pre></li> 92<li>Build:<br> 93<pre><code>$ . ./build/envsetup.sh<br> 94$ lunch hikey-userdebug<br> 95$ make -j32</code></pre></li> 96</ol> 97 98<p class="note"><b>Note:</b> For 4GB eMMC, instead of <code>$ make -j32</code> 99use: <code>$ make -j32 TARGET_USERDATAIMAGE_4GB=true</code>.</p> 100 101<h3 id="installing-fastboot-ptable">Installing initial fastboot and ptable</h3> 102<ol> 103<li>Select special bootloader mode by linking J15 1-2 and 3-4 pins (for details, 104refer to the 105<a href="https://www.96boards.org/wp-content/uploads/2015/02/HiKey_User_Guide_Rev0.2.pdf">HiKey 106User Guide</a>).</li> 107<li>Connect USB to PC to get ttyUSB device (ex: <code>/dev/ttyUSB1</code>).</li> 108<li>Power the board:<br> 109<pre><code>$ cd device/linaro/hikey/installer/hikey<br> 110$ ./flash-all.sh /dev/ttyUSB1 [4g]</code></pre></li> 111<li>Remove jumper 3-4 and power the board.</li> 112</ol> 113 114<h3 id="flashing-images">Flashing images</h3> 115<ol> 116<li>Enter fastboot mode by linking J15 1-2 and 5-6 pins.</li> 117<li>Run the following commands:<br> 118<pre><code>$ fastboot flash boot out/target/product/hikey/boot.img<br> 119$ fastboot flash -w system out/target/product/hikey/system.img</code></pre></li> 120<li>Remove jumper 5-6 and power the board.</li> 121</ol> 122 123<h3 id="building-kernel">Building the kernel</h3> 124<ol> 125<li>Run the following commands:<br> 126<pre><code>$ git clone <a href="https://android.googlesource.com/kernel/hikey-linaro">https://android.googlesource.com/kernel/hikey-linaro</a><br> 127$ cd hikey-linaro<br> 128$ git checkout -b android-hikey-linaro-4.9 origin/android-hikey-linaro-4.9<br> 129$ make ARCH=arm64 hikey_defconfig<br> 130$ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-android- -j24</code></pre></li> 131<li>Copy output to the hikey kernel directory 132(<code>/kernel/hikey-linaro</code>): 133<ol style="list-style-type:lower-alpha"> 134<li>Copy hi6220-hikey.dtb 135(<code>arch/arm64/boot/dts/hisilicon/hi6220-hikey.dtb</code>) to the 136hikey-kernel directory as file hi6220-hikey.dtb-4.9.</li> 137<li>Copy the Image file <code>(arch/arm64/boot/Image-dtb</code>) to the 138hikey-kernel directory as file Image-dtb-4.9.</li></ol> 139<li>Make the boot image: 140<pre> 141$ make bootimage -j24 142</pre> 143</li> 144</ol> 145 146<h3 id="setting-resolution">Setting monitor resolution</h3> 147<p>Edit <code>device/linaro/hikey/hikey/BoardConfig.mk</code> parameter 148<code>BOARD_KERNEL_CMDLINE</code> and configure the <code>video</code> setting. 149Example setting for a 24" monitor: <code>video=HDMI-A-1:1280x800@60</code>.</p> 150 151<h3 id="configuring-output">Configuring kernel serial output (uart3)</h3> 152<p>Set the J2 low speed expansion connector to 1 - Gnd, 11 - Rx, 13 - Tx. For 153details, refer to the 154<a href="https://www.96boards.org/wp-content/uploads/2015/02/HiKey_User_Guide_Rev0.2.pdf">HiKey 155User Guide</a>.</p> 156