As the title mentions, this is a guide by a noob which spells out the steps that build a lineage ROM. What the title does not mention is that this article is aimed at noobs as well. Now lets get down to business.
Disclaimer: Please note that by following the steps as mentioned in this article you can seriously damage your smart phone. There is a good chance your phone would be bricked i.e. effectively be rendered useless and cause a lot of frustration, irritation and make you pull at your hair. If you hit that point later, Please do not look towards me to save you since I am also new to this and like you learning how to traverse this parallel universe of custom ROM development. That being said do not despair. As the saying goes browse and you shall find – Check out the internet and you would find others who have messed up their smartphones and yet somehow lived to tell the tale. In most cases you would be able to revive your phone. Ideally do not use your daily driver for such experimentation.
After reading all this if still want to go ahead then read on.
Build a custom lineage ROM for your smart phone. I own a Xiaomi MiA1 and used the same as my target phone. You may have a different model but technically the build steps should be the same for all android phone models.
A linux based or a Mac computer.
Windows computers do not directly support the tools required for this type of development. As such they are not being covered in this article.
The recommended operating system is Ubuntu.
A basic understanding of Linux based OS specifically Ubuntu.
Ability to type and use the command line. Write or copy paste commands in the Ubuntu konsole.
A basic understanding of programming concepts, read and update XML files, understand error messages.
16 GB RAM / swap space.
Please note even with this configuration it takes me about 3 hours to build the code!
I used the Ubuntu 18.04 build which is the latest at the time of writing. I will be covering only the Ubuntu OS as part of this article as I do not have a Mac and as such it is out of scope for me!
Assuming you have set up the Ubuntu OS if not click this link for a detailed explanation of the installation of Ubuntu.
In a console window type or copy past the below commands.
Please note the sudo command will ask you to enter your password.
build and are ready to flash the Rom.
The Android source tree is located in a Git repository and is hosted by Google. The Git repository includes metadata for the Android source. Repo is a tool that makes it easier to work with Git .
Next type below command to make repo executable.
Now change directory and move into the newly created lineage folder.
Type \ paste these commands. Replace the text within “ ” with your credentials.
This is the step where you will realize the importance of having a fast internet connection. The source code size is about 30 – 35 GB. I have a 10 mbps line and at times the download speed shoots up to 20- 25 mbps!!! Yet it takes me anything from 4 – 10 hours to download the code!
My suggestion is check the time when your local ISP download speeds are at its best. For me it is during the night. I set the download up at night and go to sleep!
I copy the entire folder and keep a copy on an external device. This is just in case there is any need for me to format my hard disk. I do not copy the .Repo and .Cache folders on to my backup. To check hidden folders press Ctrl + H.
Step 9: Get the source code for your specific device.
This is an important part to understand. The code which you downloaded is generic in nature. For your particular device you would need to get files which are specific to your device.
The source for all these files is github. You are targeting three sets of folders – Device, Kernel and vendor. The git clone commands given below are for the tissot or Xiaomi Mia1 phone. Similarly other phones have their locations on GitHub from where you can get files specific to them.
The format of the command will remain the same for all phones only check the url and the folder names.
Step 10: Modify Caching to speed up the build process.
Type \ paste one command at a time and wait for it to execute before posting the next.
Now sit back and wait for a few hours. Check the screen, occasionally for what is happening. There will a ton or warnings showing up.Do not worry about the warnings. Read the message displayed on the screen for clues as to what is happening.
The entire build took about 3 hours on my machine with nothing else running. This duration can increase and decrease based on the configuration of your build machine. It can also depend on the files downloaded during the Repo sync process.
Finally you will get the .iso file in a folder labeled out. Check the screen shot above. It shows the build settings screen. Have been using it as on my main driver and so far so good.
There is a very good chance that the build will stop many times. When this happens read the error message and then try googling it. I can guarantee that there would be number of other people across the world who have faced similar issues while building their custom ROM’s. See what solutions have been suggested and try them out. It took me almost a week to get my first build right!
Then in the same day I got 2 builds in a row that were successful! It has a lot with having all the right files in the build environment + a good hardware configuration + lots of luck!
At times the error message which stopped the build could report that a particular file is not found in a particular folder. Do a search in the base lineage folder and see if the file is there in any other folder. Simply copy it to the folder where the build is expecting it. After that run the build commands again and restart the build.
Remember to use your default login. I used su – superuser and ran into trouble while doing a repo with the normal login. So I do not use su for the build and do the entire build and repo sync with my login. Since i installed the system Ubuntu is satisfied with my credentials.
As I mentioned at the start this is my first shot at building a custom ROM. While there is not exactly much customization being done here as the source code is available on Lineage.com and the files specific to the device were shared by various developers on GitHub. All that I have done is that I downloaded the code and recompiled it on my machine. Having said that there is a sense of pride that you feel when you see your name in the settings tab!!!!
Hope this was a easy to understand guide to help noobs around the world do their own custom ROM development. This article is as I mentioned a guide, you should refer the links given below and get a complete understanding of the process of building ROM’s before you start on your own. So good luck with your custom ROM building!!!
Some important links which you should visit to understand how the experts do it.
The process to flash the build is given here. Please use the same sequence to avoid issues.