blob: d57dcbfd4e5bed912355604c609ff273a800278e [file] [log] [blame]
page.title=Selecting Devices
@jd:body
<!--
Copyright 2016 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.
-->
<div id="qv-wrapper">
<div id="qv">
<h2>In this document</h2>
<ol id="auto-toc">
</ol>
</div>
</div>
<p>You can create builds for Nexus devices using Android Open Source Project
(AOSP) builds and the relevant hardware-specific binaries. For available Android
builds and targeted Nexus devices, see
<a href="{@docRoot}source/build-numbers.html#source-code-tags-and-builds">Source
Code, Tags, and Builds</a>.</p>
<p class="note"><b>Note:</b> Due to hardware differences, do not use Android
4.1.1 on a Nexus 7 originally sold with Android 4.1.2 or newer.</p>
<p>You can also create builds for the
<a href="https://android.googlesource.com/device/linaro/hikey/">HiKey</a>
Android reference board (described below). Reference boards are designed to help
non-Nexus component vendors develop and port drivers to Android releases. Using
a reference board can ease upgrade efforts, reduce time-to-market for new
Android devices, lower device costs by enabling ODM/OEMs to choose from a wider
range of compatible components, and increase the speed of innovation among
component suppliers.</p>
<h2 id="hikey-boards">HiKey boards</h2>
<p>Google supports
<a href="https://www.96boards.org/products/ce/hikey/">HiKey</a>, a certified
<a href="http://www.96boards.org/">96Board</a>, as an Android reference board.
AOSP provides kernel source and board support for HiKey to enable developers to
easily create and debug new and existing peripheral drivers, do kernel
development, and perform other tasks with fewer OEM encumbrances.</p>
<p>HiKey boards</a> are available in
<a href="http://www.lenovator.com/product/86.html">1GB RAM</a> and
<a href="http://www.lenovator.com/product/90.html">2GB RAM</a> configurations from
<a href="http://www.lenovator.com">Lenovator</a>:</p>
<img src="images/hikey-board.png" alt="HiKey board image" />
<p class="img-caption"><strong>Figure 1.</strong> HiKey board by Lenovator</p>
<p>Additional resources:</p>
<ul>
<li>
<a href="https://www.96boards.org/wp-content/uploads/2015/02/96Boards-Hikey-Rev-A1.pdf">HiKey
schematics</a></li>
<li>
<a href="https://www.96boards.org/wp-content/uploads/2015/02/HiKey_User_Guide_Rev0.2.pdf">HiKey
User Guide</a></li>
<li>
<a href="https://github.com/96boards/documentation/wiki/HiKey-Home">HiKey
wiki</a></li>
</ul>
<h2 id="running-android-hikey">Running Android on HiKey</h2>
<p>Use the following commands to download, build, and run Android on a HiKey
board.</p>
<h3 id="compiling-userspace">Compiling userspace</h3>
<ol>
<li>Download the Android source tree:<br>
<pre><code>$ repo init -u <a href="https://android.googlesource.com/platform/manifest">https://android.googlesource.com/platform/manifest</a> -b master<br>
$ repo sync -j24</code></pre></li>
<li>Download and extract HDMI binaries into the Android source tree:<br>
<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>
$ tar xzf linaro-hikey-20160226-67c37b1a.tgz<br>
$ ./extract-linaro-hikey.sh</code></pre></li>
<li>Install mcopy utility:<br>
<pre><code>$ apt-get install mtools</code></pre></li>
<li>Build:<br>
<pre><code>$ . ./build/envsetup.sh<br>
$ lunch hikey-userdebug<br>
$ make -j32</code></pre></li>
</ol>
<p class="note"><b>Note:</b> For 4GB eMMC, instead of <code>$ make -j32</code>
use: <code>$ make -j32 TARGET_USERDATAIMAGE_4GB=true</code>.</p>
<h3 id="installing-fastboot-ptable">Installing initial fastboot and ptable</h3>
<ol>
<li>Select special bootloader mode by linking J15 1-2 and 3-4 pins (for details,
refer to the
<a href="https://www.96boards.org/wp-content/uploads/2015/02/HiKey_User_Guide_Rev0.2.pdf">HiKey
User Guide</a>).</li>
<li>Connect USB to PC to get ttyUSB device (ex: <code>/dev/ttyUSB1</code>).</li>
<li>Power the board:<br>
<pre><code>$ cd device/linaro/hikey/installer<br>
$ ./flash-all.sh /dev/ttyUSB1 [4g]</code></pre></li>
<li>Remove jumper 3-4 and power the board.</li>
</ol>
<h3 id="flashing-images">Flashing images</h3>
<ol>
<li>Enter fastboot mode by linking J15 1-2 and 5-6 pins.</li>
<li>Run the following commands:<br>
<pre><code>$ fastboot flash boot out/target/product/hikey/boot_fat.uefi.img<br>
$ fastboot flash -w system out/target/product/hikey/system.img</code></pre></li>
<li>Remove jumper 5-6 and power the board.</li>
</ol>
<h3 id="building-kernel">Building the kernel</h3>
<ol>
<li>Run the following commands:<br>
<pre><code>$ git clone <a href="https://android.googlesource.com/kernel/hikey-linaro">https://android.googlesource.com/kernel/hikey-linaro</a><br>
$ cd hikey-linaro<br>
$ git checkout -b android-hikey-linaro-4.4 origin/android-hikey-linaro-4.4<br>
$ make ARCH=arm64 hikey_defconfig<br>
$ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-android- -j24</code></pre></li>
<li>Copy output to the hikey kernel directory
(<code>/kernel/hikey-linaro</code>):
<ul>
<li>Copy hi6220-hikey.dtb
(<code>arch/arm64/boot/dts/hisilicon/hi6220-hikey.dtb</code>) to the
hikey-kernel directory.</li>
<li>Copy the Image directory <code>(arch/arm64/boot/Image</code>) to the
hikey-kernel directory.</li>
</ul>
</li>
</ol>
<h3 id="setting-resolution">Setting monitor resolution</h3>
<p>Edit <code>device/linaro/hikey/bootloader/EFI/BOOT/grub.cfg</code> and
configure the <code>video</code> setting. Example setting for a 24" monitor:
<code>video=HDMI-A-1:1280x800@60</code>.</p>
<h3 id="configuring-output">Configuring kernel serial output (uart3)</h3>
<p>Set the J2 low speed expansion connector to 1 - Gnd, 11 - Rx, 13 - Tx . For
details, refer to the
<a href="https://www.96boards.org/wp-content/uploads/2015/02/HiKey_User_Guide_Rev0.2.pdf">HiKey
User Guide</a>).</p>