Digit Geek
Digit Geek > Recent Articles > Technology > How to build your own Custom ROM and install it

How to build your own Custom ROM and install it

Even among geeks, installing a Custom ROM isn’t a big deal. So how about building your own Custom ROM which you can customise as you like? Read on!

It wouldn’t be entirely wrong to say that Android would be nowhere close to its current popularity if it wasn’t open source, to begin with. Every component of the operating system – from the messaging apps, libraries, UI components and more – is available as code for free. It is because of this very flexibility that you see so many different implementations and customizations for Android – from smartphone manufacturers to hobbyists. A particular customised implementation is generally referred to as a Custom ROM.

So can you get into customising Android? Why not? We’re here to show you how. But before we begin, there are a few things you need to know.

Android customisation
The structure of the Android Open Source Project

Disclaimer

Customising Android is not entirely simple. But that’s not unexpected, considering all the wonderful things you can do with your Android phone now. So, as a consequence, there are a few things that you need to know to be able to do this successfully. Broadly speaking, you need to have some basic coding skills, some experience with the Linux based command line and the concept of a makefile.

A makefile is a document that contains the directives that work when the make command is issued. These are essentially instructions about how to compile a particular file. For instance, when a file has to be recompiled on the basis of particular changes being saved, that is an instruction you will find in the makefile.

Another disclaimer: we are not going to build the next Cyanogen Mod here. As we said earlier, it is not easy to build an entire operating system and the output of this section is going to be minor changes at best. The rest we leave up to you to learn. You will need a boatload of patience, but it will be rewarding in the end.

Android customisation
While we are customising, it will be a while before you can build the next Cyanogen or LineageOS

Requirements

Before we start, there are a few more things that need to be decided. First of all, Android can be theoretically built for any modern-day computing system. That being said, customisation references and resources are more likely to be available more easily for devices that support customisation out-of-the-box. The demo build that we used as a reference for this article uses a Nexus 5X for the customisation. However, you can do a lookup if there are any particular restrictions or requirements for the specific model of your phone.

You’ll also need access to a Linux machine or a Mac. In terms of specifications, you’ll need about 130-150GB of storage and quite a lot of RAM (up to 16GB on Linux) – we never said Android was light. And regarding the overall time that it will take, don’t expect it to be done in minutes.

Overview of build process

There are two main steps to this process – downloading the Android SDK and then modifying the source code implementation as a custom ROM.

It is most certainly not possible to complete the entire process in this one article. Something like that is more suited to an entire Fast Track. We will be highlighting the broad steps involved though the best place to start off would be Google’s documentation on the Android Open Source Project. You can find that at http://dgit.in/AOSPDoc. Take the documentation seriously as each point in there is important for a successful build.

Moving on, here are the broad tasks that you’ll need to do, along with some pro tips for each:

  • Set up a build environment – including installing the right development tools, the Java Development Kit, and getting all the paths and directories right.
    Pro Tip: Ubuntu 14.04 is the recommended build environment for Linux users and OS X 10.11 for Mac users. You need to install OpenJDK 8 on Linux and Oracle’s JDK 8 on OS X. On OS X you also need Macports installed along with Xcode and the Xcode command line tools.
  • Grab the source – this is done using the “Repo” tool and git.
    Pro Tip: Have patience.
  • Obtain proprietary binaries – some of the drivers are only released in binary form.
    Pro Tip: The binary drivers should be unpacked in your working directory.
  • Choose a target – using the “lunch” tool.
    Pro Tip: This is phone specific and it’s better to check out the particular value for your phone.
  • Start the build – using “make” and “jack”.
    Pro Tip: You start the build using make. GNU make can handle parallel tasks with a -jN argument, and if you find your machine struggles during the build process then try something like “make -j2”.
  • Flash the build onto your device – using adb and fastboot.
    Pro Tip: You will find adb and fastboot in ./out/host/darwin-x86/bin/ or ./out/host/darwin-x86/bin/ for OS X or Linux respectively.

Once the build is done and flashed, you will be looking at the barebones version of Android on your phone – without Google services and only with few basic apps. Congratulations, you’ve managed to complete your first basic build of Android.

The actual customisation

Tinkering with this huge OS is not an easy feat. Listing out how to build an entirely new custom ROM would take more pages than this entire magazine. A better way to do this would be to head to http://dgit.in/AndStsBar and start off small. Also, if videos are your thing, check out the custom ROM tutorials at the links below:

Installing the best

While some of you might have actually tried the build process above, a much more common (and almost as daunting) alternative is to install a popular Custom ROM. On the other hand, if you’ve followed everything above, installing a custom ROM is fairly simple and involves the following steps:

  • Download a ROM – Well, duh! Once it is downloaded, place it in your internal memory along with corresponding GApps for the version of Android that you’ve downloaded.
  • Boot into recovery – Checkout the ‘Root your smartphone’ section at the very beginning of this story for a detailed guide on how to set up custom recovery for your smartphone.
  • Flash ROM – As mentioned in the ‘Root your smartphone’ section, select the .zip file from the TWRP interface and install it. You can also opt for Clockwork Mod.
    Clear Cache – Once the installation is done, go back and clear your cache. And you’re done!
Cyanogen Mod was one of the most popular go-to choices for Custom ROMs

While that’s how to get a Custom ROM on your phone, you also need to know which ones are the best. CyanogenMod is a very popular choice, although Cyanogen Inc shut shop pretty recently. There are some pretty good alternatives which you can check out here: http://dgit.in/AltCyano.

With that, you have pretty much learnt how to get a customised version of Android which works exactly the way you want it to.

This article was first published in the May 2017 issue of Digit magazine. To read Digit’s articles first, subscribe here or download the Digit app for Android and iOS. You could also buy Digit’s previous issues here.

Arnab Mukherjee

Arnab Mukherjee

A former tech-support desk jockey, you can find this individual delving deep into all things tech, fiction and food. Calling his sense of humour merely terrible would be a much better joke than what he usually makes.