Setting up an Android build environment for WaRP

Building Android for the first time can be an aggravating and time consuming process. Following these step-by-step instructions should result in a working build environment and a successful Android build with all the images that are needed to run Android on WaRP, including the bootloader, kernel and Android system and recovery partition.

This guide was written starting from installation of Ubuntu Desktop 14.04.2 LTS on a VM. Users

Important Notes

  • Building Android requires approximately 50GB of free disk space.
  • Downloading all the pre-requisite files during the ‘repo sync’ step can take more than an hour depending on connection speed.
  • Building Android can take a few hours, depending on the speed of your machine.

Getting Started

This guide was written using a VM (VMWare or VirtualBox should both work fine).

VMWare Workstation (Free Trial)

VirtualBox (Free)

64-bit Ubuntu Desktop 14.04.2 LTS (64-bit version required. 32-bit version will not build Android)

On first boot of Ubuntu, install system updates

If using VMWare, install VMWare Tools now.

Install OpenJDK6

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java6-installer
sudo apt-get install bison git gperf libxml2-utils make zlib1g-dev:i386 zip
sudo apt-get install g++-multilib
sudo apt-get install liblzo2-dev:i386

Install gcc and g++

sudo apt-get install gcc
sudo apt-get install g++

Configure git user and email

git config --global user.name "FirstName LastName"
git config --global user.email username@domain.com

Installing vim/gvim
I use gvim for source editing. Because this is a fresh Ubuntu install, go ahead and install your text editor of choice.

sudo apt-get install vim-gtk

Install repo

mkdir ~/bin
PATH=~/bin:$PATH

curl https://storage.googleapis.com/git-repo-downloads/repo &> ~/bin/repo
chmod a+x ~/bin/repo

Initialize and download Android repository (source code)

Warning: ‘repo sync’ step downloads the source repository and can take a long time depending on connection speed.

mkdir WaRP_Android
repo init -u https://github.com/warpboard/platform_manifest/ -b warp/imx_open_jb4.3_1.1.0-ga
repo sync

Set up environment variables

Add the following lines to ~/.bashrc to define the machine architecture and cross compiler.

export ARCH=arm
export CROSS_COMPILE=arm-linux-gnueabi-
export PATH=~/bin:$PATH

# Android build specific defines
export USE_CCACHE=1

Not required, but I like to use these grep and find aliases when working with the kernel. They can be added to ~/.bashrc

alias sgrep='grep --include={*.c,*.h} -rn "./" -i -e'
alias kgrep='grep --include={Makefile,Kconfig} -rn "./" -i -e'
alias sfind='find . | grep'

Build Android
We should be all ready to build now!

source build/envsetup.sh
lunch warpboard-eng
make -j4

Build outputs
Congratulations, you should now have successfully built images that you can load onto your WaRP board.
Images should be located in the directory:

~/WaRP_Android/out/target/product/warp
U-Boot bootloader binary:
u-boot.imx
Binaries for system:
boot.img
recovery.img
system.img

Additional External Resources
Official Android Instructions for Initializing a Build Environment

3 replies
  1. Nex
    Nex says:

    Hi
    When I finished Build Android, I only have u-boot.imx file, I cant the find boot.img, recovery.img and system.img.
    Why?

    Thanks

    Nex

    Reply

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *