Creating a Custom ROM for the LeEco Le 2 Pro X620 Part 1

Creating a Custom ROM for the LeEco Le 2 Pro X620 Part 1


Creating a TWRP flashable Stock ROM

In my previous post I showed how to use SuperRs Android Kitchen to create a Custom ROM based around CyanogenMod 14.1. Having CM14.1 as a base makes things nice and easy, but unfortunately ROM creation based on OEM platforms often comes with a number of difficulties.

In this post I will provide an overview of how to start creating a ROM for the LeEco Le 2 Pro X620. In this case we will start by creating a TWRP flashable ROM from the Stock ROM image, which gives us a good starting point for further customisation.

I chose this device as the hardware offers superb price/performance. Sadly, the EUI ROMs that are shipped with LeEco devices are pretty dire and heavily tailored for the Chinese market. The Custom ROM scene for this mobile is also fairly poor from a Western perspective, so it makes for an interesting (and more challenging) target.

Setting up the Kitchen

For this tutorial we will start out with an installation of Ubuntu 16.04 and install SuperRs kitchen on top. As I have already outlined this process in my previous post I will not re-iterate it here. Following the Pre-requisites and Installing the Kitchen sections of that post will provide us with the starting point we need to proceed.

Downloads

We will start the process with the latest Stock ROM for the LeEco Le 2 X620, which at the time of writing is 18S:
5.8.018S

We also need a custom version of the update-binary for LeEco devices:
update-binary

Setting up a Project

In the Kitchen, Create a new project.

I called mine:
Le2X620Stock018S

Copy the 018S zip file that you previously downloaded and place it into the relevant directory:
android/superrs-kitchen/superr_Le2X620Stock018S

Extract the image to create our workspace:

4) Extract for new ROM
y
<enter super user password when prompted>
Le2X620Stock018S 
1) Detect by-name from boot/recovery images (recommended)
1) set_metadata (For KitKat+)

Issues with the LeEco ROM

At this point it is tempting to just create a ROM and flash it, but there are two issues that we need to overcome:

Verified Boot

The boot sequence on LeEco ROMs uses verified boot via the device-mapper-verity (dm-verity) kernel feature. If this feature is turned on, the device will refuse to boot if it detects changes in the system partition.

We can disable dm-verity through the Kitchen.

Installation script binary

The update-binary executable is used by the ROM installation script to perform various file, partition and screen operations. This file is found inside the following directory:

META-INF/com/google/android

The version of update-binary used by the Kitchen does not work with the LeEco ROM. We need to swap it with a version that is compatible with the LeEco ROM.

A download link for this file is provided above.

Removing Verified Boot

In the Kitchen:

7) Boot/Recovery Tools
1) Unpack boot.img
<enter super user password when prompted>
4) Insecure/Secure the boot.img (CURRENT: Secure)
5) Remove dm-verity (CURRENT: Enabled)
1) Pack boot.img (delete ramdisk work directory)
m = Main Menu

Swap the update-binary

Copy the update-binary file downloaded above and paste it into the following directory, overwriting the existing file:

META-INF/com/google/android

Building the ROM

Now we have all the relevant files in place, it is time to build our ROM.

Note that for our first ROM we will not Deodex and Zipalign the ROM - we can do that at a later date  in the ROM development process if required.

In the Kitchen, select:

8) ROM Tools Menu
7) Build Menu
1) Build full ROM Zip
n (sign the zip)
<enter>
q

Once complete, your ROM is ready.

Installing the ROM

Copy Le2X620Stock18S.zip from the superr_Le2X620Stock18S directory onto the device. Wipe and flash with TWRP.

Part 2 - Customising the ROM

In the second part of the series, we will remove the unnecessary Chinese apps and add in the Google Play store and some of the core Google apps.

download file now