• If you are experiencing issues logging in, we moved to a new and more secure software and older account passwords were not able to be migrated. We recommend trying to reset your password, then contacting us if there are issues.
  • Nearly done! Migration cleanup is mostly done. There are a small number of issues left that we continue to work on, but all the heavy lifting is done. We still would love to hear feedback over at this thread and also check out the new XDA app! Thanks and we hope you enjoy the new forums, and thanks for your support of XDA <3

[GUIDE] Building Pure Nexus

nathanchance

Senior Recognized Developer / Recognized Contribut
Jul 22, 2015
13,748
49,942
0
25
Mesa, AZ
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://forum.xda-developers.com/chef-central/android/guide-how-to-build-rom-google-cloud-t3360430

1. Set up your environment

1. Automatically

Code:
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
Code:
sudo apt-get update
sudo apt-get install openjdk-8-jdk
sudo apt-get install openjdk-8-jre
2. Install other build tools
Code:
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:
Code:
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:
Code:
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:
Code:
git config --global user.name "Your Name"
git config --global user.email "[email protected]"
3. Download the source

First, before downloading the source, create a folder for the source and move into it.
Code:
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):
Code:
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:
  1. Go to your ROM's Github (e.g. http://github.com/PureNexusProject)
  2. Search for a manifest (usually called manifest or android_manifest).
  3. Go into the repo and make sure you are in the right branch (located right under the Commits tab).
  4. Go into the README and search for a repo init command. If one exists, copy and paste it into the terminal and hit enter.
  5. If one does not exist, you can make one with this formula:
    Code:
    repo init -u <url_of_manifest_repo>.git -b <branch_you_want_to_build>
    For example:
    Code:
    repo init -u http://github.com/PureNexusProject/manifest.git -b android-7.1
  6. After the repo has been initialized, run this command to download the source:
    Code:
    repo sync --force-sync
  7. 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:
  1. Open up your .bashrc file in your home directory using a text editor or nano and append this to the end of it:
    Code:
    export USE_CCACHE=1
    Then type:
    Code:
    source ~/.bashrc
  2. 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:
    Code:
    prebuilts/misc/linux-x86/ccache/ccache -M #G
    Use this one if you used the automatic method of set up in section 1:
    Code:
    ccache -M #G

After that, it's time to build!
Code:
. 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:
Code:
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:
Code:
export USE_NINJA=false
Then type this
Code:
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
 

Fralund

Senior Member
May 28, 2012
73
13
0
Building PureNexus Nougat

Ubuntu is what Google recommend for Android AOSP development. See you http://source.android.com/source/requirements.html

Sent from my Nexus 6P using XDA-Developers mobile app

XDA:DevDB Information
Building Pure Experience Nougat, ROM for the Huawei Nexus 6P

Contributors
Fralund
ROM OS Version: 2.3.x Gingerbread

Version Information
Status: Testing

Created 2016-09-15
Last Updated 2016-09-15
 

AzraelsKiss

Elite Member
Apr 16, 2011
1,139
1,451
113
Owenton, KY
  • Like
Reactions: Samuel Holland

laxattack

Senior Member
Dec 28, 2009
291
61
28
For those of you that are building PN Nougat, are some minor customizations implemented yet? I ask since I am compiling a copy for myself right now.
 

AzraelsKiss

Elite Member
Apr 16, 2011
1,139
1,451
113
Owenton, KY

kipue

Elite Member
Sep 3, 2009
1,942
629
0
Hong Kong
Somehow haven't been able to get my virtual machine to compile PN over the weekend (really need to convert my old laptop into a Linux only machine, that's for another day).
So since I want my first N rom to be PN on my N6P and am waiting patiently for it, that means that my Samsung Tab S 8.4 is running Nougat first
Go figure!
GO PN
 

aalupatti

Elite Member
Feb 20, 2011
2,871
700
0
For those of you that are building PN Nougat, are some minor customizations implemented yet? I ask since I am compiling a copy for myself right now.
Advanced reboot menu, ADB over network, and stock nav bar tuner and night mode re-enabled are the major ones right now.
What @nathanchance said. But I was surprised to find that after restoring all my previous apps, it works very well and very fast. Definitely faster than 6 builds. Too early to tell
Substratum works with no issues.
Could not get some apps to work like gmd gestures, etc . Not the roms fault but the apps have to be updated for nougat support.

Somehow haven't been able to get my virtual machine to compile PN over the weekend (really need to convert my old laptop into a Linux only machine, that's for another day).
So since I want my first N rom to be PN on my N6P and am waiting patiently for it, that means that my Samsung Tab S 8.4 is running Nougat first
Go figure!
GO PN
With some support from this thread, I had no issues compiling... ( I am a super newbie )
 

kipue

Elite Member
Sep 3, 2009
1,942
629
0
Hong Kong
What @nathanchance said. [...]

With some support from this thread, I had no issues compiling... ( I am a super newbie )
Yeah something is wrong with my environnement, the repo sync does not even complete.
I suspect is that I need to give my VM more room to breeze RAM wise.
Anyhow, will see that on my side, that's probably quite OP already.
Thanks ^^
 

jmtjr278

Elite Member
Mar 8, 2012
1,002
548
113
Hey, @nathanchance I'm pretty certain you are running Ubuntu on a VM, right? If so can you share how much memory and storage you have allocated to the VM? I didn't allocate enough space I don't think. Thanks!

I'm attempting to repo sync and it had failed a few times. Could this be due to lack of room on partition? I followed your guide.

Sent from my Nexus 6P using Tapatalk
 
Last edited:

nathanchance

Senior Recognized Developer / Recognized Contribut
Jul 22, 2015
13,748
49,942
0
25
Mesa, AZ
Hey, @nathanchance I'm pretty certain you are running Ubuntu on a VM, right? If so can you share how much memory and storage you have allocated to the VM? I didn't allocate enough space I don't think. Thanks!
No I have a server I build on but I would say you should allocate half of your computer's memory at a minimum.

Sent from my Nexus 6P using XDA Labs
 

jmtjr278

Elite Member
Mar 8, 2012
1,002
548
113
No I have a server I build on but I would say you should allocate half of your computer's memory at a minimum.

Sent from my Nexus 6P using XDA Labs
Thanks. I edited my post with another question. Could you have a peek for me please?

Sent from my Nexus 6P using Tapatalk
 

kantjer

Inactive Recognized Contributor
Dec 11, 2010
12,393
29,848
113
www.androidfilehost.com
Hey, @nathanchance I'm pretty certain you are running Ubuntu on a VM, right? If so can you share how much memory and storage you have allocated to the VM? I didn't allocate enough space I don't think. Thanks!

I'm attempting to repo sync and it had failed a few times. Could this be due to lack of room on partition? I followed your guide.

Sent from my Nexus 6P using Tapatalk
I haven't been running Linux under VM for more then a year now but back then 8 GB memory allocated to VM was needed to build (I know some say 4 GB should do the trick but it never worded fine for me).
Disk space I would suggest at least 100-150 GB, If you have the space allocated 200-250GB, that will give you space for ccache and a custom kernel if you like.
 

jmtjr278

Elite Member
Mar 8, 2012
1,002
548
113
I haven't been running Linux under VM for more then a year now but back then 8 GB memory allocated to VM was needed to build (I know some say 4 GB should do the trick but it never worded fine for me).
Disk space I would suggest at least 100-150 GB, If you have the space allocated 200-250GB, that will give you space for ccache and a custom kernel if you like.
Thanks @kantjer I have reallocated the space to 250gb and the memory to 4gb. That's the most I can use and run the VM. I will attempt repo sync again. I appreciate there help! Have been here a while and never attempted this. Wish me luck!

Sent from my Nexus 6P using Tapatalk