back to the beginning
Last updated: 2019-01-22 (Migrating instructions from 15.1 -> 16 (things may break))
This page is for building LineageOS 16 (I recommend staying on 15.1 for now.)
On 2019-01-16 the code still had issues: see log
LineageOS 15.1 build instructions.
LineageOS is an alternate version of the Android operating system for your phone. Rather than building it yourself the first time, I recommend you use the image provided by invisblek). However, his image includes Google apps by default. If you want to experience life without Google's apps you will have to build LineageOS yourself. If you want to use Google apps, then use get LineageOS from here. You can still use these instructions to install.
WARNING: Moving from stock Android to LineageOS (including builds from various sources that use different build keys!) or back again will require restoring your phone to factory settings.
YOU WILL LOSE ALL YOUR DATA. YOU MUST COPY ANYTHING YOU VALUE OFF OF THE PHONE.
LineageOS features still not working (most notable for me):
If you want to remove LineageOS and return to stock Android follow the instructions here:
You will lose all your data so make a backup beforehand (see step for that below).
A quality USB cable. The manufacturer recommends you do not use the cable provided with your phone for anything other than charging.
This will take a lot of disk space. A repo sync and build requires 188 GB.
Optionally, you can download my build of LineageOS with no Google Apps.
invisiblek's installation notes These have been updated and contain a lot of useful information.
All instructions assume you are running Linux. These instructions are for Ubuntu with minimum version of 16.04.
You will need to install proper ADB (Android Debugging Bridge) tools for your platform. For Ubuntu 18.04 this is as simple as running
sudo apt install adb
If your distribution provides out of date tools you can obtain them directly from Google.
Install the tools from Google:
unzip platform-tools-latest-linux.zip -d ~
# add Android SDK platform tools to path
if [ -d "$HOME/platform-tools" ] ; then
Run the following command to update your shell:
mkdir -p ~/bin
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
Note: You can use a base directory somewhere else.
mkdir -p ~/android/lineage
repo init -u https://github.com/LineageOS/android.git -b lineage-16.0
Note: mata is the code name for the Essential PH-1. If you see other tutorials for building LineageOS you can follow their instructions but use mata where necessary. I suggest you look up another tutorial since I am leaving out instructions on using ccache. Apparently it can speed up your build but I did not want to commit even more disk space to the project. My desktop has 32 GB of RAM and I felt the build was fast enough.
If you want to build root into your LineageOS image then also run the following and also add it to ~./bashrc
We will use the muppets repository to bring in all the extra bits required for the mata build rather than obtain them from the phone itself.
Add the following bit to the file located at ~/android/lineage/.repo/local_manifests/roomservice.xml
<project name="TheMuppets/proprietary_vendor_essential" path="vendor/essential" />
In the future consider all of the above are things you don't have to do next time. Anytime you want to build just start here. You only have to run repo sync when you want to make sure you have the lastest code. We need to run it now to pull stuff in from the Muppets.
repo sync [if on rebuilding you receive error try: repo sync --force-sync]
Once you manage an error free build you can quickly go to the directory where your LineageOS image is located by typing this:
In the folder there is is a file named lineage-16.0-20190116-UNOFFICIAL-mata.zip. The name will be based on the date you built LineageOS.
There is also a boot.img that you can use to install Magisk if you want to gain root that way at a later time.
back to the beginning
Something need fixing? Contact me: