back to the beginning

Building LineageOS 15.1 on Essential PH-1

Last updated: 2019-01-22

Instructions for LineageOS 16.

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 do choose to build it yourself, you can also install the Google apps at any time.

WARNING: Moving from stock Android to LineageOS (including builds from various sources!) 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 15.1 is still in development and some features are not working.

LineageOS features still not working (most notable for me):

To flash back to stock:

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).

Required resources:

Websites for information and resources:

Prerequisites and required software:

All instructions assume you are running Linux. These instructions are for Ubuntu with minimum version of 16.04.

  1. Prepare build environment
  2. 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 -d ~

    To add these tools to your path add the following to ~/.profile

    # add Android SDK platform tools to path
    if [ -d "$HOME/platform-tools" ] ; then

    Run the following command to update your shell:

    source ~/.profile

  3. Install the build tools
  4. Note that with Ubuntu 18.04 libesd0-dev is not available. Just delete the last item and install the rest of the tools.

    sudo apt install bc bison build-essential ccache curl flex g++-multilib gcc-multilib git gnupg gperf imagemagick lib32ncurses5-dev lib32readline-dev lib32z1-dev liblz4-tool libncurses5-dev libsdl1.2-dev libssl-dev libwxgtk3.0-dev libxml2 libxml2-utils lzop pngcrush rsync schedtool squashfs-tools xsltproc zip zlib1g-dev libesd0-dev

    Also install a Java Development Kit

    sudo apt install openjdk-8-jdk

    If you get a version error with java, change the active one to version 8:

    sudo update-alternatives --config java

  5. Download the git-repo tool
  6. mkdir -p ~/bin
    curl > ~/bin/repo
    chmod a+x ~/bin/repo

  7. Download the LineageOS repository
  8. Note: You can use a base directory somewhere else.

    mkdir -p ~/android/lineage
    cd ~/android/lineage
    repo init -u -b lineage-15.1
    repo sync
    source build/
    breakfast mata

    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.

  9. Configure jack and root
  10. jack is required for building android 8.1 and LineageOS 15.1.

    Run the following command from your shell and add it to ~/.bashrc so it is set up for future use.

    export ANDROID_JACK_VM_ARGS="-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx4G"

    If you want to build root into your LineageOS image then also run the following and also add it to ~./bashrc

    export WITH_SU=true
  11. Add the Muppets
  12. 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" />

Build LineageOS:

  1. Build commands:
  2. 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.

    cd ~/android/lineage
    repo sync [if on rebuilding you receive error try: repo sync --force-sync]
    source build/
    brunch mata

  3. Installation files
  4. Once you manage an error free build you can quickly go to the directory where your LineageOS image is located by typing this:

    cd $OUT

    In the folder there is is a file named 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.

Installing LineageOS

back to the beginning

Something need fixing? Contact me: