Why do we blog? Why do we write poems or churn out epics and paint beautiful pictures? What makes us write stories about school-children waving magic-wands and fighting evil wizards or what is it that provokes us to make movies which boldly go where no one has gone before? I think the desire to share, imagine and describe the impossible is what makes us different from other species. The capability to foresee, invent and predict life as it should, would or could be in a hundred years is what makes us humans different from the other species that crawl,slither or walk on this planet. Having said that does this rare ability make us better than the other species that inhabit this planet? Looking at the way we humans have been busy destroying the planet over the centuries I do not think we as a species have lived up to expectations. That is sad…
One month back if anyone had said that I could build a ROM using Docker I would have laughed. I had taught myself how to build a custom ROM for my cell phone the hard way. I have three phones at home. The three phones have three different flavors of the Android Operating system. My current daily driver is a MiA1 tissot. The phone was released with Nougat and was later updated to Oreo. The current version of Oreo is 8.1. The phone is officially supported by LineageOs4MicroG. That is where I decided to try my hand at using Docker to build my own ROM. After a few false starts it finally worked. Now it works like clockwork. Let me share what I did with you.
Before we proceed let me explain what MicroG is. To those – like myself – who do not want to have Google services on their phone and yet are addicted to apps like twitter, whatsapp or GooglePay – MicroG is a must. The problem with Google is that, their apps tend to steal your personal information and marketing it. I do not like that. Yet I need to use apps like WhatsApp and Twitter. These apps need Google play store to run in the background. The way around is to install MicroG. What MicroG does is it spoofs the apps into believing that Google Play is installed on your phone!
Installing Micro G the standard way- downloading apk’s and installing them- is a pain. The easiest way is to either download a custom ROM with MicroG already built in or build a custom ROM yourself. This is where LineageOS4MicroG comes in. These builds require docker to be setup on your PC.
A word about Docker.
Docker is a build method which is almost entirely automated. Once you have the environment up and running on your PC you just sit back and wait for the build to complete. No action is required from your side. Lets see what the per-requisites are for setting up a Docker build environment.
Install docker on your PC. I use a Ubuntu PC but Docker can be installed on windows as well as Mac.
Check the docker web site for instructions specific to your system.
Confirm that docker is installed on your PC by running the below command
the output should be something like this
docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
ca4f61b1923c: Pull complete
Status: Downloaded newer image for hello-world:latest
Hello from Docker!
This message shows that your installation appears to be working correctly.
Step 2: pull the lineageos4microg on to your pc
You should see a screen similar to the screenshot below….this was for another pull..but you get the idea 🙂
sudo mkdir -p \
this would create directories on the file system. The lineageos4microg environment takes up about 150 GB of space so I do not prefer creating folders outside /home as I ran into space problems
An easier way is to just create folders using nautilus under home for e.g.
Create a folder lineageos4microg under home
and inside it create these 6 folders
Create an xml file… copy paste this in notepad, gedit and save with the name custom_package.xml
The name is not important, it is the .xml part which is important.
<?xml version=”1.0″ encoding=”UTF-8″?>
<project name=”lineageos4microg/android_prebuilts_prebuiltapks” path=”prebuilts/prebuiltapks” remote=”github” revision=”master” />
start the build with the below command
docker run \
-e “BRANCH_NAME=lineage-15.1” \
-e “DEVICE_LIST=<device name>” \
-e “SIGN_BUILDS=true” \
-e “CCACHE_SIZE=100G” \
-e “SIGNATURE_SPOOFING=restricted” \
-e “CUSTOM_PACKAGES=GmsCore GsfProxy FakeStore MozillaNlpBackend NominatimNlpBackend com.google.android.maps.jar FDroid FDroidPrivilegedExtension” \
-v “/home/manoj/lineageos4microg/lineage:/srv/src” \
-v “/home/manoj/lineageos4microg/zips:/srv/zips” \
-v “/home/manoj/lineageos4microg/logs:/srv/logs” \
-v “/home/manoj/lineageos4microg/cache:/srv/ccache” \
-v “/home/manoj/lineageos4microg/keys:/srv/keys” \
-v “/home/manoj/lineageos4microg/manifests:/srv/local_manifests” \
– replace the <device name> with your phone name. For e.g. my MiA1 is called tissot. You can get your device name by typing the below adb command
$ adb shell getprop ro.product.device
assuming you have adb setup and functioning on your pc. If not click here xxxxx
– in the above command I have set Ccache size as100G. This is because I have a lot of empty space on my PC. Set it to 50G or as per your convenience.
– the PC will seem to hang with the message Syncing repositories. This is because the setup is downloading files from the internet. This process can take a long -long time. You can see what is happening by checking the log files. Copy the logs on to your desktop and open this copy. Do not try to open the actual logs as data is being written on to it.
what these commands mean:
All the command starting with the -e are setting your environment for the build. The cache size, Lineage branch (in this case 15.1) , signature spoofing – read detailed documentation links to understand this better. Safe to say use restricted for now.
All the commands starting with the -v are the location of your source files or folders where your logs and zip is to be placed. I got errors here when the path was not correct.
Check the path to get the command to run smoothly. It is a one time task. Save the command to run it again the next time you want to build.
The \ sign mark the end of each line.
To see more samples refer the links given below for the LineageOS4microG site.
Once the build is complete you will find the build in the zips folder.
The advantage of the Docker build is once the environment is set up it does all the work almost automatically. The resources on the PC are optimally used. For e.g. I have 15 GB or RAM but am unable to run any other application while building normally. With Docker I use my PC as normall while the build is running in the background. You can run multiple device builds at the same time, You just have to add device names separated by a comma.
Additional reading for reference and trouble shooting
Docker installation : get details for your PC
For e.g. for Ubuntu https://docs.docker.com/install/linux/docker-ce/ubuntu/
LineageOS4MicroG related documentation
man who in a previous avatar scripted the popular Mandrake Linux Operating system.
The project team uses / e / as a temporary placeholder name while the product is in beta. The name for the finished product is yet to be announced.
What is a mobile OS?
To the uninitiated, a mobile OS is the soul behind your smart phone. The brain that runs the hardware. The hardware or the parts of a mobile that you get to touch and hold are the brawn part on your phone.
Who are the current players in the Mobile OS world?
Currently we have two major players in the Mobile OS market. Android (read Google) and iOS (read Apple). Between them they dominate the market. Check out the latest statistics as published by Gartner.
Look at the figures for the 2nd quarter of 2018 or the numbers under the column heading 2Q18 Market Share (%).
The numbers show Google’s Android having an 88% share of the world smart phone market. The remaining 11.9 % is with Apple with its IOS. Now look at the numbers for the other OS’s….as expected the numbers are 0.0!!!!
What do these numbers mean?
The numbers mean that the world and we the end users are directly controlled by these two giant organizations viz Google and Apple. Also involved in filtering our web experience are organizations like Microsoft and Amazon.
The smart phone is now an essential part of our lives. From the minute we wake up to the sound alarm on our phones to the minute we go off to sleep after checking check our phones, our phones are our constant companions.
We use phones to check emails, read the news, chat, talk, take photos…. the list goes on and on. Apps like Facebook, Whats app and twitter have become a part of our vocabulary and lives. These social media accounts keep us in sync with our friends and foes from around the world.
While we are busy using these apps, what we do not realize is that we are also leaving a digital footprint behind us. Details of what we have typed, chatted, uploaded or downloaded are saved on servers at these organization. For example Gmail owns your email data and reads what ever you type. How else do we have auto complete and suggestions popping up while we are still typing out the sentences? While these organizations deny this manipulate it is common knowledge that a major source of their revenue is through selective exposure of our data to third party businesses. Ever wondered how ads from Amazon or Flipkart show up on the sidelines of you web pages, vending products you browsed couple of days back? That happens because browsers save our surfing history and then that data is used by these companies to makes sales pitches. Welcome to the world of targeted advertising! All this is done in the name of facilitating a smooth browsing and purchasing experience!
This is where / e / comes in. The idea behind Gaël Duval’s OS was to seal this data pilferage from the mobile OS. Changes are made at the code level and applications made more secure. The idea to is to prevent leakage of our data be if personal or browsing history.
What / e / brings to the table
In its current beta version the OS is forked from the Lineage OS 14.1. To explain further lineage OS is a free open source operating system for smartphones and tablet computers. It is based on the android source code. The current beta version of / e / is based on Nougat. Android has come out with Oreo and Pie two upgrades after Nougat. Development for the upgrade to Oreo or Lineage 15.1 is on at / e /.
Devices supported in the current version of / e /
There are about 25 plus phones which have ROM’s in the beta version. As mentioned before development for devices which work on oreo or Lineage 15.1 is underway and expected to be released soon.
A few screenshots of phones running / e / are given below
For more details on the project take a look at the following sites
/ e / Web site : https://e.foundation/
/ e / forum : https://community.e.foundation/
Read about Gaël Duval https://en.wikipedia.org/wiki/Ga%C3%ABl_Duval
Understand what Targeted Advertising is https://en.wikipedia.org/wiki/Targeted_advertising
To check on the availability of devices and how to install them on your phone check out the web page here:
Interested in building the OS… well check out the details here https://gitlab.e.foundation/e/wiki/en/wikis/build
Let me explain the process of how to flash lineage official OTA on the MiA1. The reason why this needs a separate post is because it is slightly complicated and the chances of failure are high. The process of flashing the lineage ROM on the MiA1 has changed now that we have a signed Over the Air (OTA) ROM coming in every week on Tuesday.
I am assuming that you have a basic understanding about flashing ROM’s and understand why custom ROM’s are flashed. I am also assuming you know about platform tools like adb and fastboot and have a working adb and fastboot on your PC.
WARNING: As always remember there is a good chance that the process of flashing custom ROM’s can seriously damage your phone and even permanently brick it i.e. render it useless. You have been warned and are doing so at your own risk.
Now that we are done with the warning lets start flashing.
Before you proceed download these files.
Please note these files are available either from this web site or you can search for them on the web and download them from their original sites. I leave the option to you. The point is you would need these files to continue with the task at hand.
- Lineage signed build for 10 July.
Download it from here or get it from the official site by clicking here
- Mind the Gaps
- Boot recovery img
Important : DO NOT FLASH THIS BOOT image this is only for hot booting . Read the steps for hot booting below.
Copy required files
Copy the boot recovery image file into the folder where you installed adb on your PC.
Copy the remaining files on to your phone. These files are Lineage ROM for 10 July + Mind the Gaps + TWRP installer.
Copy them into the download folder on your phone. You can either use the PC or try it through adb push is you are comfortable with that.
The command for an adb push would be as under
adb push TWRP-installer-3.2.1-with-Tissot-Manager-2.3.zip /Downloads
adb push <complete file name to be pushed including extension> /<destination>
Coming from Stock MiA1 ROM follow the steps given below. These steps should be the same even if you are coming from other unofficial version of the Lineage ROM and want to install the official lineage ROM.
Step 1. Boot phone into fastboot mode
From a PC which has adb and the correct drivers installed type the above command to boot the phone into the fastboot mode. This is the mode where you get the picture of a bunny wearing the Chinese army hat!
Alternately you can also switch off the phone. Press and hold volume – and power button and keep holding till you feel it vibrate. This should happen in 1-2 seconds. Then release. The bunny in the hat should be on your screen now!
Step 2 : From the folder where you have installed adb and copied the Boot recovery image type the below command in the console.
fastboot boot boot-recovery.img
Within 2-3 seconds the boot image will be hot booted on you phone and you should be in the TWRP screen.
Step 3. Wipe cache, data and system
Step 4. Flash the Lineage Official ROM for July 10. This is a slightly weird step required because flashing the latest ROM directly will give you an signature verification error!!!
Hope this error is fixed in later versions of the ROM.
Step 5. Flash the TWRP installer .
This TWRP is by CosmicDan and specifically create for the Tissot. Please note the TWRP screen will give you very detailed instructions at each stage of the installation. Read it carefully. In spite of all the help on this page or the Lineage web sites the setup may still fail in some cases. That is where the messages on the TWRP screen would come in handy. Read the messages and you would be able to resolve most of the issue on your own.
Step 6. Reboot Recovery. This is a required step
Step 7. Flash Magisk 16.6
Step 8. Flash Mind the gapps
Step 9. Reboot System
Once you have the ROM up and running. Go to System >> About phone >> Tap the build number 7 times and you will be into developer mode. Enable USB debugging and Advance restart. If you are not familiar with these steps click here for details
This is just in case you are stuck again and need to recover your phone then it would be helpful to have USB debugging enabled on your phone to allow access through adb from your PC.
Now remember you are in the July 19 version of the ROM.
To get the latest OTA update
- Go to System >> About Phone >> LineageOS updates and click to download the latest build for your phone.
This is a painfully slow download so have patience and relax.
The download from the lineage web site can take hours. It took about 4 hours on my phone that too on a 10 MB internet WiFi connection!
Once the download is complete install the build . This will also take some time.
When the build is finally installed, you can check the results in settings.
The latest ROM released on the Tuesday of the current week should be showing up.
Here there is an important thing to note. Once the new ROM is installed it will wipe out your magisk and TWRP installation .
Mind the Gapps will work seamlessly.
Flash TWRP and magisk again if you need them.
Best of luck!
Update 18 July 2018:
The first OTA Over the air ROM rolled out on the Tuesday 17, July. While this was a milestone moment for those who had the Lineage ROM on the Xiaomi Mi A1 there was a major hiccup in the release.
The first problem was the OTA downloads were extremely slow. When it finally made to the user’s phones the update failed.
The telegram group for MiA1 was flooded with messages from MiA1 users and the issue is expected to be resolved in the next build. There is a build every Tuesday.
The current work around is as under ;
Please note this option works when coming from the previous week’s signed Lineage official ROM
Step 1: Download the latest ROM the July 17 version from here
Please note the download may take a long time. On my 10 Mb line it took a couple of hours!!! Once downloaded copy the ROM on to your phone.
Step 2: Reboot to recovery
Please DO NOT WIPE ANYTHING
Step 3 : Flash the latest lineage official ROM, downloaded in Step # 1
Step 4: Reboot to recovery again
Step 5: Flash Mind the Gapps
Step 6: Flash Magisk
Step 7: Reboot
The official lineage ROM for the Xiaomi MiA1 was released on 10 July 2018. The release was eagerly awaited by thousands across the world. The only problem was that when it rolled in the user were in for a surprise… a slightly unpleasant surprise. The flashing of the ROM required a whole new set of steps and there were problems at each stage. I consider myself as quite an expert at flashing the unofficial ROM‘s..at least on my MiA1 and had even built a ROM for the MiA1 based on code from GitHub. but I had some real problems this time. After a lot of false starts I finally managed to get the official ROM on my phone.Given below are the steps I took. You would need adb and fastboot on your PC to achieve all this. In case you do not have the same please click here and also enable phone developer options.
Step 1:Download and copy the files mentioned below to your phones Downloads folder. Copy the Boot recovery.img file to the adb folder.
Step 2: If coming from a the unofficial Lineage ROM get to the boot loader screen.
Power off phone.
Hold Power + Volume down button.
When the phone vibrates release. You should be in the Boot loader screen.
Step 3: From your PC go to the folder where you have adb and type
fastboot boot boot-recovery.img
Within seconds the recovery image will be loaded on to you phone and you should be in the TWRP screen.
Step 4: Wipe cache, data and system
5 . Flash Lineage Official
6. Flash TWRP by CosmicDan file TWRP-Installer-3.2.1-with-Tissot-Manager-2.3.zip
This TWRP will install itself on both A and B partitions of your phone.
7. In TWRP Reboot to Recovery
8. Flash Magisk 16.6
9. Flash Mind the gapps
10. Reboot System and wait for the phone to boot up.
Download the files from here.