[GUIDE]Compile CM 11 on Ubuntu 14.04 for Moto E

Status
Not open for further replies.
Search This thread
Y

yeshwanthvshenoy

Guest
How to build your own CyanogenMod 11 ROM from sources for the Moto E




As you all know inorder to compile any rom based on source codes we need a linux environment. We can also use Virtual Machine on Windows but i find it slower when compared to a linux dual boot or linux os totally! So for budding developers i shall write this guide on how to setup Ubuntu 14.04 LTS Trusty Tahr 64 bit version to compile android roms. Please note that 32 bit is not supported to compile roms. So, lets get started!​





Requirements:

  • PC with
  • Moto E
  • Good internet connection
  • Knowledge of logcat and debugging




I wont be doing through on how to dual boot or install Ubuntu there are many videos on youtube so search them up and get Ubuntu installed! Now open a fresh terminal and do the following:




1) Copy and paste it into a terminal window:

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

This will remove OpenJDK if you have it pre-installed.



2) Copy and paste the following into the terminal:

Code:
sudo add-apt-repository ppa:webupd8team/java

This will add the correct PPA to your system for updated builds of Java 6 JDK that are compatible with Ubuntu 14.04.



3) Now you need to install the package. Copy and paste the following into the terminal:

Code:
sudo apt-get update && sudo apt-get install oracle-java6-installer

Wait.

Follow the on-screen instructions. You must accept the Licensing Agreement to complete the install.

Press Enter to acknowledge the "OK", then tab over to "Yes" and press Enter again to accept the license. The installation will continue automatically.



4) Make sure the correct version of Java is activated. Run the terminal command:

Code:
java -version

You should see or something similar:

Code:
java version "1.6.0_45"
Java(TM) SE Runtime Environment (build 1.6.0_45-b06)
Java HotSpot(TM) 64-Bit Server VM (build 20.45-b01, mixed mode)

Close and open a new terminal.



5) Install the main build tools with this command:

Code:
sudo apt-get install git gnupg ccache lzop flex bison gperf build-essential zip curl zlib1g-dev zlib1g-dev:i386 libc6-dev lib32bz2-1.0 lib32ncurses5-dev x11proto-core-dev libx11-dev:i386 libreadline6-dev:i386 lib32z1-dev libgl1-mesa-glx:i386 libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown libxml2-utils xsltproc libreadline6-dev lib32readline-gplv2-dev libncurses5-dev bzip2 libbz2-dev libbz2-1.0 libghc-bzlib-dev lib32bz2-dev squashfs-tools pngcrush schedtool dpkg-dev



6) When they are installed, run the next line in your terminal window:

Code:
sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so

That's it packages are done! Now for the sources!



7) Install "repo" using this command:

Code:
mkdir ~/bin && curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo && chmod a+x ~/bin/repo



8) Now open .bashrc using Nano:

Code:
sudo nano ~/.bashrc



9) At the end of the page paste this code to a new line:

Code:
export PATH=~/bin:$PATH



10) Save it using Ctrl+O and then Enter. Then Ctrl+X to exit.



11) Restart bash using this command:

Code:
source ~/.bashrc



11) In the terminal, navigate to where you would like to download the Android source code. I will be placing it in "/home/user/" modify according to ur wish.

Code:
mkdir ~/cm11
cd ~/cm11

Now configure Git using:

Code:
git config --global user.email "example@mail.com"

Replace "example@mail.com" with your mail id of github

and also

Code:
git config --global user.name "name"

Replace "name" with your name




12) Now initialize the repo using:

Code:
$ repo init -u git://github.com/CyanogenMod/android.git -b cm-11.0

The above command is for CM 11 you also do it for other flavours of custom roms too! I will add how to initialise repos for other flavours in second post soon!



13) Now start downloading the sources!!

Code:
repo sync

It takes around 11gb so here is where your internet connection plays a major role!! Sit back and do your other works till then!

And your ready to compile your rom when the sources are fully downloaded!!



14) Initialize the build environment:

Code:
$ .build/envsetup.sh



15) Add repositories for the MOTO E by creating two files in the local_manifests directory. To see this directory, you have to press Ctrl+H in your file manager. If the directory isn't there, create using

Code:
$ mkdir ~/cm11/.repo/local_manifests



16) Use this code to create the file condor.xml

Code:
$ gedit ~/cm11/.repo/local_manifests/condor.xml



17) Paste the following lines using an editor to the name.xml:

Code:
<manifest>
<project name="CyanogenMod/android_device_qcom_common" path="device/qcom/common" remote="github" revision="cm-11.0"/>
<project name="CyanogenMod/android_device_motorola_qcom-common" path="device/motorola/qcom-common" remote="github" revision="cm-11.0"/>
<project name="CyanogenMod/android_device_motorola_name" path="device/motorola/name" remote="github" revision="cm-11.0"/>
<project name="CyanogenMod/android_kernel_motorola_msm8210" path="kernel/motorola/msm8210" remote="github" revision="cm-11.0"/>
<project name="CyanogenMod/android_device_motorola_msm8210-common" path="device/motorola/msm8210-common" remote="github" revision="cm-11.0"/>
<project name="CyanogenMod/android_hardware_qcom_display-caf-new" path="hardware/qcom/display-caf-new" remote="github" revision="cm-11.0"/>
<project name="CyanogenMod/android_hardware_qcom_media-caf-new" path="hardware/qcom/media-caf-new" remote="github" revision="cm-11.0"/>
<project name="CyanogenMod/android_hardware_qcom_fm" path="hardware/qcom/fm" remote="github" revision="cm-11.0"/>
</manifest>

Save the file and exit.



18) Use this code to create the file vendor.xml using the command:

Code:
$ gedit ~/cm11/.repo/local_manifests/vendor.xml



19) Paste the following lines using an editor to vendow.xml:

Code:
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
  <project path="vendor/motorola" name="TheMuppets/proprietary_vendor_motorola" remote="github" revision="cm-11.0"/>
</manifest>

Save the file and exit.



20) Now copy paste the command in terminal:

Code:
$ repo sync

To get the files needed.



21) Download the necessary prebuilts from cyanogenmod by copy pasting in terminal:

Code:
$ cd ~/cm11
$ vendor/cm/get-prebuilts



21) Now building the rom:

Code:
$ brunch condor




For any help or issues you can post your issues/doubts at this thread and people there will help you!



Congrats!!!You are now set to become a Developer soon!!

First building process will take from 3 hours to12 hours based on your computer specifications. Later builds will take lesser time!After the ROM has been successfully compiled you will find your new ROM in ~/cm11/out/target/product/name. It will be as cm-11-DATE-UNOFFICIAL-condor-zip. You can flash it via CWM/TWRP. Use adb and fastboot to logcat and debug your issues!


Credits:

@sylentprofet - setting up environment on Ubuntu 14.04
@Red Devil - repos, manifest and other info
@x10forevers - how to source build tutorial​
 
Last edited:
Y

yeshwanthvshenoy

Guest
Build other flavours of android

Initialise repo for other android flavours of android:



Replace step #12 by these:



a) AOSP-4.4.2:

Code:
repo init -u https://android.googlesource.com/platform/manifest -b android-4.4.2_r1

b) CM-11:

Code:
repo init -u git://github.com/CyanogenMod/android.git -b cm-11.0

c) MoKee:

Code:
repo init -u https://github.com/MoKee/android.git -b kk_mkt

d) Omni:

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

e) PAC:

Code:
repo init -u git://github.com/PAC-man/pacman.git -b pac-4.4

f) Carbon:

Code:
repo init -u https://github.com/CarbonDev/android.git -b kk
 
Last edited:

cybojenix

Retired Forum Mod / Retired Recognized Developer
Apr 7, 2012
801
1,864
So..... Nice guide that points to a device with no published sources yet...

It's not on cyanogenmod yet
The common folders won't be called 8210

This is a general waste of time. It's pointless having guides on every single device section for building.

Sent from my Nexus 7 using Tapatalk
 
Y

yeshwanthvshenoy

Guest
So..... Nice guide that points to a device with no published sources yet...

It's not on cyanogenmod yet
The common folders won't be called 8210

This is a general waste of time. It's pointless having guides on every single device section for building.

Sent from my Nexus 7 using Tapatalk

perhaps could aspire users to develop and enable noobs to give a try!
 

storm11

Senior Member
Apr 3, 2011
538
426
29
Bangalore
So..... Nice guide that points to a device with no published sources yet...

It's not on cyanogenmod yet
The common folders won't be called 8210

This is a general waste of time. It's pointless having guides on every single device section for building.

Sent from my Nexus 7 using Tapatalk

Haha was thinking the same , cm without sources , looks like copy paste !
 
  • Like
Reactions: ashwin007
Y

yeshwanthvshenoy

Guest
Haha was thinking the same , cm without sources , looks like copy paste !

well not exactly, the part of setting up environment on Ubuntu 14.04 was referred from various guides and made noob free. Building part is my work. You can check around xda if you feel it is copy paste. Am building for Moto G and believe both processes are same so made a thread for people here to help develop easily.
 

TheStrix

Recognized Developer
May 10, 2014
680
6,374
Mumbai
Initialise repo for other android flavours of android:



Replace step #12 by these:



a) AOSP-4.4.2:

Code:
repo init -u https://android.googlesource.com/platform/manifest -b android-4.4.2_r1

b) CM-11:

Code:
repo init -u git://github.com/CyanogenMod/android.git -b cm-11.0

c) MoKee:

Code:
repo init -u https://github.com/MoKee/android.git -b kk_mkt

d) Omni:

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

e) PAC:

Code:
repo init -u git://github.com/PAC-man/pacman.git -b pac-4.4

f) Carbon:

Code:
repo init -u https://github.com/CarbonDev/android.git -b kk


I think, if we are building PAC ROM, u will have to replace this command for step #14

Code:
$ ./build-pac.sh
 

raj.amalw

Senior Member
May 16, 2011
251
99
Chennai
What would be the expected build time in an i7 laptop with 8 GB ram ?

Sent from my XT1022 using XDA Free mobile app
 

einspark

New member
Oct 9, 2014
3
0
Motorola kernel msm 8210 repository removed

Hi,
I have been trying to clone the CM repository. The local manifest contains
device/motorola/msm8210-common and
device/motorola/msm8210 for which the repositories which has been either moved or removed. I found the the motorola kernel for the device at github.com/MotorolaMobilityLLC/kernel-msm but i'm not sure what changes in the local manifest has to be made. can anybody halp me out with it?
 
Status
Not open for further replies.

Top Liked Posts

  • There are no posts matching your filters.
  • 2
    So..... Nice guide that points to a device with no published sources yet...

    It's not on cyanogenmod yet
    The common folders won't be called 8210

    This is a general waste of time. It's pointless having guides on every single device section for building.

    Sent from my Nexus 7 using Tapatalk
    1
    Thanks for the guide...:laugh:
    1
    So..... Nice guide that points to a device with no published sources yet...

    It's not on cyanogenmod yet
    The common folders won't be called 8210

    This is a general waste of time. It's pointless having guides on every single device section for building.

    Sent from my Nexus 7 using Tapatalk

    Haha was thinking the same , cm without sources , looks like copy paste !