First, I create a specific user to build Android :
useradd builder passwd builder su - builder
Download the download tool :
mkdir -p ~/bin curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo chmod a+x ~/bin/repo export PATH=~/bin:$PATH
Download the repo :
mkdir -p ~/android/source cd ~/android/source git config --global user.email "you@example.com" git config --global user.name "Your Name" repo init -u https://android.googlesource.com/platform/manifest -b android-4.4_r1
Download the source (very long … ) :
repo sync
Prepare the build :
source build/envsetup.sh lunch aosp_arm-userdebug export PATH=/usr/java/jdk1.6.0_45/bin/:$PATH
In the file « build/core/main.mk » remove the test which want a specific version of GNU make. This is not required. However the JDK 1.6 is required !
Start the build (less than 2 hours …) :
make
If it worked you just need to run the emulator !
DISPLAY=:0 emulator
You may need to share your standard user’s DISPLAY with the builder user :
xhost +SI:localuser:builder
Or the Android kernel in command line :
emulator -sysdir ./out/target/product/generic/ -kernel ./prebuilts/qemu-kernel/arm/kernel-qemu-armv7 -no-window -show-kernel -shell