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

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

[code lang="text" light="true"]
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
[/code]

Install gcc and g++

[code lang="text" light="true"]
sudo apt-get install gcc
sudo apt-get install g++
[/code]

Configure git user and email

[code lang="text" light="true"]
git config --global user.name "FirstName LastName"
git config --global user.email username@domain.com
[/code]

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.

[code lang="text" light="true"]
sudo apt-get install vim-gtk
[/code]

Install repo

[code lang="text" light="true"]
mkdir ~/bin
PATH=~/bin:$PATH

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

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.

[code lang="text" light="true"]
mkdir WaRP_Android
repo init -u https://github.com/warpboard/platform_manifest/ -b warp/imx_open_jb4.3_1.1.0-ga
repo sync
[/code]

Set up environment variables

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

[code lang="text" light="true"]
export ARCH=arm
export CROSS_COMPILE=arm-linux-gnueabi-
export PATH=~/bin:$PATH
[/code]

# 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

[code lang="text" light="true"]
alias sgrep='grep --include={*.c,*.h} -rn "./" -i -e'
alias kgrep='grep --include={Makefile,Kconfig} -rn "./" -i -e'
alias sfind='find . | grep'
[/code]

Build Android
We should be all ready to build now!

[code lang="text" light="true"]
source build/envsetup.sh
lunch warpboard-eng
make -j4
[/code]

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:

[code lang="text" light="true"]
~/WaRP_Android/out/target/product/warp
[/code]
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 Responses

  1. 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

Leave a Reply to Nex Cancel reply

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