FORUMS

Hauwei’s Rapid Rise to Third Place in the Smartphone Race

Huawei has quickly grown to become one of the world’s biggest … more

OnePlus 2 Bares All in New Tear Down Gallery

Last year, the launch of the OnePlus One, dubbed ‘the flagship killer’, visibly … more

Focus – An Attractive But Raw Gallery Replacement

Focus is an attractive new app built by XDA members Liam Spradlin … more

How to Root the LG G4 and Install TWRP Recovery – XDA TV

A rooting method has finally been found for the flagship LG G4. In this … more

[NOOB GUIDE][how to]build cm or cm based rom from source+support

8,730 posts
Thanks Meter: 22,008
 
Post Reply Subscribe to Thread Email Thread
****NOOB GUIDE ON HOW TO BUILD CM OR CM BASED ROM FROM SOURCE FOR S2****
****FULL SUPPORT ****


So guys from the concept of sharing and caring ..am going to share the way through which i have succeeded to compile my first rom based on omni source.
I will try to make this guide as much as easy ..so dont worry..and feel free to ask any doubt if u have..

Note: Most of the instructions are fit for Ubuntu running normally on any PC and not specific to Virtual Box
Things Required:

**Computer/Laptop with decent amount of ram (min 6gb)and also decent storage
**Internet connection(now thats obvious)
**Some knowledge about linux commands..like basic command such as cd for “change directory”,(anyways even if u dont know just copy and paste the codes given in the thread
**Last but not least "U must have android mobie" not an iphone (kidding)



This Guide will cover below things:

** How to install Ubuntu on virtual box
**How to set up Build environment
**How to build and compile rom
**transfer the zip from ubuntu to your phone

So lets begin

How to install ubuntu on Virtual box:

1. Download ubuntu from HERE(download ubuntu 12.04 LTS 64 bit)if u are having system with 2gb then pls dont try to compile

2. Download virtual box from HERE(download the latestwindows version x86/amd64)

3. After downloading vm click on it and select "NEXT"

4.Choose not to install USB support, networking, or Python support. Do this by clicking the grey icon near each option and selecting the red X or “Entire feature will be unavailable”. Then click “Next” to continue.



5.Uncheck the Quick Launch Bar checkbox and click “Next” to continue

6.Click install and finish.

7.Now click the new button at the top to create a new virtual machine.



8.Give your virtual machine a name and select the operating system you’ll be running(for e,g select version as ubuntu 64 if u are on 64bit os). Click “Next”.then slect create virtual hard drive now

9.now type the amount of memory ..(4gb is absolute minimum)

10.Click “Next” to create a new virtual hard disk, then click “Next” again

11.Select dyanmically allocated storage

12.now type the amount of storage(200 gb is minimum) and click create .

13.Select your new virtual machine. Once you've done this, click the “Settings” button.



14.Click “Storage” tab and Click the “CD/DVD icon" having "+" on it and select ISO to mount.



15.Click system on the left and Choose boot order and keep CD/DVD on the top as first priority.



16.Now close the settings window and Select your virtual machine. Then click the “Start” button

15.Now ubuntu will start and select the language

16.select install ubuntu



17.click continue and select the first radio button ..then hit continue again and install now(wait for some time)

18.Go through all the steps and finally u should have the below screen.(if u have got that screen then u are ok to proceed ahead )



16.So i assume you have got the ubuntu desktop .

17.click on ubuntu software centre avaliable on the left side and select edit/software sources



18.click on update tab and follow the screenshot below



19.After couple of min u should see update box is dancing on the left side , click that and install all the update packages


How to set up build environment:

1. Go to THIS awesome thread , I Bet u would not have any problem in setting up build environment if u had followed it correctly..

2.If u have any troubles in setting up build env then u are free to ask/post in this thread.

3.You can also set up adb and fast boot very easily instead of sdk tools (but remember it does not mean u can skip downloading sdk tools, you have to download all the packages .
Set up adb and fastboot with ease
4.you only need to download the below packages

JDK 6
Python
Git 1.7
Android SDK
ia32libs


So i assume you have set up your build environment successfully ..


How to build and compile :

1.We will install build packages needed to compile the rom.

2.Open your ubuntu terminal by pressing ctrl+alt+t

3.As of now u cannot copy/paste text between ubuntu and your windows ..so we will be installing guest addition cd image which u can install by clicking on Devices/install guest addition cd image .

4.it will install now , after that select Devices/share clipboard/bidirectional ..now reboot your ubuntu by typing the below code in terminal

Code:
sudo reboot
5.Now copy paste the below code in terminal to install build packages

Code:
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
Code:
sudo apt-get update
Code:
apt-get install g++-4.7 gcc-4.7
For 32-bit & 64-bit systems
Code:
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-6-jre openjdk-6-jdk pngcrush schedtool

For 64-bit only systems
Code:
g++-multilib lib32z1-dev lib32ncurses5-dev lib32readline-gplv2-dev gcc-4.7-multilib g++-4.5-multilib
6.You should not have any problem in installing the above packages if u had followed it correctly.

7.Now Create the directories

Code:
mkdir -p ~/bin
8.Install the repo command
:
Code:
curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
      chmod a+x ~/bin/repo
9.Important thing now is u have to put the bin directory in your path of execution..to do so ..copy and paste the below code

Code:
export PATH=${PATH}:~/bin
10. type
Code:
gedit ~/.bashrc
and now paste
Code:
export PATH=${PATH}:~/bin
11.save it by pressing ctrl+x

12. now we have to create a directory in which our source will get downloaded

Code:
mkdir -p dirname
(type the directory name )

Code:
cd dirname
13.Now its time for us to initialize the repository

Syntax :

Code:
 repo init -u url -b branch
for e.g am going to fetch omni source..so i wil type as

Code:
repo init -u https://github.com/omnirom/android.git -b android-4.4
for pacman

Code:
repo init -u git://github.com/PAC-man/pacman.git -b pac-4.4
for slimbean( google, exynos and non qcom devices)

Code:
repo init -u git://github.com/SlimRoms/platform_manifest.git -b kk4.4
slimbean(for qcom devices which are using CodeAuroraForum trees)

Code:
repo init -u git://github.com/SlimRoms/platform_manifest.git -b kk4.4-caf
for cm

Code:
repo init -u git://github.com/CyanogenMod/android.git -b cm-11.0
14.then go to THISanother awesome thread to understand about the local manifest ,manifest and many more..(this thread is highly recommended to those who have poor internet connection)

15.IF u are lazy and dont want to go throu the above thread then u can skip and follow the below steps.

16.type
Code:
repo sync -c -j4
Note: if u have low bandwidth the use -j2 instead of -j4 and if u have good internet connection use -j16 instead of -j4
repo sycn -c will download only the current version so it saves time for u

17.repo sync will take more time..(for me it took 3 days to complete because my internet speed was 50kb/sec

18.After repo sync is done u have to fetch some additional repoistory using local_manifest.xml
Code:
 <remote fetch="https://github.com/DonkeyCoyote" name="donkey" />
 <project name="DonkeyCoyote/proprietary_vendor_samsung" path="vendor/samsung" remote="github" revision="android-4.4" />
<project name="android_device_samsung_i9100" path="device/samsung/i9100" remote="omnirom" revision="android-4.4" />
<project name="android_device_samsung_galaxys2-common" path="device/samsung/galaxys2-common" remote="omnirom" revision="android-4.4" />
thanks to chasmodo

note: above is an example for omni rom...if u are fetching aokp,pac etc then u have to change the path , remote , revision accordingly

19.Let's configure ccache too. It will reduce the build time to 40% after first build

Code:
 echo "export USE_CCACHE=1" >> ~/.bashrc
Code:
 directoryname/prebuilts/misc/linux-x86/ccache/ccache -M 25G
25G means it will use upto 25 gb of disk space for ccaching. Atleast 10 gb is recommended.

20.Now its time for compiling .simply type
Code:
. build/envsetup.sh
Code:
brunch i9100
21.it may take some time depending upon your pc/laptop configuration

22.u should get package complete at the end..(unfortunately i could not save screenshot of that..but soon s.s will be posted when i repo sync again)

23.If yes then u have successfully built your rom ..congrats

24.now how to transfer that zip to the phone for flashing?..follow the below steps


how to transfer files from ubuntu to your phone:

1: Download and install the AirDroid app to your Android device.

2: Launch the app and read the starter guide. As soon as you’re done, click “Start”.

3: Take note of the web address that is being shown on the app. You’ll need that web address to access your smartphone through your computer’s web browser.

4.now type the code in ubuntu browser and there u go ...u have connected your phone to ubuntu.

5.transfer the file by selection files/sdcard/upload

6.Done


Hope this guide helps u the most.
IF U HAVE ANY QUESTION FEEL FREE TO POST ..cheers.

GOOD LUCK


Credits:
@Myself5 (this guy really deserves it)
@chasmodo @engloa
google

Hit the thanks button if u think it deserves to have..
Last edited by Vivek_Neel; 8th January 2014 at 03:08 PM.
The Following 65 Users Say Thank You to Vivek_Neel For This Useful Post: [ View ]
 
 
6th January 2014, 12:25 PM |#2  
-Grift-'s Avatar
Recognized Contributor
Flag Singapore
Thanks Meter: 1,990
 
More
Nice!
The Following 2 Users Say Thank You to -Grift- For This Useful Post: [ View ]
6th January 2014, 12:41 PM |#3  
Vivek_Neel's Avatar
OP Recognized Contributor / Themer
Flag chennai
Thanks Meter: 22,008
 
Donate to Me
More
Quote:
Originally Posted by -Grift-

Nice!

Thanks buddy.

Took me 3hr to write.. Phew

Sent from my GT-I9100 using Tapatalk 2
The Following 9 Users Say Thank You to Vivek_Neel For This Useful Post: [ View ]
6th January 2014, 01:27 PM |#4  
-Grift-'s Avatar
Recognized Contributor
Flag Singapore
Thanks Meter: 1,990
 
More
Quote:
Originally Posted by corruptionfreeindia

Thanks buddy.

Took me 3hr to write.. Phew

Sent from my GT-I9100 using Tapatalk 2

*Browser crashes just before you get to post* FUUUUUU
The Following 2 Users Say Thank You to -Grift- For This Useful Post: [ View ]
6th January 2014, 01:30 PM |#5  
Senior Member
Flag Bangalore
Thanks Meter: 35
 
More
Will Surely try................... Great effort thou.....
The Following User Says Thank You to axlslash_gnr For This Useful Post: [ View ]
6th January 2014, 01:46 PM |#6  
johnny208's Avatar
Senior Member
Flag Ploiesti
Thanks Meter: 61
 
More
Although this is of immense help, IMO this shows the huge amount of work put out by our ROM developers.
So, thank you @cfi and hopefully some new devs will grow out of this.

Sent from my GT-I9100 using XDA Premium 4 mobile app
The Following 2 Users Say Thank You to johnny208 For This Useful Post: [ View ]
6th January 2014, 02:06 PM |#7  
Sun90's Avatar
Recognized Contributor
Flag MYSORE - KARNATAKA - INDIA
Thanks Meter: 8,858
 
More
Quote:
Originally Posted by corruptionfreeindia

Thanks buddy.

Took me 3hr to write.. Phew

Sent from my GT-I9100 using Tapatalk 2

It took me 3hr to read and Digest Phew!!U should also Add the Min Hardware requirement to the guide
The Following 3 Users Say Thank You to Sun90 For This Useful Post: [ View ]
6th January 2014, 02:23 PM |#8  
engloa's Avatar
Forum Moderator
Here & There ...
Thanks Meter: 15,390
 
More
Quote:
Originally Posted by Sun90

It took me 3hr to read and Digest Phew!!U should also Add the Min Hardware requirement to the guide

Min hardware requirement of what mate?
if you mean virtualbox, you can check this out
The Following 2 Users Say Thank You to engloa For This Useful Post: [ View ]
6th January 2014, 02:38 PM |#9  
Sun90's Avatar
Recognized Contributor
Flag MYSORE - KARNATAKA - INDIA
Thanks Meter: 8,858
 
More
Quote:
Originally Posted by engloa

Min hardware requirement of what mate?
if you mean virtualbox, you can check this out

The system (computer) hardware requirement ma8
The Following User Says Thank You to Sun90 For This Useful Post: [ View ]
6th January 2014, 02:54 PM |#10  
Troubadour666's Avatar
Recognized Contributor
Flag 43.7031 - 7.2661
Thanks Meter: 6,446
 
More
Thanks "again" for a "monster" thread
The Following 4 Users Say Thank You to Troubadour666 For This Useful Post: [ View ]
6th January 2014, 02:57 PM |#11  
Vivek_Neel's Avatar
OP Recognized Contributor / Themer
Flag chennai
Thanks Meter: 22,008
 
Donate to Me
More
Quote:
Originally Posted by Sun90

It took me 3hr to read and Digest Phew!!U should also Add the Min Hardware requirement to the guide

Sure buddy..I will.

Am already tired.

Have to go college tomo

Sent from my GT-I9100 using Tapatalk 2
Last edited by Vivek_Neel; 6th January 2014 at 05:55 PM.
The Following User Says Thank You to Vivek_Neel For This Useful Post: [ View ]

Read More
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes