[Nexus 6  General] Scott:
Building AOSP for the Nexus 6!

I want to give thanks to [MENTION=1050103]sykopompos[/MENTION] and [MENTION=3667193]GROGG88[/MENTION]. This was pretty much a concerted effort between all of us!​

Preface

This is to help you learn to build, for other developers to share knowledge, for you to ask questions, etc. The main focus is not the ROM but it is in post #2 if you want to check out out!

I built this guide do to lack of 100% clear / easy resources I could not find on the net. The Google AOSP page made it seem much more difficult than it needed to be.

The intent of this guide is to streamline the process of setting up for and building AOSP!

Feel free to ask any questions about the build process. Please do not ask questions about Ubuntu / Linux!

Check out some basic edits to source in Post #2

This guide assumes the following

Have Ubuntu 14.04 setup, fully operation, and up to date. Hard Machine or Virtual, makes no difference. Must meet the minimum specs for compiling. Info from Google HERE

Understand terminal command line entry as this is all command line processes.

You are not here to ask for help with Linux, only the Android build process!

If you want to try the ROM then I have the latest build of Lollipop in this thread HERE!

Lets Begin!

Add Java

sudo apt-get install openjdk-7-jdk

Add Build tools (Adds the required packages at the time of this posting)

sudo apt-get install git-core gnupg flex bison gperf build-essential \
zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 \
lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev ccache \
libgl1-mesa-dev libxml2-utils xsltproc unzip

Add Repo command (Syncs Google Repository with your local machine)

mkdir ~/bin && curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo && chmod a+x ~/bin/repo

Add bin folder to path for repo command (After you do this close Terminal and re-open to institute changes (easy way))

sudo gedit .bashrc
export PATH=~/bin:$PATH <-(add to end of bashrc)

Identify Yourself to the Repo (One day you may make commits so think about that when choosing your info!)

git config --global user.email "you@youremail.com"
git config --global user.name "yourpreferredusername"

Sync Repo (Download source... Sit back and grab a pop and a sandwich...)

mkdir ~/AOSP
cd ~/AOSP
repo init -u https://android.googlesource.com/platform/manifest -b android-6.0.1_r10
repo sync

Note: I use AOSP as my directory name. You can use what you want. You could use "aosp" or "Source" or "android" or "whateveryoulike"

Set up ccache (this makes subsequent compiling much faster!)

First: Close then re-open the terminal so you are in the home root

sudo gedit .bashrc
export USE_CCACHE=1 <-Append that line to .bashrc then save and close
cd AOSP
prebuilts/misc/linux-x86/ccache/ccache -M 25G <-I use 25 gigs but you can change that value to any size you feel appropriate)

Install proprietary binaries (Needed for things like GPS and Bluetooth, they are not Open Source like Android) (Install proprietary binaries from here in the root of AOSP folder (or whatever you called yours))

[url]https://developers.google.com/android/nexus/drivers[/url]

Run envsetup.sh

source build/envsetup.sh

Choose Device

lunch

Build it!

make -j16 otapackage

Note: using -j16 means 16 worker threads. This is fine if you have 8 logical CPU's so you may need to adjust that to a smaller or larger number if you have more or less Logical CPU's. Example: I have an i7 K edition Haswell so I have 8 logical cores; so I build with -j16. If you have an i5 quad core CPU which is 4 logical cores then you may want to consider -j8 as the set number of worker threads. Oddly enough Google actually recommends 3 to 4 times the number of logical CPU's. When I do that I have nothing but build crashes. You may need to experiment to get the right blend of performance and stability during build!

Find it

Should be located here: /home/yourusername/AOSP/out/target/product/shamu

Congrats!

Your know among the elite enthusiast that can build from source! Pat yourself on the back!

Change Log

1/10/2016

Updated guide to reflect Android 6.0.1 repository

Updated list of tools to install

3/19/2015

Updated guide to reflect Android 5.1.0 repository

Fixed Youtube, Net flix DRM play back issue. Thanks to [MENTION=1050103]sykopompos[/MENTION] for pointing me to [MENTION=4238916]ayysir[/MENTION] git hub for the fix by [MENTION=4395895]BeansTown106[/MENTION]

1/17/2015

Added ccache instructions

Listed changes for AOSP Browser to not F/C on settings

12/14/2014

Initial Release