[Nexus 6P Android Development] nathanchance:
Introduction

Alright guys, there was a lot of talk about building Pure Nexus in the main thread, which was a little irritating for some so now we get our own thread! In this post, I will be giving you some resources to go over in order to help you with compilation. If you have any questions, just ask!

If you compile successfully, feel free to share your accomplishment and your computer specs :)

Compilation Guide

This is available on my Github, where it may be a little more up to date.

0. Getting started

In this guide, I will go over how to build Pure Nexus on your Linux machine. This particular tutorial will focus on Ubuntu 16.04 (Mint 18 is also good) since that is what Google recommends but this should work with any version of Linux (here are steps for setup with Arch Linux, which will cover step 1); it does need to be 64-bit however. I will leave the installation of that up to you, Google is a wonderful resource. If you don't have a good computer but still want to build, check out this thread on XDA: http://xdaforums.com/chef-central/android/guide-how-to-build-rom-google-cloud-t3360430

1. Set up your environment

1. Automatically

sudo apt-get install git-core
git clone https://github.com/akhilnarang/scripts
cd scripts
ls
bash <script-name>

<script-name> should be one of the scripts in the folder for your particular architecture.

2. Manually

1. Install Java 8

sudo apt-get update
sudo apt-get install openjdk-8-jdk
sudo apt-get install openjdk-8-jre

2. Install other build tools

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

2. Configure repo and git

If you have any problems with the below commands, try running as root:

sudo -s

Git is an open source version control system which is incredibly robust for tracking changes across repositories. Repo is Google's tool for working with Git in the context of Android. More reading if you are interested: https://source.android.com/source/developing.html

Run these commands to get repo working (only do this if you did the manual set up method above:

mkdir ~/bin
PATH=~/bin:$PATH
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo

Run these commands to get git working:

git config --global user.name "Your Name"
git config --global user.email "you@example.com"

3. Download the source

First, before downloading the source, create a folder for the source and move into it.

mkdir ~/<foldername> (eg. mkdir ~/PN or ~/PureNexus)
cd ~/<foldername>

Then, we need to grab the manifest and sync down the repositories. Here are the commands to do this for Pure Nexus for Nougat (make sure you are in the source folder you made above):

repo init -u https://github.com/PureNexusProject/manifest.git -b android-7.1
repo sync --force-sync

NOTE: The value for the -b flag, "android-7.1", may change; you will need to go to the manifest's page and see what the branch currently is.

Here is the process generally for other ROMs:

When you go to build a ROM, you must download its source. All, if not most, ROMs will have their source code available on Github. To properly download the source, follow these steps:

Go to your ROM's Github (e.g. http://github.com/PureNexusProject)

Search for a manifest (usually called manifest or android_manifest).

Go into the repo and make sure you are in the right branch (located right under the Commits tab).

Go into the README and search for a repo init command. If one exists, copy and paste it into the terminal and hit enter.

If one does not exist, you can make one with this formula:

repo init -u <url_of_manifest_repo>.git -b <branch_you_want_to_build>

For example:

repo init -u http://github.com/PureNexusProject/manifest.git -b android-7.1

After the repo has been initialized, run this command to download the source:

repo sync --force-sync

This process can take a while depending on your internet connection.

4. Build it!

At this point, it'd be a good idea to set up ccache. ccache is a compiler cache, it stores previously compiled files in a directory and pulls from that instead of recompiling if nothing has changed. This speeds up compilation a LOT. If you want to use it, follow the below steps:

Open up your .bashrc file in your home directory using a text editor or nano and append this to the end of it:

export USE_CCACHE=1

Then type:

source ~/.bashrc

After that, run one of the below command (replacing the # with how many GBs of ccache you want, 50 is recommended)

Use this one if you used the manual method of set up in section 1:

prebuilts/misc/linux-x86/ccache/ccache -M #G

Use this one if you used the automatic method of set up in section 1:

ccache -M #G

After that, it's time to build!

. build/envsetup.sh
breakfast angler
mka bacon

After that, your computer will build the flashable zip file and if you see something that says make completed, you've done it!

Any time that you want to rebuild, type the following commands:

repo sync --force-sync
. build/envsetup.sh
breakfast angler
mka clobber
mka bacon

I also have a script to do this on my Github here

Frequently Asked Questions

1.1 Q: I got an error, what do I do??

1.1 A: Well to start, if it is anything with Ninja, I would go ahead and disable it. You can add this to your .bashrc file:

export USE_NINJA=false

Then type this

source ~/.bashrc
. build/envsetup.sh
breakfast angler
mka clobber
mka bacon

If it is saying you ran out of memory, follow this post.

If it isn't Ninja related, check out @AzraelsKiss's post here, where he has documented a few common issues. If none of those apply, post here with a detailed list of what you have done and we will do our best to help you.

1.2 Q: Can you guys share your personal builds?

1.2 A: No, personal builds are just that: personal. Beans releases whenever he feels that the release is ready for the masses and if a bunch of personal builds are floating around, that tarnishes the Pure Nexus name. We are more than happy to help get you up and running but we will not be sharing our builds. Thanks for understanding!

MOD EDIT - THIS IS A DEVELOPER DISCUSSION. NOT FOR ORDINARY USERS. There is No Rom for you to Flash. Nor will there be any support for you. Any ETA or other NON-DEVELOPMENT posts here will be removed without warning!

XDA:DevDB Information

A Guide to Building Pure Nexus for Nougat, ROM for the Huawei Nexus 6P

Contributors

nathanchance, BeansTown106

Source Code: https://github.com/PureNexusProject

ROM OS Version: 7.x Nougat

ROM Kernel: Linux 3.10.x

Based On: AOSP

Version Information

Status: Stable

Created 2016-09-15

Last Updated 2017-01-15