Building /e/OS google-free ROM based on Android version 9 aka Pie for Xiaomi Redmi Note 4X

System implementation

/e/OS or the e-Foundation, founded by Gael Duval, has made it its goal to develop a de-Googled Android ecosystem. This sounds contradictory at first, since Google has brought the Android project into being. Exactly this is, as already discussed, also the problem, even in the open source part of the operating system, Android Open Source Project, short AOSP, which was also created under Google’s patronage, Google services can be found and so even the pure open source variant of Android is busy collecting data and sending it home. Since /e/OS is based on LineageOS and not every smartphone is supported yet, especially not with current Android versions like Pie, a separate /e/OS’s Pie version for an Android device has to be compiled and build as is shown in this post.

Prerequisites

For this we have a Xiaomi Redmi Note 4X with Qualcomm Snapdragon 625 processor (SoC:MSM8953). Xiaomi shipped the smartphone 2017 with Android 6.0 and gave it an update to Android Nougat (7.0), but has not provided any updates since then. /e/OS, based on the world’s most widely used Android derivative LineageOS, has not officially made it beyond that so far. As per the official wiki page for the device with LineageOS Project, the is no longer maintained. So the goal is to port the current Android Pie to /e/OS using an unofficial Lineage-16.0 version. A tutorial by R. Hunault can be found in the GitLab of the e-Foundation. But since this tutorial only works for officially supported devices, the whole process has to be adapted.

For the adaptation further tutorials from the /e/ community forum, like this one here:

https://community.e.foundation/t/howto-an-unofficial-e-rom-built-with-docker-in-pictures/2445

https://community.e.foundation/t/howto-build-e-without-docker/3149 had to be included.

To start with, some requirements have to be met, first of all a computer with 64bit architecture running a 64-bit GNU/Linux distribution with at least 8GB RAM and 250GB free disk space, then a suitable Android smartphone, in this case the Xiaomi Redmi Note 4X with unlocked bootloader and a custom recovery, like the Team Win Recovery Project or TWRP installed. Furthermore, the Android device code for the Android must be extracted, in this case.

In addition, unofficial, working Lineage 16.0 GitHub sources are required for the corresponding Android device, consisting of a proprietary vendor source code, device specific “device tree” and a kernel. GitHub user Zeelog provides these for the device in question; his repositories are named proprietary_vendor_xiaomi, android_device_xiaomi_mido and android_kernel_xiaomi_msm8953.

Create and install dependencies

First you have to install Docker and some additional packages, more details on the Docker page. With the $ sudo docker run hello-world command you can check the installation, you might have to grant Docker extended rights of use.

If Docker is installed correctly, the command

$ sudo docker pull registry.gitlab.e.foundation:5000/e/os/docker-lineage cicd:latest

the latest /e/-OS image is loaded.

Next the working directory is created with ;

$ sudo mkdir -p \
/srv/src \
/srv/zip \
/srv/logs \
/srv/ccache \
/srv/local_manifests \

In the local_manifests folder an .xml file with the name roomservice is created. This file serves as a manifest for the unofficial Lineage sources, plus a directory from the LineageOS GitHub.

All in all, the whole thing looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<project name="Zeelog/android_device_xiaomi_mido" path="device/xiaomi/mido" remote="github" />
<project name="Zeelog/android_kernel_xiaomi_msm8953" path="kernel/xiaomi/msm8953"
remote="github" />
<project name="Zeelog/proprietary_vendor_xiaomi" path="vendor/xiaomi" remote="github" />
<project name="LineageOS/android_packages_resources_devicesettings"
path="packages/resources/devicesettings" remote="github" />
</manifest>

Since it is assumed that all sources are for Lineage-16.0, the branch declaration is omitted. If this is not the case, a GitHub account must be created and the repositories must be “forked” into your own profile, so that a Lineage-16.0 branch can be created there, which can then be declared as the main branch. This can be the case especially with modded kernels, because they are not developed with Lineage, but only with Pie as target, and are often compiled separately by the developers.

This can look like this, for example:

Example of a forked repository with modified Lineage-16.0 branch on GitHub.com

Finding these correct and working repositories is not always easy, especially since on August 9, 2019, a request for removal of the Proprietary Code relating to the Face Unlock in linear sources on Xiaomi devices was submitted by the Chinese supplier behind it, Beijing SenseTime Technology Development Co, Ltd. As a result, more than 450 repositories were blocked for DMCA violations on GitHub.

Lineage itself has removed all Xiaomi devices from the list of officially supported devices including proprietary blobs and stopped compiling for these devices. This makes it even more difficult for the custom Rom scene to develop software for these devices. Nevertheless, the necessary GitHub source code for most devices with Qualcomm processors should be available on xda-developers and in various support groups on Telegram.

Customize Docker Script

The next step is to customize the script for dockers from the /e/-Gitlab tutorial. The directories that Docker should load have to be changed and adapted, a sub-directory named e has been omitted in the working directory in all paths for simplicity, but the directory with the xml manifest in local_manifests has to be added. Furthermore a line has to be added so that Docker doesn’t want to use the normal proprietary directories of LineageOS as source, therefore -e “INCLUDE_PROPRIETARY=false” \ is inserted. This specifies that the proprietary code is no longer loaded from Github.com/TheMuppets but from the repositories defined in roomservice.xml. Finally, the BRANCH_NAME is changed from v1-nougat or v1-oreo to v1-pie and the Android code of the device used, mido, is added to the DEVICE_LIST line. If there is a lot of free space (300 GB +), the ccache used for compilation can be changed with the line -e “CCACHE_SIZE=100G” \ from the normal 50 GB to 100 GB, that’s all it takes.

Before the script can be executed and compilation begins, the directory structure should be initialized, this can be done by compiling an officially supported device, and repo sync errors can be prevented, for example by using $ sudo git clone GitHub. com/Zeelog/android_kernel_xiaomi_msm8953 to clone the repositories into the appropriate directories, in this case /srv/src/PIE/kernel/xiaomi/msm8953.

Compiling and testing

When everything is ready, the compilation can start. To do this, the script file must be made executable for Docker and executed in a terminal. First of all a directory synchronization (repo sync) starts which can take a few hours depending on your internet connection. You can use the command tail -f /srv/logs/repo-YYYYMMDD.log to display the current progress.

As soon as the directory synchronization is finished the compilation process starts, just like the synchronization, the progress can be output with tail -f /srv/logs/mido/eelo-0.7-YYYYMMDD-UNOFFICIAL-mido.log. Depending on the computer properties, compiling may take several hours. At the end, if everything worked, a zip file flashable with the modded recovery is output under the path /srv/zips/mido.

After flashing, a fully functional de-googled Android system should be installed on the device. The system can be tested for the function or the absence of Google services with applications like TCPdump or network monitor, which log the IP addresses of the connections to the outside. With a Whois query, the respective IP and the companies or persons behind it can be determined.

Summary

With the e-Foundation’s Docker-Script there is a comparatively simple method to compile a current Android system without Google Services, without having to be an Android programmer. Especially for non-LineageOS supported devices more experience with operating systems is needed, but for supported devices a reasonable way out of Google Services is easier to find. Due to lack of time and space, bootloader unlocking, modded recovery installation and cloud service self-hosting with the Raspberry Pi was not addressed but you could reckon on e.foundation’s resources for the rest as of yet, it being a non-profit, open-source and pro-privacy initiative.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.