1 Requirements
1.1 Hardware requirements
2)At least 100GB of free disk space for a checkout, 150GB for a single build, and 200GB or more for multiple builds. If you employ ccache, you will need even more space.
3)If you are running Linux in a virtual machine, you need at least 16GB of RAM/swap.
1.2 Software requirements
1.2.1 For GNU/Linux:
2)Android 2.3.x (Gingerbread) - Android 5.x (Lollipop): Ubuntu 12.04 (Precise)
3)Android 1.5 (Cupcake) - Android 2.2.x (Froyo): Ubuntu 10.04 (Lucid)
1.2.2Java Development Kit (JDK)
1) The master branch of Android in AOSP: Ubuntu - OpenJDK 8, Mac OS - jdk 8u45 or newer
2) Android 5.x (Lollipop) - Android 6.0 (Marshmallow): Ubuntu - OpenJDK 7, Mac OS - jdk-7u71-macosx-x64.dmg
3) Android 2.3.x (Gingerbread) - Android 4.4.x (KitKat): Ubuntu - Java JDK 6, Mac OS - Java JDK 6
4) Android 1.5 (Cupcake) - Android 2.2.x (Froyo): Ubuntu - Java JDK 5
1.2.3 Key packages
1) Python 2.6 -- 2.7 from python.org
2) GNU Make 3.81 - 3.82 from gnu.org;
Android 3.2.x (Honeycomb) and earlier will need to revert from make 3.82 to avoid build errors
3) Git 1.7 or newer from git-scm.com
2.1 For Ubuntu >= 15.04
1)Run the following:
$ sudo apt-get update
$ sudo apt-get install openjdk-8-jdk
2)Installing required packages
$ sudo apt-get install git-core gnupg flex bison gperf build-essential \
zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 \
lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev ccache \
libgl1-mesa-dev libxml2-utils xsltproc unzip
$ sudo apt-get install git gnupg flex bison gperf build-essential \
zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev \
libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 \
libgl1-mesa-dev g++-multilib mingw32 tofrodos \
python-markdown libxml2-utils xsltproc zlib1g-dev:i386
$ sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so
2.2 For Ubuntu 14.04
a) openjdk-8-jre-headless_8u45-b14-1_amd64.deb
b) openjdk-8-jre_8u45-b14-1_amd64.deb
c) openjdk-8-jdk_8u45-b14-1_amd64.deb
2)Run the following:
$ wget http://archive.ubuntu.com/ubuntu/pool/universe/o/openjdk-8/openjdk-8-jre-headless_8u45-b14-1_amd64.deb
$ wget http://archive.ubuntu.com/ubuntu/pool/universe/o/openjdk-8/openjdk-8-jre_8u45-b14-1_amd64.deb
$ wget http://archive.ubuntu.com/ubuntu/pool/universe/o/openjdk-8/openjdk-8-jdk_8u45-b14-1_amd64.deb
3) Install the packages:
$ sudo apt-get update
Run dpkg for each of the .deb files you downloaded. It may produce errors due to missing dependencies:
$ sudo dpkg -i {downloaded.deb file}
To fix missing dependencies:
$ sudo apt-get -f install
4) Installing required packages
$ sudo apt-get install git-core gnupg flex bison gperf build-essential \
zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 \
lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev ccache \
libgl1-mesa-dev libxml2-utils xsltproc unzip
3 Downloading the Source
3.1 Installing Repo
1) Make sure you have a bin/ directory in your home directory and that it is included in your path:
$ mkdir ~/bin
$ PATH=~/bin:$PATH
2) Download the Repo tool and ensure that it is executable:
$ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$ chmod a+x ~/bin/repo
3.2 Initializing a Repo client
After installing Repo, set up your client to access the Android source repository:
1) Create an empty directory to hold your working files. If you're using MacOS, this has to be on a case-sensitive filesystem. Give it any name you like:
$ mkdir WORKING_DIRECTORY
$ cd WORKING_DIRECTORY
2) Configure git with your real name and email address. To use the Gerrit code-review tool, you will need an email address that is connected with a registered Google account.
Make sure this is a live address at which you can receive messages. The name that you provide here will show up in attributions for your code submissions.
$ git config --global user.name "Your Name"
$ git config --global user.email "you@example.com"
3.2 Download the Android source(HiKey) tree:
$ repo init -u https://android.googlesource.com/platform/manifest -b master
$ repo sync -j24
4 Compiling userspace
4.1 Download and extract HDMI binaries into the Android source tree:
$ wget https://dl.google.com/dl/android/aosp/linaro-hikey-20160226-67c37b1a.tgz
$ tar xzf linaro-hikey-20160226-67c37b1a.tgz
$ ./extract-linaro-hikey.sh
4.2 Install mcopy utility:
$ apt-get install mtools
4.3 Build:
$ . ./build/envsetup.sh
$ lunch hikey-userdebug
$ make –j12
Note: For 4GB eMMC, instead of $ make -j32 use: $ make -j32 TARGET_USERDATAIMAGE_4GB=true.
5 Fastboot Method AOS
5.1 Make sure fastboot is set up on host computer
1) Android SDK “Tools only” for Linux can be downloaded here
2) The Linux “Tools Only” SDK download does not come with fastboot, you will need to use the Android SDK Manager to install platform-tools.
3) To do this follow the “SDK Readme.txt” instructions included in your SDK “Tools Only” download.
5.2 Boot HiKey into Fastboot mode using J15 header
1) Link pins 1 and 2
2) Link pins 5 and 6
3) Connect host computer to HiKey board using USB to microUSB cable
Name | Link | State |
Auto Power up | Link 1-2 | closed |
Boot Select | Link 3-4 | open |
GPIO3-1 | Link 5-6 | closed |
1) Power on HiKey board by plugging in power adapter
2) Esure HiKey is detected by host computere
3) Wait for about 10 seconds
4) Open Terminal application and execute the following:
$ sudo fastboot devices
0123456789abcdef fastboot
Note: If your HiKey is not being detected by fastboot, you might want to try Board Recovery and return to this step once your board is ready
5.3 Install Operating System update using downloaded files
$ sudo fastboot flash ptable device/linaro/hikey/installer/ptable-aosp-8g.img
$ sudo fastboot reboot
$ sudo fastboot flash boot out/target/product/hikey/boot.img
$ sudo fastboot flash cache out/target/product/hikey/cache.img
$ sudo fastboot flash system out/target/product/hikey/system.img
$ sudo fastboot flash userdata out/target/product/hikey/userdata.img
5.4 Reboot HiKey into new OS
1) Wait untill all files have been flashed onto HiKey board
2) Power down HiKey by unplugging the power adapter
3) Remove microUSB cable from HiKey
4) Remove Link 5-6 from J15 header
Name | Link | State |
Auto Power up | Link 1-2 | closed |
Boot Select | Link 3-4 | open |
GPIO3-1 | Link 5-6 | open |
5)Plug mouse/keyboard USB into type A USB ports6)Power up HiKey by plugging in power adapter
6 Setting monitor resolution
7 Error Summary
7.1 Jack server error:
$ jack-admin start-server
7.2 heap size error:
[ 98% 46178/47121] Building with Jack: o...mework_intermediates/dex-dir/classes.dex
FAILED: /bin/bash out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/dex-dir/classes.dex.rsp
Out of memory error (version 1.3-b8 'Douarn' (395600 eb49254e63b960b5a42dd28dcb1d46f28496395d by android-jack-team@google.com)).
GC overhead limit exceeded.
Try increasing heap size with java option '-Xmx<size>'.
Warning: This may have produced partial or corrupted output.
$ export JACK_SERVER_VM_ARGUMENTS="-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx4g"
$ ./prebuilts/sdk/tools/jack-admin kill-server
$ ./prebuilts/sdk/tools/jack-admin