[Nexus 6  General] fhem:
Building AOSP for the Nexus 6 - Continued!​

Scott is no longer working with the N6 and he has graciously allowed me to continue his thread . We all owe [MENTION=426561]scrosler[/MENTION] a special THANKS for his work on the original thread. Better yet please go buy him a beer!! I also want to personally thank all who contributed to the original thread. You all make it work!!

​

Preface

1. I want to start by saying that I am still a relative newb. I built my first aosp rom for my N9 using the the guide from the original thread and followed up with one for my N6. I hope that by moving this thread forward we can continue to help others get started while we continue our own learning.

2. All questions concerning the build process and setup are welcome. They may not all get answered but please ask.

This guide continuation assumes the following:

1. You have read the original thread's OP and scanned the remainder of that thread before posting here.

2. To get things started you can test a rom built from android-5.1.1_r14. Get rom below. Vendor blobs updated from here and include the updated LYZ28E blobs. I also added some missing build props.

3. I am also linking the github source for the rom. You can build your own. Get github source below.

4. I hope to add a short get started github tut in OP#2 and add a vendor folder setup discussion in OP#3. I'm still trying to figure out how [MENTION=1050103]sykopompos[/MENTION] did his. All help on this subject is welcome.

FYI TO ALL!!! All my testing is on USA Verizon netwok.

LINK TO ORIGINAL THREAD OP

Get ROM HERE

Get GIT SOURCE HERE

==========================================================================================================

The following copied from original OP with some minor editing.

This guide assumes the following

Have Ubuntu 14.04 or equivalent 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.

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 gnupg flex bison gperf build-essential \
zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev \
libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 \
libgl1-mesa-dev g++-multilib mingw32 tofrodos \
python-markdown libxml2-utils xsltproc zlib1g-dev:i386

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-5.1.1_r14
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)

fhem Alternate ccache setup.

Install ccache using package manager (I use synaptic)

set ccache size - One ccache for all directories.

ccache -M 35G (I use 35 gigs but you can change that value to any size you feel appropriate)

I do not edit my .bashrc I use the following before my final make command. See Readme Build It

You can choose to use or not use ccache for any build/operation from any directory.

export USE_CCACHE=1

ccache manual

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))

https://developers.google.com/android/nexus/drivers

Run envsetup.sh

source build/envsetup.sh

Choose Device

lunch aosp_shamu-userdebug

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!

If you use

make -j `getconf _NPROCESSORS_ONLN` otapackage

it may take a little longer but it won't crash.

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!