[Sony Xperia E3] rmnhg:
Hello there!

Many of you want to get a nougat working rom for our Xperia E3. We have kernel sources, vendor files, device... So if you wanna try to make the rom this guide is for you.

Prerequisites

64 bit computer with 64 bit Linux OS installed (or virtual machine)

At least 4gb of RAM and about 100GB of free storage (more if you enable ccache)

Much patience (the process will be long)

Getting started

Android SDK

You can setup android SDK by running

sudo apt-get install adb fastboot

Installing required packages

For that you can follow the steps on https://wiki.lineageos.org/devices/nicki/build#install-the-build-packages

Setting up directories

Create a folder in which android source will be downloaded

mkdir -p ~/android/lineage

Note: "~/android/lineage" is an example, you can create whatever folder you want, but in the next steps be sure you change paths.

Install the repo command

Like before you only need to run

sudo apt-get install repo

Initialize the LineageOS source repository

Now we can start to prepare sources download. Enter the following to initialize the repository:

cd ~/android/lineage
repo init -u https://github.com/LineageOS/android.git -b cm-14.1

And we need to prepare local manifests:

git clone https://github.com/rmnhg/local_manifests.git -b cm-14.1 .repo/local_manifests

Download the source code

To start the download of the source code to your computer:

repo sync

Note: This process will be long (over 30gb are going to be downloaded) and can be longer if your connection is slow so be patience.

Prepare the device-specific code

After the source downloads, ensure you’re in the root of the source code, then type:

source build/envsetup.sh
breakfast flamingo

This will prepare flamingo sources to be compiled.

(Optional) Turn on caching to speed up build

You can setup ccache if you want to speed up subsequent builds by running:

export USE_CCACHE=1

and adding that line to your ~/.bashrc file. Then, specify the maximum amount of disk space you want ccache to use by typing this from the top of your Android tree:

prebuilts/misc/linux-x86/ccache/ccache -M 50G

where 50G corresponds to 50GB of cache. This needs to be run once. Anywhere from 25GB-100GB will result in very noticeably increased build speeds (for instance, a typical 1hr build time can be reduced to 20min). If you’re only building for one device, 25GB-50GB is fine. If you plan to build for several devices that do not share the same kernel source, aim for 75GB-100GB. This space will be permanently occupied on your drive, so take this into consideration. See more information about ccache on Google’s Android build environment initialization page.

You can also enable the optional ccache compression. While this may involve a tiny performance slowdown, it increases the number of files that fit in the cache. To enable it, run:

export CCACHE_COMPRESS=1

or add that line to your ~/.bashrc file.

You can also change ccache files path by running:

export CCACHE_DIR=[COLOR="YellowGreen"]<path of your choice>[/COLOR]

or add that line to your ~/.bashrc file.

Configure jack

Jack is the new Java compiler used when building LineageOS 14.1. It is known to run out of memory - a simple fix is to run this command:

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

Adding that command to your ~/.bashrc file will automatically configure Jack to allocate a sufficient amount of memory.

Start building

Now you can start compiling LineageOS. You can start running:

croot
brunch flamingo

NOTE: If terminal tells you "croot/breakfast: command not found" just run

source build/envsetup.sh

and try again.

NOTE 2: If you receive the error "SSL error when connecting to the Jack server. Try 'jack-diagnose'" check this post for a fix.

This will finally compile LineageOS for flamingo :good:

If it finishes succesfully, you will have in out/target/product/flamingo two files:

recovery.img, which is the LineageOS recovery image.

lineage-14.1-<date>-UNOFFICIAL-flamingo.zip, which is the LineageOS installer package.

You have to flash ano and copy installer zip into the phone.

Then reboot into recovery (Power+Vol down) and install this zip.

You can flash flash recovery running

sudo fastboot -s 256M flash recovery <pathtorecovery.img>

Thanks to @infus for his trick (-s 256M) with fastboot commands for big images.

I hope this guide has been useful for you ;)

PD: If you want to discuss about development of this ROM, you can join our Telegram group here.

Join now​