You've successfully subscribed to Nicholas Workshop
Great! Next, complete checkout for full access to Nicholas Workshop
Welcome back! You've successfully signed in.
Success! Your account is fully activated, you now have access to all content.
Success! Your billing info is updated.
Billing info update failed.

AOSP Building Guide on CentOS7 And RHEL7

Nicholas Wong
Nicholas Wong

Install libraries

# fetch source
sudo yum install git
sudo yum install wget
# to compile
sudo yum install java-1.7.0-openjdk
sudo yum install java-1.7.0-openjdk-devel
sudo yum install glibc.i686
sudo yum install libstdc++.i686
sudo yum install bison
sudo yum install zip
sudo yum install unzip

Install repo

mkdir ~/bin
curl > ~/bin/repo
chmod a+x ~/bin/repo

Fetch source

pick the branch you want

mkdir ~/aosp
cd ~/aosp
repo init -u -b android-6.0.0_r1
repo sync

Fetch and extract binaries for hammerhead

cd ~/aosp
ls *.tgz |xargs -n1 tar -zxvf
for i in extract*; do sed -n '/tail/p' $i | sed "s/\$0/$i/" | sh; done

Fetch and extract binaries for fugu

cd ~/aosp
ls *.tgz |xargs -n1 tar -zxvf 
rm *.tgz
for i in extract*.sh; do sed -n '/tail/p' $i | sed "s/\$0/$i/" | sh; done
rm extract*.sh

Setup envornment for hammerhead

cd ~/aosp
. build/
lunch 17

Setup envornment for fugu

cd ~/aosp
. build/
lunch 10


cd ~/aosp
export USE_CCACHE=1
export CCACHE_DIR=~/.ccache
prebuilts/misc/linux-x86/ccache/ccache -M 50G
make -j16

Download images for hammerhead

scp ${REMOTE_PATH}\{android-info.txt,boot.img,recovery.img,cache.img,userdata.img,system.img\} .

Download images for fugu

scp ${REMOTE_PATH}\{android-info.txt,boot.img,recovery.img,cache.img,userdata.img,system.img\} .

Flash images

fastboot flash boot boot.img 
fastboot flash cache cache.img 
fastboot flash recovery recovery.img 
fastboot flash system system.img 
fastboot flash userdata userdata.img 
fastboot reboot
CentOS 7 AOSP Building Guide
CentOS 7 AOSP Building Guide. GitHub Gist: instantly share code, notes, and snippets.
Android Dev

Nicholas Wong

Fullstack software engineer with strong background in computer science and extensive experience in software engineering and architecture. Studied in NYU, worked in Yahoo, Rakuten and Manulife.