Contents
Overview
This page provides the instructions on how to setup the build environment for Android along with download and build instructions.
Initializing a Build Environment (from android.com)
Make sure you go through this: http://source.android.com/source/initializing.html Please install python-mako package which is a dependency for the piglit test suite that gets built.
Platform Code Get source and Building
On https://android-build.linaro.org we have all build listed there, most of them are made everyday. There you can see such configurations for each build. Let us consider https://android-build.linaro.org/builds/~linaro-android/lcr-reference-juno//
BUILD_CONFIG_REPO=http://android.git.linaro.org/git/android-build-configs.git BUILD_CONFIG_BRANCH=master BUILD_CONFIG_FILENAME=lcr-reference-juno
This means the actual build configurations are in the file lcr-reference-juno in the master branch of http://android.git.linaro.org/git/android-build-configs.git.
Looking at that file, we see (as of the time of writing this wiki page -- files tend to change more frequently than documentation, so you may see newer version numbers etc. when checking it out):
MANIFEST_REPO=git://android.git.linaro.org/platform/manifest.git MANIFEST_BRANCH=android-5.1.1_r18 REPO_GROUPS="default,-device,arm" BUILD_FS_IMAGE=1 PATCHSETS=LOLLIPOP-EXPERIMENTAL-PATCHSET LOCAL_MANIFEST=git://android.git.linaro.org/platform/manifest.git LOCAL_MANIFEST_BRANCH=linaro-lollipop LUNCH=juno-userdebug TARGET_PRODUCT=juno SUBMIT_JOB_FROM_TEST_PLAN=false USE_JAVA_7=true MAKE_JOBS=8 WITH_DEXPREOPT=true WITH_HOST_DALVIK=true BOOTLOADER_TYPE=uefi REPO_QUIET=false TARGET_BUILD_VARIANT=eng MAKE_TARGETS="selinuxtarballs" SUBMIT_JOB_FROM_TEST_PLAN=false LAVA_JOB_URL=https://git.linaro.org/qa/test-plans.git/blob_plain/HEAD:/android/armv8-android-juno-lsk/template.json LAVA_JOB_URL_1=https://git.linaro.org/qa/test-plans.git/blob_plain/HEAD:/android/armv8-android-juno-lsk/template-cts-focused1.json LAVA_JOB_URL_2=https://git.linaro.org/qa/test-plans.git/blob_plain/HEAD:/android/armv8-android-juno-lsk/template-cts-focused2.json LAVA_JOB_URL_3=https://git.linaro.org/qa/test-plans.git/blob_plain/HEAD:/android/armv8-android-juno-lsk/template-andebenchpro.json LAVA_JOB_URL_4=https://git.linaro.org/qa/test-plans.git/blob_plain/HEAD:/android/armv8-android-juno-lsk/template-antutu2.json LAVA_JOB_URL_5=https://git.linaro.org/qa/test-plans.git/blob_plain/HEAD:/android/armv8-android-juno-lsk/template-antutu3.json LAVA_JOB_URL_6=https://git.linaro.org/qa/test-plans.git/blob_plain/HEAD:/android/armv8-android-juno-lsk/template-antutu5.7.json LAVA_JOB_URL_7=https://git.linaro.org/qa/test-plans.git/blob_plain/HEAD:/android/armv8-android-juno-lsk/template-benchmarkpi.json LAVA_JOB_URL_8=https://git.linaro.org/qa/test-plans.git/blob_plain/HEAD:/android/armv8-android-juno-lsk/template-cf-bench.json LAVA_JOB_URL_9=https://git.linaro.org/qa/test-plans.git/blob_plain/HEAD:/android/armv8-android-juno-lsk/template-gearses2eclair.json LAVA_JOB_URL_10=https://git.linaro.org/qa/test-plans.git/blob_plain/HEAD:/android/armv8-android-juno-lsk/template-geekbench3.json LAVA_JOB_URL_11=https://git.linaro.org/qa/test-plans.git/blob_plain/HEAD:/android/armv8-android-juno-lsk/template-glbenchmark-2.5.1.json LAVA_JOB_URL_12=https://git.linaro.org/qa/test-plans.git/blob_plain/HEAD:/android/armv8-android-juno-lsk/template-javawhetstone.json LAVA_JOB_URL_13=https://git.linaro.org/qa/test-plans.git/blob_plain/HEAD:/android/armv8-android-juno-lsk/template-jbench.json LAVA_JOB_URL_14=https://git.linaro.org/qa/test-plans.git/blob_plain/HEAD:/android/armv8-android-juno-lsk/template-linpackjava.json LAVA_JOB_URL_15=https://git.linaro.org/qa/test-plans.git/blob_plain/HEAD:/android/armv8-android-juno-lsk/template-linpack.json LAVA_JOB_URL_16=https://git.linaro.org/qa/test-plans.git/blob_plain/HEAD:/android/armv8-android-juno-lsk/template-quadrantpro.json LAVA_JOB_URL_17=https://git.linaro.org/qa/test-plans.git/blob_plain/HEAD:/android/armv8-android-juno-lsk/template-scimark.json LAVA_JOB_URL_18=https://git.linaro.org/qa/test-plans.git/blob_plain/HEAD:/android/armv8-android-juno-lsk/template-sqlite.json LAVA_JOB_URL_19=https://git.linaro.org/qa/test-plans.git/blob_plain/HEAD:/android/armv8-android-juno-lsk/template-vellamo3.json LAVA_JOB_URL_20=https://git.linaro.org/qa/test-plans.git/blob_plain/HEAD:/android/armv8-android-juno-lsk/template-applications.json LAVA_JOB_URL_21=https://git.linaro.org/qa/test-plans.git/blob_plain/HEAD:/android/armv8-android-juno-lsk/template-wa-benchmarks.json LAVA_JOB_URL_22=https://git.linaro.org/qa/test-plans.git/blob_plain/HEAD:/android/armv8-android-juno-lsk/template-wa-workloads.json LAVA_JOB_URL_23=https://git.linaro.org/qa/test-plans.git/blob_plain/HEAD:/android/armv8-android-juno-lsk/template-wa-workloads-audio.json SUBMIT_JOB_FROM_URL=true LAVA_SUBMIT=1 LAVA_SUBMIT_FATAL=0 LINARO_BUILD_SPEC=armv8-android-juno-lsk SOURCE_OVERLAY="arm/20150904/vendor.tar.bz2" SOURCE_OVERLAY_ACCEPT_LICENSE=51722ba4ccc270bcd54cb360cb242798 REWRITE_MANIFEST=0 TARGET_OUT_DIR=juno INIT_BOOTCHART=true REPO_SEED_DIR=/home/buildslave/workspace/linaro-android_aosp-reference-mirror
The various LAVA_* lines control validation of the build in LAVA. Some other lines control build machine internal bits and download locations of the finished build. The parts of the configuration that are relevant for reproducing a build locally are:
MANIFEST_REPO=git://android.git.linaro.org/platform/manifest.git MANIFEST_BRANCH=android-5.1.1_r18 REPO_GROUPS="default,-device,arm" BUILD_FS_IMAGE=1 PATCHSETS=LOLLIPOP-EXPERIMENTAL-PATCHSET LOCAL_MANIFEST=git://android.git.linaro.org/platform/manifest.git LOCAL_MANIFEST_BRANCH=linaro-lollipop LUNCH=juno-userdebug
The following will download the source for that build that you can use to build.
This means the build is based on the android-5.1.1_r18 branch in git://android.git.linaro.org/platform/manifest.git (this is unmodified AOSP -- if your connection to Google's servers is faster than your connection to Linaro's servers, you might as well use https://android.googlesource.com/platform/manifest.git for this), with local extensions from the linaro-lollipop branch of git://android.git.linaro.org/platform/manifest.git (This is modifications that do not live in upstream AOSP, so you can not substitute Google's servers for Linaro's here).
AOSP (and most derived products including Linaro's builds) use the repo tool to manage downloading code from multiple git repositories. If you don't have it installed in a system wide location, get it:
mkdir aosp cd aosp curl https://storage.googleapis.com/git-repo-downloads/repo > repo chmod +x ./repo
Then initialize the repository:
./repo init -u https://android.googlesource.com/platform/manifest.git -b android-5.1.1_r18 -g "default,-device,arm"
The parameter to -g -- "default,-device,arm" -- is the content of the REPO_GROUPS variable in the build config. For the detail description and available option for the REPO_GROUPS variable, your can refer to this page: Description about groups of manifest
Next, add the Linaro modifications:
cd .repo git clone git://android.git.linaro.org/platform/manifest.git -b linaro-lollipop local_manifests cd ..
Next, make sure you have at least 90 GB of free diskspace - the source tree currently is 86 GB and some temporary files will be created during the download. Then download the entire code base - This can take a long time, depending on your connection speed (you may want to leave this running overnight):
./repo sync
Then, apply the extra patches listed in the PATCHSETS variable in the build config. Make sure PATCHSETS is set, and run
for i in $PATCHSETS; do sh ./android-patchsets/$i done
Next, prepare the build as you would prepare a regular AOSP build:
source build/envsetup.sh lunch juno-userdebug
And start the build -- if the config says BUILD_FS_IMAGE=1, you want to run
make selinuxtarballs -j16
Otherwise, the build command is
make droidcore -j16
The build can take a long time depending on your build machine specs. (You should have a fast CPU, at least 8 GB RAM, and a fast harddisk or SSD).
Toolchain Code
Linaro builds of AOSP include Linaro toolchains alongside the regular AOSP toolchains. The Linaro toolchains will usually produce faster code and will sometimes be a couple of versions ahead of the AOSP toolchains.
Toolchain binaries live in the prebuilts/gcc/linux-x86/arm and prebuilts/gcc/linux-x86/aarch64 directories inside the AOSP source tree. By default, builds will use the latest AOSP toolchain.
To pick a different toolchain, specify the TARGET_TOOLS_PREFIX variable when starting a build - e.g. to use the Linaro ARMv7 toolchain based on gcc 5.2, use
make droidcore -j16 TARGET_TOOLS_PREFIX=prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-5.2-linaro/bin/arm-linux-androideabi-
If you need to obtain the source code for the toolchains, use
mkdir android-toolchain cd android-toolchain repo init -u http://android.git.linaro.org/git/toolchain/manifest.git -b linaro-master repo sync
To build the toolchain, do
mkdir obj cd obj ../build/linaro-build.sh --with-gcc=http://ftp.gnu.org/gnu/gcc/gcc-5.2.0/gcc-5.2.0.tar.bz2
Where the parameter to --with-gcc points to either a tarball or a git repository containing the version of gcc you want to use. You can also override the version of binutils and other components that are built as part of the toolchain. This is usually not required. ../build/linaro-build.sh --help shows available options.
Help!
If Something Goes Wrong or You Have Questions
Platform/Android/GetSource (last modified 2015-09-15 15:17:58)