System Requirements
Arch Linux x86-64
Oxygen OS(extracted image or installed)
adb installed and drivers setup
non-root user
sudo setup for your user (you can install packages as root as a workaround)
40GB free storage
4GB+ ram
Required Packages
First off you're gonna want to make sure you're completely up to date and fetch the packages required to build, with the command below.
Then you're going to need to fetch some apps from the AUR. First add their GPG key.
Now you can fetch them with a tool like yaourt or manually install the two packages.
lib32-ncurses5-compat-libs
ncurses5-compat-libs
Setting up build enviroment and syncing
This part will assume you're building in a folder called "android" in your home directory, and requires the above packages to be installed.
Run these commands to install repo in a folder called "bin" in your home directory. Then for a single terminal session set the new "bin" folder as a binary folder in bash.
Make a folder to store and build android, then enter it.
Setup a virtual python 2.7 enviroment in your "android" folder as repo doesn't work with 3+.
Now it's time to sync the sourcecode with your python 2.7 and repo setup. The following code will sync CAF android 6.0.1 from oneplus. The "4" can be removed or replaced with any whole number becides zero depending on your connection speed. You may omit the "-c" if you have problems syncing or need more than the defined branches.
You can also use my repo if you prefer. I'm working on improving the mess oneplus gave us.
Compile Your Build
Assuming your in your virtual python 2.7 and followed the first part of the guide, set openjdk 7 as your active java.
Fix broken provided glib.
If you're rooted and have adb installed, you may want to fetch your prebuilt files from the latest marshallow Oxygen OS or caf based rom. You may also extract them from a Oxygen OS system image but build will not complete without prebuilts.
Intialize the enviroment and select a platform. You may build "msm8996-userdebug" or "msm8996-user".
Time to build! Find the number of threads on your cpu and set 1-2x that as "x". You may also omit "OTAackage" if you prefer to have fastboot/twrp flashable images instead of a zip, (system.img, boot.img, etc).
Your compiled files and flashable zip or images will be located in "~/android/out/target/product/msm8996".
How to rebuild!
Cd into directory, sync repo, and setup enviroment.
Clean the out directory.
Build. (setup to make a recovery flashable zip with a 8 thread processor.)
Arch Linux x86-64
Oxygen OS(extracted image or installed)
adb installed and drivers setup
non-root user
sudo setup for your user (you can install packages as root as a workaround)
40GB free storage
4GB+ ram
Required Packages
First off you're gonna want to make sure you're completely up to date and fetch the packages required to build, with the command below.
Code:
#sudo pacman -Syyu gcc-multilib git gnupg flex bison gperf sdl wxgtk squashfs-tools curl ncurses zlib schedtool perl-switch zip unzip libxslt python2-virtualenv bc lib32-zlib lib32-ncurses lib32-readline jdk7-openjdk rsync maven repo
Code:
#gpg --keyserver pgp.mit.edu --recv-keys C52048C0C0748FEE227D47A2702353E0F7E48EDB
lib32-ncurses5-compat-libs
ncurses5-compat-libs
Code:
#yaourt --aur lib32-ncurses5-compat-libs ncurses5-compat-libs
This part will assume you're building in a folder called "android" in your home directory, and requires the above packages to be installed.
Run these commands to install repo in a folder called "bin" in your home directory. Then for a single terminal session set the new "bin" folder as a binary folder in bash.
Code:
#mkdir ~/bin
#export PATH=~/bin:$PATH
#curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
#chmod a+x ~/bin/repo
Code:
#mkdir ~/android
#cd ~/android
Code:
#virtualenv2 venv
#ln -s /usr/lib/python2.7/* ~/android/venv/lib/python2.7/
#source venv/bin/activate
Code:
#repo init -u https://github.com/OnePlusOSS/android.git -b oneplus3T/6.0.1
#repo sync -j4 -c
Code:
#repo init -u https://github.com/droidman/android.git -b oneplus3T/6.0.1
#repo sync -j4 -c
Assuming your in your virtual python 2.7 and followed the first part of the guide, set openjdk 7 as your active java.
Code:
#export JAVA_HOME=/usr/lib/jvm/java-7-openjdk
Code:
cp /usr/bin/ld.gold prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8/x86_64-linux/bin/ld
Code:
#cp ~/android/.repo/manifests/pull_library.sh ~/android/pull.sh
#sh pull.sh
Code:
#source build/envsetup.sh
#lunch msm8996-userdebug
Code:
#make -jx OTApackage
How to rebuild!
Cd into directory, sync repo, and setup enviroment.
Code:
#export PATH=~/bin:$PATH
#export JAVA_HOME=/usr/lib/jvm/java-7-openjdk
#cd ~/android
#source venv/bin/activate
#repo sync -j4 -c
#source build/envsetup.sh
#lunch msm8996-userdebug
Code:
#make clobber
Code:
#make -j16 otapackage
Last edited: