Short manual how to prepare Linux Ubuntu 16.04 environment to be able to compile Android Marshmallow 6
Assumption:
The tutorial is dedicated to Linux users
As an example The TinkerBoard Android build instruction taken from
thttps://tinkerboarding.co.uk/wiki/index.php/Software
Host Machine Hardware Configuration
100GByte free diskspace
8 or better 16 GByte of Ram
At least 4 thread CPU (performance reason)
1. Create directory for Android build purpose
mkdir tb_a6
2. Go to created folder
cd tb_a6
3. Java preparation
sudo apt-get purge openjdk-\* icedtea-\* icedtea6-\*
sudo apt-get update
sudo apt-get install openjdk-7-jdk
java -version
Note: The version should be as follow
java version “1.7.0_65”
OpenJDK Runtime Environment (IcedTea 2.5.3)
OpenJDK 64-Bit Server VM (build 24.65-b04, mixed mode)
4. Install the necessary tools to make an Android build
sudo apt-get install bison g++-multilib git gperf libxml2-utils make zlib1g-dev:i386 zip repo
5. Initialize the AOSP of Android Marshmallow tree
repo init -u https://git@bitbucket.org/TinkerBoard_Android/manifest.git -b sbc/tinkerboard/asus/Android-6.0.1
6. Download code of Android Marshmallow from Google servers
repo sync -d
7. Now before compilation a few patch of the code is necessary
7.1 When encounter problem like
libnativehelper/JniInvocation.cpp:165: error: unsupported reloc 43
then in file /art/build/Android.common_build.mk modify
# Host.
ART_HOST_CLANG := false
ifneq ($(WITHOUT_HOST_CLANG),true)
# By default, host builds use clang for better warnings.
ART_HOST_CLANG := true
endif
to
# Host.
ART_HOST_CLANG := false
ifeq ($(WITHOUT_HOST_CLANG),false)
# By default, host builds use clang for better warnings.
ART_HOST_CLANG := true
endif
and finally
cp /usr/bin/ld.gold prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6/x86_64-linux/bin/ld
Note 1: Above path with glibc2.11 can be different and is depend on Your local setting and files. Remember to align those cp instruction.
Note 2: If You start compilation without above change it is necessary to clean all intermediate files using
make clobber
8. When discover problem like
Try increasing heap size with java option ‘-Xmx’.
then apply following code
export JACK_SERVER_VM_ARGUMENTS="-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx4096m" out/host/linux-x86/bin/jack-admin kill-server out/host/linux-x86/bin/jack-admin start-server
Note: Problem with heap usually appears when You have below 12-16 Gb of RAM in the system
9. Build AOSP images
source build/envsetup.sh && lunch rk3288-userdebug
10. Start compilation
make -j${nproc}
11. When finish output images are available in output folder
out/target/product/<target>/boot.img
out/target/product/<target>/system.img
out/target/product/<target>/userdata.img