Connect with us
Compile Custom ROM For Any Device - The Ultimate Guide 1 Compile Custom ROM For Any Device - The Ultimate Guide 2

ROMs

Compile Custom ROM For Any Device – The Ultimate Guide

Published

on

In this tutorial, you’ll learn how to compile custom ROM of your choice for your device! Yes, it’s quite easy if you have messed your hands on Linux. You can compile any rom of your choice if you can grab sources from the Github and your device, vendor tree, and kernel source.

READ THIS BEFORE YOU MOVE FURTHER!

This guide is for those who at least have some basic knowledge of using Github and any Linux because you’ll need to visit Github most of the times for solving errors, checking commits and all you’ll have is a terminal! You can use the GUI based Linux distros, but I love doing it on the terminal to compile custom ROM.

DON’T START COMPILING IF YOU HAVE NO IDEA ABOUT BASIC STUFF OF LINUX!

THINGS NEEDED TO COMPILE CUSTOM ROM

  1. Ubuntu 16.04 server / PC with Ubuntu 16.04. Make sure it is powerful enough to handle tasks.
  2. Device tree, Vendor tree and Kernel source of your device. (You can find it on Github/XDA).
  3. Source of the custom ROM which you want to compile.
  4. Little Brain.

You’ll need around 100-300GB free space, super fast internet. Don’t do this on your old pc with slow internet.

Once You have grabbed your trees and sources, you can start the initial setup.

Compile Custom ROM For Any Device - The Ultimate Guide 3

SETTING UP THE ENVIRONMENT

You have to install the tools which are required for making a custom rom! You can simply copy paste the code given below in the terminal to setup the environment.

sudo apt-get install openjdk-8-jdk
sudo apt-get update && sudo apt-get install git-core gnupg flex bison gperf libsdl1.2-dev libesd0-dev libwxgtk2.8-dev squashfs-tools build-essential zip curl libncurses5-dev zlib1g-dev openjdk-8-jre openjdk-8-jdk pngcrush schedtool libxml2 libxml2-utils xsltproc lzop libc6-dev schedtool g++-multilib lib32z1-dev lib32ncurses5-dev lib32readline-gplv2-dev gcc-multilib maven tmux screen w3m ncftp unzip repo bison make bc pngquant

SETTING UP REPO

You’ll need to setup repo for using it. For this, you have to make path ‘bin,’ download repo there and then you have to give it permissions.

mkdir ~/bin

PATH=~/bin:$PATH

curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo

chmod a+x ~/bin/repo

MAKING THE DIRECTORY FOR YOUR CUSTOM ROM

Now you have to make a folder where you’ll store the files for your rom. In this tutorial, I’m making Lineage, so I have named it Lineage.

mkdir lineage
cd lineage

GETTING THE ROM SOURCE TO COMPILE CUSTOM ROM

If you are familiar with Git and Repo, then you’ll be able to understand the next step.

repo init -u git://github.com/LineageOS/android.git -b cm-14.1

You can get any ROM source and init the repo, in my case I’m using LineageOS.

You can try some other roms like Resurrection Remix, CrDroid, AEX, etc.

Now sync the repo

repo sync

Now grab a cup of coffee because it’ll take a long time depending on the speed of your internet connection if you are familiar with repo then use some tweaks like -c, -f, –no-tags to decrease the time. It takes around 20-30 minutes on my server.

CLONING THE STUFF ON YOUR DEVICE

Now you have to clone your device tree, vendor tree and kernel source from Github.

You have to clone like this – git clone *git-url-here* -b *branch* folder/folder/folder

This is how I clone for my device; you can get a better idea with this.

Device –

git clone https://github.com/sweetie2205/android_device_motorola_kinzie.git -b lineage-14.1-kinzie device/motorola/kinzie

Vendor –

git clone https://github.com/sweetie2205/proprietary_vendor_motorola.git -b lineage-14.1 vendor/motorola/kinzie

Kernel –

git clone https://github.com/sweetie2205/kernel_motorola_msm8992.git -b lineage-14.1 kernel/motorola/msm8992

START THE COMPILATION

Start the compilation by using commands –

source build/envsetup.sh

breakfast kinzie

(Change kinzie to your device code name)

brunch kinzie

Now grab a book to read, because it’ll take hours to compile the rom! You may see some errors, comment the error below and we will help you to find the solution.

You’ll get the flashable zip after the compilation is finished, and then you can flash it on your phone with a custom recovery like TWRP

 

Engineer at day, Blogger at night! I'm blogging since last couple of years, I'm a tech nerd and a freelancer.

2 Comments

2 Comments

  1. SHIVAM NAIK

    June 14, 2018 at 2:20 PM

    sudo apt-get update && sudo apt-get install git-core gnupg flex bison gperf libsdl1.2-dev libesd0-dev libwxgtk2.8-dev squashfs-tools build-essential zip curl libncurses5-dev zlib1g-dev openjdk-8-jre openjdk-8-jdk pngcrush schedtool libxml2 libxml2-utils xsltproc lzop libc6-dev schedtool g++-multilib lib32z1-dev lib32ncurses5-dev lib32readline-gplv2-dev gcc-multilib maven tmux screen w3m ncftp unzip repo bison make bc pngquant

    THE ABOVE COMMAND IS NOT GETTTING EXECUTED…….
    THE RESULTS ARE

    Package lib32readline-gplv2-dev is not available, but is referred to by another package.
    This may mean that the package is missing, has been obsoleted, or
    is only available from another source
    E: Unable to locate package libwxgtk2.8-dev
    E: Couldn’t find any package by glob ‘libwxgtk2.8-dev’
    E: Couldn’t find any package by regex ‘libwxgtk2.8-dev’
    E: Package ‘lib32readline-gplv2-dev’ has no installation candidate

    PLZ HELP. I’M NEW TO THIS

    • Arvind Rana

      June 15, 2018 at 1:48 AM

      Packages are probably depreciated. So, you need to skip these packages

Leave a Reply

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

All the data shown above will be stored by DroidHolic on https://droidholic.com. At any point in time, you can contact us and select the data you wish to anonymize or delete so it cannot be linked to your email address any longer. When your data is anonymized or deleted, you will receive an email confirmation. We also use cookies and/or similar technologies to analyze customer behavior, administer the website, track users' movements, and to collect information about users. This is done in order to personalize and enhance your experience with us.

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

SUBSCRIBE TO OUR NEWSLETTER

Like DroidHolic on Facebook

Recent Posts