Skip to content

Instantly share code, notes, and snippets.

@allanlw
Created February 22, 2015 17:20
Show Gist options
  • Save allanlw/23cd393b706cc4a61661 to your computer and use it in GitHub Desktop.
Save allanlw/23cd393b706cc4a61661 to your computer and use it in GitHub Desktop.
build and run an android aos automagically on Ubuntu 14.04
#!/bin/bash
# Configurable options
REPO_TAG=android-4.4.3_r1.1
LUNCH_TARGET=aosp_arm-eng
CCACHE_SIZE=10G
WORKDIR=aos_workdir
# Below this is just all the script crap
set -e # abort after first error
set -v # echo commands before running
sudo apt-get update
sudo apt-get install oracle-java6-installer bison g++-multilib git gperf libxml2-utils curl
if [ ! -d "$WORKDIR" ]; then
mkdir "$WORKDIR"
fi
cd $WORKDIR
if [ ! -f "./repo" ]; then
curl https://storage.googleapis.com/git-repo-downloads/repo > ./repo
chmod +x repo
fi
if [ ! -f "./.repo" ]; then
# Note --depth 1, so we don't acquire entire history, just the top part
./repo init -u https://android.googlesource.com/platform/manifest --depth 1 -b $REPO_TAG
fi
# Sync the repository (pull the most recent version of everything)
./repo sync
export USE_CCACHE=1
if [ ! -d "$HOME/.ccache" ]; then
mkdir "$HOME/.ccache"
fi
./prebuilts/misc/linux-x86/ccache/ccache -M $CCACHE_SIZE
# Load the aos build shit
. build/envsetup.sh
# Target: aosp_arm-eng
lunch $LUNCH_TARGET
# Actually try and build everything - cross your fingers and hope this works
make -j $(nproc)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment