HiKey&96board的Android Source编译和下载 错误详解

1 Requirements

1.1 Hardware requirements

1)A 64-bit environment is required for Gingerbread (2.3.x) and newer versions, including the master branch. You can compile older versions on 32-bit systems.
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:

1)Android 6.0 (Marshmallow) - AOSP master: Ubuntu 14.04 (Trusty)
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)

Please note, since there are no available supported OpenJDK 8 packages for Ubuntu 14.04, the Ubuntu 15.04 packages must be installed manually. See JDK for Ubuntu LTS 14.04 for precise instructions.

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 Establishing a Build Environment

2.1 For Ubuntu >= 15.04

1Run the following:

$ sudo apt-get update
$ sudo apt-get install openjdk-8-jdk

2Installing 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

1)Download the .deb packages for 64-bit architecture from archive.ubuntu.com:

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 -{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 sourceHiKey) 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


NameLinkState

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 upLink 1-2closed
Boot SelectLink 3-4open
GPIO3-1Link 5-6open

5)Plug mouse/keyboard USB into type A USB ports6)Power up HiKey by plugging in power adapter

6 Setting monitor resolution

Edit device/linaro/hikey/BoardConfig.mk parameter BOARD_KERNEL_CMDLINE and configure the video setting. Example setting for a 24" monitor: video=HDMI-A-1: 800x480@50.

7 Error Summary

7.1 Jack server error:

[ 87% 11126/12684] Compiling SDK Stubs...ubs_current_intermediates/classes.jackFAILED:out/target/common/obj/JAVA_LIBRARIES/android_stubs_current_intermediates/classes.jack Communication error with Jack server (56). Try 'jack-diagnose'ninja: build stopped: subcommand failed. solve:
$ 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.

Solve:
$ export JACK_SERVER_VM_ARGUMENTS="-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx4g"
$ ./prebuilts/sdk/tools/jack-admin kill-server
$ ./prebuilts/sdk/tools/jack-admin 


 
            

































评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值