###Initializing the environment
[Hint: This command updates the Ubuntu Packages List (Install Listing) and install the required version of Java]
$ sudo apt-get install openjdk-8-jdk
Let that install and then proceed. More copy and paste:
[Hint: Running this command installs the other required packages to build android]
$ sudo apt-get update && sudo apt-get install git ccache automake lzop bison gperf build-essential zip curl zlib1g-dev zlib1g-dev:i386 g++-multilib python-networkx libxml2-utils bzip2 libbz2-dev libbz2-1.0 libghc-bzlib-dev squashfs-tools pngcrush schedtool dpkg-dev liblz4-tool make optipng maven bc openjdk-8-jre openjdk-8-jdk pngquant imagemagick yasm libssl-dev
###Getting the Source
Making required directories Obtaining the repo binary Adding repo binary to your path Giving the repo binary proper permissions Initializing an empty repo Syncing the repo Alright, so now we’re getting there. I have outlined the basics of what we’re about to do and broke them down as I know them. This is all pretty much going to be copy/paste so it’ll be fairly difficult to screw this up :) Make directory for the repo binary
$ mkdir -p ~/bin
Add directory for the repo binary to its path
$ echo "export PATH=~/bin:$PATH" >> ~/.bashrc
$ source .bashrc
Downloading repo binary and placing it in the proper directory
$ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
Giving the repo binary the proper permissions
$ chmod a+x ~/bin/repo
Initializing the sdhz150 repo and downloading the manifest
$ repo init -u git://github.com/xiaobai0324/LineageOS.git -b cm-14.1
Syncing the source
[Hint: This might take a long time as the source is about 13GB+]
$ repo sync -j4 -f --no-clone-bundle
###Setting Up CCache
CCache is a method of utilizing a specified storage space to speed up building. It can be referred to as the same caching your android device does to speed up application and system boot times. In this case, CCache will help build sdhz150 faster than standard build times (Able to cut-down 50% of time taken to build).
To set up CCache, follow the following:
$ echo "export USE_CCACHE=1" >> ~/.bashrc
$ ~/sdhz150/prebuilts/misc/linux-x86/ccache/ccache -M 50G
$ source .bashrc
-M 50G The number before the letter G at the end specifies the amount of space CCache can use in your storage unit. As such, ensure that not too much of space is specified as this might result in unexpected errors although, the more storage you have, its recommended to have more CCache as it will increase the build times. Most efficient build systems are able to utilize CCache to about 120G or more.
###To build sdhz150
$ cd ~/sdhz150
$ . build/envsetup.sh
$ breakfast "device name"
$ brunch "device name"
or make is all one line.
$ . build/envsetup.sh && breakfast "device name" && brunch "device name"
Obtaining the zip created from the build process
To get the zip file that has been built, navigate to the following directory and find for the zip file:
$ cd ~/sdhz150/out/target/product/
If you found it, then congratulations! If you didn't, try retrying the build process but before doing so, ensure you do the following to make sure your next build is clean;
$ cd ~/sdhz150 && make clean && repo sync -j 16