**HOW TO BUILD AOSP OREO FROM SOURCE**
Thanks To Dustin Rinne
Thanks To GOOGLE
Thanks To BEANSTOWN106
**1. Add Java**
sudo apt-get install openjdk-7-jdk
**2. Add Build Tools**
sudo apt-get install git-core
sudo apt-get install gnupg
sudo apt-get install flex
sudo apt-get install bison
sudo apt-get install gperf
sudo apt-get install build-essential
sudo apt-get install zip
sudo apt-get install curl
sudo apt-get install zlib1g-dev
sudo apt-get install gcc-multilib
sudo apt-get install g++-multilib
sudo apt-get install libc6-dev-i386
sudo apt-get install lib32ncurses5-dev
sudo apt-get install x11proto-core-dev
sudo apt-get install libx11-dev
sudo apt-get install lib32z-dev ccache
sudo apt-get install libgl1-mesa-dev
sudo apt-get install libxml2-utils
sudo apt-get install xsltproc
sudo apt-get install unzip
sudo apt-get install schedtool
**3. Add Repo Command**
NOTE: You Only have to do this Once
mkdir ~/bin && curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo && chmod a+x ~/bin/repo
**4. Add bin Folder to Path for Repo Command**
NOTE: You Only have to do this Once
sudo gedit .bashrc
export PATH=~/bin:$PATH <-(Add to the bottom of .bashrc save and close)
(After you do this close Terminal and re-open)
**5. Identify Yourself to the Repo**
NOTE: You Only have to do this Once
git config --global user.email "youremail@gmail.com"
git config --global user.name "yourname"
**6. Set Up Repo**
MAKE REPO SOURCE DIR
*For Google Source*
mkdir ~/AOSP (Or Any Name You Want)
*For Pure Nexus Source*
mkdir ~/PureNexus (Or Any Name You Want)
CHANGE DIR
cd ~/AOSP
or
cd ~/PureNexus
**7. Enable The Repo Source**
Google Source >--> repo init -u https://android.googlesource.com/platform/manifest -b android-6.0.1_r13
Pure Nexus Source >--> repo init -u https://github.com/PureNexusProject/manifest.git -b mm
Dirty Unicorns >--> repo init -u https://github.com/DirtyUnicorns/android_manifest.git -b m
**8. Sync The Repo**
repo sync
**9. Set Up ccache**
NOTE: You Only have to do this Once
First: Close then re-open the Terminal so you are back in home root dir
sudo gedit .bashrc
export USE_CCACHE=1 <- (Add to the bottom of .bashrc save and close)
(After you do this close Terminal and re-open)
CHANGE DIR
cd ~/AOSP
or
cd ~/PureNexus
prebuilts/misc/linux-x86/ccache/ccache -M 70G
(I use 70 gigs (this makes compiling a little faster)
**10. Install proprietary binaries for Google Source**
NOTE: You Only have to do this Once
https://developers.google.com/android/nexus/drivers
(Extract proprietary binaries from zip to root of AOSP or PureNexus folder and install)
bash extract-broadcom-shamu.sh
bash extract-moto-shamu.sh
bash extract-qcom-shamu.sh
**11. Build Environment Setup **
*For Google Source*
source build/envsetup.sh
*For Pure Nexus Source*
. build/envsetup.sh
**12. Choose Device**
*For Google Source*
lunch
*For Pure Nexus Source*
lunch
(I choose number 29 from menu for nexus_shamu-user)
**13. Build It**
*For Google Source*
make clean
make clobber
make -j16 otapackage
*For Pure Nexus Source*
make clean
make clobber
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 CPU's.
You may need to experiment to get the right blend of performance and stability during build!
**14. Find It**
Should be located here: /home/yourusername/yoursourcefolder/out/target/product/shamu
**********************************************************************************************************
*****UPDATED ON 5-05-16*****
Compile Android for Ubuntu 16.04 (Xenial Xerus) JDK7 Installation
This only applies to the x64, It will not work i386 version.
As of now OpenJDK7 is required to build most popular AOSP 6.0.x ROM Sources like,
Pure Nexus Project and Dirty Unicorn.
Instructions:
1) Remove all traces of Java:
sudo apt-get remove openjdk-* icedtea-* icedtea6-*
2) Add OpenJDK7 PPA & Fetch:
sudo add-apt-repository ppa:openjdk-r/ppa && sudo apt-get update
3) Install all available updates:
sudo apt-get upgrade && sudo apt-get dist-upgrade
6) Install OpenJDK7 and Android dependencies:
sudo apt-get install adb
sudo apt-get install fastboot
sudo apt-get install openjdk-7-jdk
sudo apt-get install git
sudo apt-get install ccache
sudo apt-get install automake
sudo apt-get install lzop
sudo apt-get install bison
sudo apt-get install gperf
sudo apt-get install build-essential
sudo apt-get install zip
sudo apt-get install curl
sudo apt-get install zlib1g-dev
sudo apt-get install zlib1g-dev:i386
sudo apt-get install g++-multilib
sudo apt-get install python-networkx
sudo apt-get install libxml2-utils
sudo apt-get install bzip2
sudo apt-get install libbz2-dev
sudo apt-get install libbz2-1.0
sudo apt-get install libghc-bzlib-dev
sudo apt-get install squashfs-tools
sudo apt-get install pngcrush
sudo apt-get install schedtool
sudo apt-get install dpkg-dev
sudo apt-get install liblz4-tool
sudo apt-get install make
sudo apt-get install optipng
sudo apt-get install maven
sudo apt-get install python-mako
sudo apt-get install python3-mako
sudo apt-get install python
sudo apt-get install python3
sudo apt-get install syslinux-utils
sudo apt-get install google-android-build-tools-installer
7) Remove unnecessary packages:
sudo apt-get autoremove
8) Make a user accessible folder, and add it to path:
mkdir ~/bin && echo "export PATH=~/bin:$PATH" >> ~/.bashrc
9) Enable CCACHE:
echo "export USE_CCACHE=1" >> ~/.bashrc
10) Restart Bash:
source ~/.bashrc
11) Configure Git:
git config --global user.name "Moe Doe"
git config --global user.email moedoe@example.com
12) Enable Repo and put it in local $PATH folder:
curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo && chmod a+x ~/bin/repo
13) Make a source folder for your ROM and initialize repo:
mkdir ~/android
cd ~/android
repo init -u urltorommanifest.git -b branchname
14) Sync Repo:
repo sync -j4 --force-sync
15) Set up to build :
prebuilts/misc/linux-x86/ccache/ccache -M 70G
(I use 70 gigs (this makes compiling a little faster)
. build/envsetup.sh
16) Choose here:
lunch
# from the menu choose the device you want to build for,
in pure nexus i choose 29 which is for shamu
17) Build the ROM:
make -j4 otapackage
# -j4 is a variable number, if you have an Intel processor,
take the number of cores and multiply by two.
18) Find the ROM:
out/target/product/romname.zip
19) Flash ROM & Enjoy