FORUMS

How To Compile Rom From Source full guide step by step by Jai Sharma

22 posts
Thanks Meter: 49
 
By jai44, Junior Member on 14th November 2016, 05:12 AM
Post Reply Email Thread
How To Compile Rom From Source


We need following things to compile ROM from source


A Computer( Linux or Mac)
Java JDK
Some required Package for building Rom
Rules for Accessing USB devices
Choosing a Branch












Installing Java on the Machine




Here i am using Ubuntu(14.04 LTS) as a Linux machine but it should work for other Linux variant




Open a terminal and type following


sudo apt-get purge openjdk-\* icedtea-\* icedtea6-\*


This command will remove other existing openjdk installation


2. Once java is uninstalled use following command for installing correct version of java




sudo apt-get update
sudo apt-get install openjdk-s8-jdk






Check java version by typing following command


java -version










2. Installing some required packages




Type following in terminal to install some required packages






sudo apt-get install git-core gnupg flex bison gperf build-essential \
zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 \
lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev ccache \
libgl1-mesa-dev libxml2-utils xsltproc unzip








3. Downloading Repo Tool and setting PATH


mkdir ~/bin
curl http://commondatastorage.googleapis....downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo




Now open the bashrc file and so we can include the repo tool:


sudo nano ~/.bashrc




Add following in the end of the file


export PATH=~/bin:$PATH




Now we need to reload bash variables to include the new path:


source ~/.bashrc




4. Initializing a Repo client


Now we need to create a directory where our source code will be downloaded. I am creating a directory AOSP here
mkdir AOSP
cd AOSP

In the following command insert your name and email address


git config --global user.name "Your_Name"
git config --global user.email "Your_EMail"




Now care fully select your branch whether you are downloading aosp or Cyanogenmod


repo init -u https://android.googlesource.com/platform/manifest -b android-7.1.0_r7


type your desired branch name after the -b. This also applies to Cyanogenmod










5. Downloading source code




Now start downloading source code by typing following


repo sync


Note: this may take some time depending upon your internet speed and also please make sure you have enough storage




6. Configuring USB Access


type your username in following command and type enter


wget -S -O - http://source.android.com/source/51-android.rules | sed "s/<username>/$USER/" | sudo tee >/dev/null /etc/udev/rules.d/51-android.rules; sudo udevadm control --reload-rules












7. Now building Rom for your device




To build rom we need following


Device tree
Vendor tree
kernel




Finding device tree and Vendor Tree




To find your device tree search on Github or similar sources with your device code name. If you are lucky you will find it there and believe me it is the easiest way to build your rom rather than creating device tree and vendor tree from scratch


Your device tree will go on following location


device/device_manufacturer_name/device_codename


Same for vendor tree


vendor/device_manufacturer_name/device_codename


If you find device tree and vendor tree then how to download it


For device tree


git clone “Github url” -b (branch_tag) device/device_manufacturer_name/device_codename






2. For vendor tree

git clone “Github url” -b (branch_tag) vendor/device_manufacturer_name/device_codename




Note1: You may need to change some files if everything is not working or giving you some error in rom compiling. Look into output to find out error. You can use Google if you can't correct it








Note2: You may be not found your device tree and vendor tree then what to do?. You may need to create them. Please follow my guide




Creating Device tree and vendor tree from scratch


For creating device tree


http://azodik.com/how-to-create-devi...-rom-building/




2. For creating Vendor tree




“Coming Soon”




Kernel




For kernel part if you are lucky than you can find your kernel source from Github or similar sources. If not you can use your prebuilt kernel Foolow this to extract your kernel http://azodik.com/how-to-create-devi...-rom-building/






Kernel location


/kernel/device_manufacturer_name/device_codename


Downloading your kernel


Manually download it and extract to kernel location or use following command


git clone “Github url” kernel/device_manufacturer_name/device_codename






Note1: You can use your prebuilt kernel. To use your prebuilt kernel edit BoardConfig.mk file in your device tree.


Note2: If you created device tree from scratch following my guide. Use of prebuilt kernel set to default






How to build


Use following command for building your rom




Source build/envsetup.sh
lunch

Now select your device from menu


3. make or mka
I hope you found it usefull. Please follow my website for interesting guide. Please comment here if you face any error.




Thank You
The Following 14 Users Say Thank You to jai44 For This Useful Post: [ View ] Gift jai44 Ad-Free
14th November 2016, 05:51 AM |#2  
sohamsen's Avatar
Senior Member
Flag Kolkata
Thanks Meter: 1,380
 
More
Really a great guide bro!
Can you please post a rom porting guide? easy to understand and effective
14th November 2016, 07:32 AM |#3  
OP Junior Member
Flag Jaipur
Thanks Meter: 49
 
More
Quote:
Originally Posted by sohamsen

Really a great guide bro!
Can you please post a rom porting guide? easy to understand and effective

Thank you very much. Sure i will post soon.
The Following 2 Users Say Thank You to jai44 For This Useful Post: [ View ] Gift jai44 Ad-Free
14th November 2016, 08:38 AM |#4  
sohamsen's Avatar
Senior Member
Flag Kolkata
Thanks Meter: 1,380
 
More
Quote:
Originally Posted by jai44

Thank you very much. Sure i will post soon.

14th November 2016, 03:25 PM |#5  
Member
Thanks Meter: 13
 
More
Nice tutor.. But it looks need an enormous data usage to do that. If i wanna porting rom for example slim rom nougat to my device (kenzo) can you give me some info how many data should i provide and how to do that? Thanks
14th November 2016, 05:57 PM |#6  
Anarchy16's Avatar
Senior Member
Flag sandakan
Thanks Meter: 274
 
More
thanks
15th November 2016, 08:26 PM |#7  
OP Junior Member
Flag Jaipur
Thanks Meter: 49
 
More
Quote:
Originally Posted by elanglangit

Nice tutor.. But it looks need an enormous data usage to do that. If i wanna porting rom for example slim rom nougat to my device (kenzo) can you give me some info how many data should i provide and how to do that? Thanks

You can follow this guide. Read it again and again. I hope soon you will build your own Rom. You can comment here if you face any problem
8th February 2017, 04:30 PM |#8  
Raja_12's Avatar
Member
Flag Chennai
Thanks Meter: 8
 
More
While compiling pure nexus. I got this error. How to solve thishttps://cloud.tapatalk.com/s/589b4795...71095280.jpeg?
9th February 2017, 03:35 AM |#9  
panzerox123's Avatar
Senior Member
Flag Bangalore
Thanks Meter: 828
 
More
@jai44 wow! you make it look so easy! :') I have subscribed to this thread. When I get free time, Ill build my own rom
Thank you so much!
7th July 2017, 06:19 PM |#10  
Senior Member
Thanks Meter: 21
 
More
not able to sync rr source...
2nd August 2017, 03:02 AM |#11  
After i type repo sync it doesnt do anything. I double checked my site direction and it appears to be fine. Any hints??
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes