Building AOSP source code


  1. System info

Kernel Linux 3.13.0-55-generic x86_64 x86_64 x86_64 GNU/Linux
LSB release Ubuntu 14.04.2 LTS
gcc gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04)
make GNU Make v3.81
Primary Mem 7.7G
Swap 2.8G
Processor Intel(R) Core(TM) i5-4210U CPU @ 1.70GHz * 4
  1. Setting up linux environment

    Installing JDK

    $ sudo apt-get install openjdk-7-jdk

    Update JDK to OpenJDK: Manually choose the version of OpenJDK from the list

    $ sudo update-alternatives --config java
    $ sudo update-alternatives --config javac

    Installing other debian packages required for building

    $ sudo apt-get install bison g++-multilib git gperf libxml2-utils make python-networkx zlib1g-dev:i386 zip

    Optimizing a build environment: Compiler cache to fasten up building

    $ export USE_CCACHE=1
    $ export CCACHE_DIR=/tmp/.cache
    $ prebuilts/misc/linux-x86/ccache/ccache -M 50G
  2. Downloading the source

    Installing repo: a tool to fetch the source code of AOSP

    $ mkdir ~/bin 
    $ PATH=~/bin:$PATH
    $ curl > ~/bin/repo
    $ chmod a+x ~/bin/repo

    Initializing a repo client: After installing Repo, set up our client to access the Android source repository

    $ repo init -u

    Downloading the Android source tree

    $ repo sync
  3. Building Source

    Run a script to capture the terminal session for build logs

    $ sudo apt-get install bsd-utils
    $ script -t -a 2> /tmp/time.txt /tmp/record.txt

    Initialize Build

    $ source build/

    Choose a target

    $ lunch aosp_arm-eng

    Build the code

    $ date; make -j32; date;
  1. Statistics

  2. More information about statistics is included in the records.txt (terminal logs) and log (memory and process log)
Size before the build 39.7 GB
Size after the build 67 GB
Build start time 12:04:56 IST
Build end time 13:35:26 IST
Total build time 01:30:30
  • Emulator:

    After a successful build, emulator tool will be installed in the host machine. Build version is 5.1.1_r8



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s