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

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
4gb RAM(minimum)
i3 or above processor(i7 recommended)
Ubuntu OS (installed)
Moto E
Good internet connection
Knowledge of logcat and debugging
Click to expand...
Click to collapse
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 "[email protected]"
Replace "[email protected]" 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​
Click to expand...
Click to collapse

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

debug info
faq for common errors and solutions to help build process easier!
coming soon!
Click to expand...
Click to collapse

Thanks for the guide...:laugh:

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

cybojenix said:
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
Click to expand...
Click to collapse
perhaps could aspire users to develop and enable noobs to give a try!

cybojenix said:
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
Click to expand...
Click to collapse
Haha was thinking the same , cm without sources , looks like copy paste !

karthiknayak94 said:
Haha was thinking the same , cm without sources , looks like copy paste !
Click to expand...
Click to collapse
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.

sources
so the sources are out now, perhaps update the guide

yeshwanthvshenoy said:
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
Click to expand...
Click to collapse
I think, if we are building PAC ROM, u will have to replace this command for step #14
Code:
$ ./build-pac.sh

kdomn37 said:
so the sources are out now, perhaps update the guide
Click to expand...
Click to collapse
TheStrix said:
i shall update the guide soon! exams till june 20! after that will get u guys!
I think, if we are building PAC ROM, u will have to replace this command for step #14
Code:
$ ./build-pac.sh
Click to expand...
Click to collapse
i ll check bro thanks havnt built pac till now!

What would be the expected build time in an i7 laptop with 8 GB ram ?
Sent from my XT1022 using XDA Free mobile app

raj.amalw said:
What would be the expected build time in an i7 laptop with 8 GB ram ?
Sent from my XT1022 using XDA Free mobile app
Click to expand...
Click to collapse
first build takes more time roughly around 1-2 hours after that all builds take 20 mins or so!

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?

where's kernel source for device ?

Motorola kernel msm 8210 repository removed
andrman1 said:
where's kernel source for device ?
Click to expand...
Click to collapse
I've used the kernel forked from motorola by github.com/cybojenix/kernel_motorola_condor

Thread closed

Related

[GUIDE CM11] How to made your own ROM based on CyanogenMod for the Note2

Make your 'own' KitKat ROM!
Overview
1. Installation of the required packages
2. Installing Java
3 The sources
5. Building the ROM
6. Rebuilding with newest sources
Installation of the required packages
Installation of the required packages (Ubuntu 13.10 64-bit)
Install packages:
Code:
sudo apt-get install bison build-essential curl flex \
g++-multilib gcc-multilib git-core gnupg gperf \
lib32ncurses5-dev lib32readline-gplv2-dev lib32z1-dev \
libesd0-dev libncurses5-dev libsdl1.2-dev \
libwxgtk2.8-dev libxml2 libxml2-utils lzop \
openjdk-6-jdk openjdk-6-jre pngcrush schedtool \
squashfs-tools xsltproc zip zlib1g-dev
Install java:
Code:
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java6-installer
Check java version
Code:
java -version
Set java oracle as default
Code:
sudo update-alternatives --config java
The sources
Install repo:
Note: Repo is a tool that makes it quite easy to download and maintain the sources of Cyanogenmod.
Code:
mkdir ~/bin
PATH=~/bin:$PATH
cd ~/bin
curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
Create the working directory:
Note: you can create the working directory where ever you want
Code:
mkdir ~/rom
cd ~/rom
Now Initialize Repo:
Code:
repo init -u git://github.com/CyanogenMod/android.git -b cm-11.0
Download the CM sources "this is the base only" :
Note: takes some time to download the hefty 12 GB of source code! and a locate about 18GB space from storage
Code:
repo sync
great, your clean base is ready for your creativity
Let's go!
Start making your manifest :
you need to add proprietary vendor , device stuff, samsung kernel, samsung kernel common
proprietary vendor:
there two awesome proprietary for samsung:
1- by TheMuppets https://github.com/TheMuppets/proprietary_vendor_samsung/tree/cm-11.0
2- by xplodwild https://github.com/DonkeyCoyote/proprietary_vendor_samsung/tree/android-4.4
actually the both very strong and up-to-date , but i using the one by xplodwild
create new empty file "roomservice.xml" in path "~/rom/.repo/local_manifests/":
samsung kernel:
you can use CM Stock Kernel
1- https://github.com/CyanogenMod/android_kernel_samsung_smdk4412
you can use an custom kernel like devil kernel
2- https://github.com/DerTeufel/android_kernel_samsung_smdk4412/
Code:
cd ~/rom/.repo/local_manifests/ && echo "" > roomservice.xml
Edit the file:
Code:
gksu gedit ~/rom/.repo/local_manifests/roomservice.xml
add the following:
Code:
<!-- proprietary vendor -->
<project name="DonkeyCoyote/proprietary_vendor_samsung" path="vendor/samsung" remote="github" revision="android-4.4" />
<!-- device stuff-->
<project name="CyanogenMod/android_device_samsung_n7100" path="device/samsung/n7100" remote="github" />
<!-- samsung kernel common -->
<project name="CyanogenMod/android_device_samsung_smdk4412-common" path="device/samsung/smdk4412-common" remote="github" />
<!-- cm stock - samsung kernel -->
<project name="CyanogenMod/android_kernel_samsung_smdk4412" path="kernel/samsung/smdk4412" remote="github" />
Save the file.
Now download your manifests stuff:
Code:
repo sync
Now to get the files needed
Note: required for the first time after you added device repo
Code:
cd ~/rom/vendor/cm
. get-prebuilts
cd ~/rom/
Building the ROM:
Note: Breakfast is a function used to configure your build. It keeps track of a list of officially-supported devices to build
Building takes around 2 hour on fast systems and a lot more on older and slower machines, first time take more than second time
more info : http://wiki.cyanogenmod.org/w/Build_for_n7100
Run :
source build/envsetup.sh && breakfast n7100 && brunch n7100
Click to expand...
Click to collapse
Done !
Happy building! ... Happy Easter Eggs
Next Course will include :
How Setup GITHUB
How make REPOs
How pick an feature from another ROM using cherry-pick !!
How commit and upload your changes
How handling and understand the errors while compiling
reversed
reversed again

{Guide} [HOW TO]Building CM11 from source for i9082/L

Here are the steps to build your own kernel from source. This guide is showing you how to build your first the stock kernel on your own..... It is kick start for making things on your own way....
This guide applies to i9082/i9082L and general devices also.:laugh:
This guide assumes you have basic knowledge of linux and linux system configuration.
Prerequisites
Quote:
HTML:
1. Ubuntu 13.10 / BBQLINUX (I personally use this)
2. patience...lots and lots of patience.
Here starts the fun:-
1. Installing ubuntu 13.10.
Quote:
This can be done in 3 ways and I am not gonna cover it all.
- along with windows ,i.e dual boot
- in virtualbox within windows
- as a windows application installation with "wubi" installer
For starting user i think second option, i.e installing in virtualbox is best.
here's starting tutorials
http://www.youtube.com/watch?v=tDDRFiwHujg
NOTE - you should have atleast 100 Gb partion for virtualbox.
2. Setting up building environment.
PHP:
THIS ALL BELOW STEPS ARE NOT NEEDED IF YOU HAVE INSTALLED BBQLINUX, BUILDING ENVIRONMENT IS SET IN BBQLINUX BY DEFAULT. IT WORKS OUT-OF-THE-BOX.
Initializing a fresh Android Build Environment in Ubuntu 13.10 sucks, right? The instructions at the AOSP page are outdated and inaccurate. Near as I can tell, they try to have you install 2 JDKs, the first one not even being the correct link for Saucy Salamander, and the second being OpenJDK. Which might work. But I dunno about all that, I’d rather have Oracle’s official stamp when it comes to building for Android.
Currently most of the guides are up to 12.04 LTS, which is fine and dandy, but being on the cutting edge is nice too.
This guide applies to all variations of Ubuntu 13.10 Saucy Salamander 64 bit. Do not use the 32 Bit version. Also, PAY CLOSE ATTENTION when to use “sudo” and when to not. It can make things funky if you do something as root that you shouldn’t.
Much thanks goes out to Google, ProTekk, Canonical, and everyone else that I read a random paragraph here and snippet there.
First, let’s set up the correct JDK.
Many of you probably have some kind of wrong Java installed unless you’re starting with a fresh Ubuntu base, and even then maybe.
Let’s get rid of that. Copy and paste this into a Terminal window:
Code:
PHP:
sudo apt-get purge openjdk-\* icedtea-\* icedtea6-\*
Follow the instructions to remove OpenJDK.
If you must keep it, it’s possible. But I’m not going to tell you how to do it here. I don’t want any chance of confusion or mistake.
Now copy and paste the following into the Terminal:
Code:
PHP:
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 13.10.
No more unrecognized Java version errors! And it will update automatically with the rest of your system.
Next, we actually need to install the package. More copy-paste:
Code:
PHP:
sudo apt-get update && sudo apt-get install oracle-java6-installer
Follow the on-screen instructions. You have to Accept the Licensing Agreement to complete the install. Hopefully no human centipede clauses.
Let’s make sure the correct version of Java is activated, run the following Terminal command:
Code:
PHP:
java -version
You should see something like the following:
Code:
PHP:
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.12-b01, mixed mode)
Ok, back to a fresh Terminal prompt. Time for installing the guts to build stuff in Ubuntu:
Code:
PHP:
sudo apt-get install git-core gnupg ccache lzop flex bison gperf build-essential zip curl zlib1g-dev zlib1g-dev:i386 libc6-dev lib32ncurses5 lib32z1 lib32bz2-1.0 lib32ncurses5-dev x11proto-core-dev libx11-dev:i386 libreadline6-dev:i386 lib32z-dev libgl1-mesa-glx:i386 libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown libxml2-utils xsltproc readline-common libreadline6-dev libreadline6 lib32readline-gplv2-dev libncurses5-dev lib32readline5 lib32readline6 libreadline-dev libreadline6-dev:i386 libreadline6:i386 bzip2 libbz2-dev libbz2-1.0 libghc-bzlib-dev lib32bz2-dev libsdl1.2-dev libesd0-dev squashfs-tools pngcrush schedtool libwxgtk2.8-dev python
When that is done installing, run the following command in your Terminal window:
Code:
PHP:
sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so
That’s it on the package side of things.
You guessed it, time for more Terminal. This really is the easiest way, seriously. And it’s totally worth it when you’re basking in the glory of a bunch of people on XDA.
The binary for a program called “repo” will let you talk to git servers and download all that precious source code. That second part after the && allows it to be executable:
Code:
PHP:
mkdir ~/bin && curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo && chmod a+x ~/bin/repo
Use your favorite text editor to open ~/.bashrc
I like nano:
Code:
PHP:
sudo nano ~/.bashrc
At the very bottom, add the following line:
Code:
PHP:
export PATH=~/bin:$PATH
Save it. In nano that would be Ctrl-O and then Enter. Then Ctrl-X to exit back to a prompt. Restart bash:
Code:
PHP:
source ~/.bashrc
That should be everything. Now you’re ready to build Android the right way. Luck!
3. Downloading source
Open terminal
To initialize your local repository using the CyanogenMod trees, use a command like this:
HTML:
mkdir cm11
cd cm11
repo init -u git://github.com/CyanogenMod/android.git -b cm-11.0
Create local_manifest.xml in .repo folder.
PHP:
cd .repo
nano local_manifest.xml
Paste following into the terminal
PHP:
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<project path="device/samsung/i9082" name="pawitp/android_device_samsung_i9082" remote="github" revision="cm-11.0" />
<project path="vendor/samsung/i9082" name="k2wl/android_vendor_samsung_i9082" remote="github" revision="master" />
<project path="kernel/samsung/i9082" name="pawitp/android_kernel_samsung_i9082" remote="github" revision="cm-11.0" />
</manifest>
Save it. In nano that would be Ctrl-O and then Enter. Then Ctrl-X to exit back to a prompt. Restart bash.
Then to sync up:
HTML:
repo sync -j#
# is number of jobs you want to give for your downloading source. I use 2.
Download gonna be huge. Approx 12-15 GB.
So its gonna take while depending upon your internet connection.
You may get errors while downloading, like
HTML:
Sync exited due to fetch errors
Just restart download by
HTML:
repo sync
4. Starting Building process
PHP:
. build/envsetup.sh && time brunch i9082 -j#
Again # is meant for No. of CPU cores you have.
Building gonna take time, depending upon your computer configuration.
Any errors, post here.
I will try my best to solve problems .
Start building your own CM11...
Any suggestion welcome.
reserved for future use.
one more
Just last in case
THANKS K2wl for this amazing guide.
k2wl said:
Here starts the fun
Click to expand...
Click to collapse
Wow that's a really good guide.
You make building from a ROM/Kernel from source much simpler than it should be.
I just replaced my 12.04 LTS with 13.10 last night, was wondering if I shouldn't have, but if it's working good for your development, think I'll keep it for a while. And yes, building a fresh android build environment sucks
I'm new to android development, but so far the linux, java and php code seems mostly regular. Gonna start with kernel first, then maybe try my hand on building a ROM. Thank you for the guide! :good:
iceyhotguy said:
Wow that's a really good guide.
You make building from a ROM/Kernel from source much simpler than it should be.
I just replaced my 12.04 LTS with 13.10 last night, was wondering if I shouldn't have, but if it's working good for your development, think I'll keep it for a while. And yes, building a fresh android build environment sucks
I'm new to android development, but so far the linux, java and php code seems mostly regular. Gonna start with kernel first, then maybe try my hand on building a ROM. Thank you for the guide! :good:
Click to expand...
Click to collapse
Good. Thats the spirit.
keep 13.10. its good.
i switched to BBQLINUX just few days, until earlier i was using 13.10.
kernel develpment is not much hussle.
just be sure...dont add features which make kernel unstable.
i statred with kernel development only...:good::laugh:
and then come to ROM development.
best luck..
if any queries regarding kernel or ROM development, just ask me...i am here to help.
this can be used to build other roms too right .... by just changing the github repo to the rom u wanna build
One more question, how to apply patches?
But, k2wl.
This method builds an Odin flashable file.
How to make flashable zips, which can be flashed through custom recoveries.????
Sent from my iPhone using Tapatalk
rutvikrvr said:
this can be used to build other roms too right .... by just changing the github repo to the rom u wanna build
Click to expand...
Click to collapse
yes its gonna be useful to build other AOSP based roms. like PA,AOKP,OMNI,AICP etc... just need few modifications according to respective roms.
black87 said:
One more question, how to apply patches?
Click to expand...
Click to collapse
copy the patch file to respective directory and apply patch with following command.
HTML:
patch -p1 < patch.diff
eg. if you want to apply bluetooth patch and ur patch name is fixbluetooth.diff
then
HTML:
cd hardware/broadcom/libbt/
git checkout .
patch -p1 < fixbluetooth.diff
if any problems plz tell me..
Ateekujjawal said:
But, k2wl.
This method builds an Odin flashable file.
How to make flashable zips, which can be flashed through custom recoveries.????
Sent from my iPhone using Tapatalk
Click to expand...
Click to collapse
It builds flashable zips only ......with CWM or any other....
@k2wl im getting this error http://pastebin.com/uLy1MGew
rutvikrvr said:
@k2wl im getting this error http://pastebin.com/uLy1MGew
Click to expand...
Click to collapse
check slimrom's github source. instructions are given there.
also @k2wl said that you have to make some other modifications.
Did you try the breakfast command???
rutvikrvr said:
@k2wl im getting this error http://pastebin.com/uLy1MGew
[email protected]:~/slimrom$ . build/envsetup.sh && time brunch i9082 -j4
including device/generic/armv7-a-neon/vendorsetup.sh
including device/generic/x86/vendorsetup.sh
including device/generic/mips/vendorsetup.sh
including vendor/slim/vendorsetup.sh
including sdk/bash_completion/adb.bash
including vendor/slim/vendorsetup.sh
ls: cannot access device/*/i9082/slim.mk: No such file or directory
build/core/product_config.mk:231: *** Can not locate config makefile for product "slim_i9082". Stop.
Device i9082 not found. Attempting to retrieve device repository from SlimRoms Github (http://github.com/SlimRoms).
Repository for i9082 not found in the SlimRoms Github repository list. If this is in error, you may need to manually add it to .repo/local_manifests/slim_manifest.xml
ls: cannot access device/*/i9082/slim.mk: No such file or directory
build/core/product_config.mk:231: *** Can not locate config makefile for product "slim_i9082". Stop.
** Don't have a product spec for: 'slim_i9082'
** Do you have the right repo manifest?
No such item in brunch menu. Try 'breakfast'
real 0m22.876s
user 0m0.219s
sys 0m0.087s
Click to expand...
Click to collapse
your device folder points to device named cm_i9082, not slim_i9082. thats why.
jst open cm.mk file in device/samsung/i9082 cm.mk and edit its content to slim.
means
if it says in the line cm_i9082 change it to slim_i9082.
save it.
rename the file to slim.mk
and change one more file which will point to slim.mk
i.e androidproducts.mk
change the
HTML:
PRODUCT_MAKEFILES := \ $(LOCAL_DIR)/device_i9082.mk
to
HTML:
PRODUCT_MAKEFILES := \ $(LOCAL_DIR)/slim.mk
after that one more file to be created.
slim.dependencies.
just rename cm.dependencies to slim.dependencies.
and then try that command again.
i am attaching files for you.
jst replace them. or edit as you like.
---------------------------------------------------------------------------------------------------------------------
good to know some one started something.
you downloaded source. thats great....keep up... i will help you as much as i can....
rutvikrvr said:
@k2wl im getting this error http://pastebin.com/uLy1MGew
Click to expand...
Click to collapse
Or simply use i9082 device tree for SlimROMs from my Github. I have made all the necessary changes.
xenon92 said:
Or simply use i9082 device tree for SlimROMs from my Github. I have made all the necessary changes.
Click to expand...
Click to collapse
yep....that will do....
but i think untill and unless he do it himself, he wont understand....
@xenon92 as k2wl is saying.. Il try on my own first otherwise I'll use ur device tree if I'm not able to do it at all... Thanx fr the reply.
Sent from my GT-I9082 using XDA Premium 4 mobile app
EDIT: ITS STARTED BUILDING ..THANX FR THE SUPPORT
rutvikrvr said:
@xenon92 as k2wl is saying.. Il try on my own first otherwise I'll use ur device tree if I'm not able to do it at all... Thanx fr the reply.
Sent from my GT-I9082 using XDA Premium 4 mobile app
EDIT: ITS STARTED BUILDING ..THANX FR THE SUPPORT
Click to expand...
Click to collapse
thats the spirit of learning...keep up...
one more error http://pastebin.com/wcuPHsi0 ..pl help
device/samsung/i9082/overlay/frameworks/base/core/res/res/values/config.xml
just edit this file and delete line number 34,199,205. and save it.
just restart building again.

[GUIDE CM11] How to build your own CyanogenMod 11.0 ROM from sources for the Moto G

Make your 'own' KitKat-ROM today!
V1.1 - 20140219 Repos changed
V1.0 - 20140218 Initial release
Thank you note: Many thanks to dhacker29 for dedicating his time developing for this fine piece if hardware.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Overview
I. Preparation
II. Installation of the required packages
III. Installing Java
IV. The sources
V. Building the ROM
VI. Rebuilding with newest sources
I. Preparation
Things you need for building:
A computer
An internet connection
An open mind
Time
Patience
First of all, you need a running up-to-date Ubuntu/Linux system. I am using Ubuntu 13.10 64-bit.
Use the terminal to make the steps. A terminal window can be opened by pressing Ctrl+Alt+T. Every single command for the terminal is marked with a $ sign. Just paste every command (without the $ sign) to your terminal window and there shouldn't be any problem.
IMPORTANT: INSTALL EVERYTHING AS A USER WITH NORMAL RIGHTS. DON'T INSTALL AS ROOT!
II. Installation of the required packages (Ubuntu 13.10 64-bit)
Install packages:
Code:
$ sudo apt-get install bison build-essential curl flex \
g++-multilib gcc-multilib git-core gnupg gperf \
lib32ncurses5-dev lib32readline-gplv2-dev lib32z1-dev \
libesd0-dev libncurses5-dev libsdl1.2-dev \
libwxgtk2.8-dev libxml2 libxml2-utils lzop \
openjdk-6-jdk openjdk-6-jre pngcrush schedtool \
squashfs-tools xsltproc zip zlib1g-dev
III. Installing Java
You need a version 6 Java Development Kit for building CM11.0. Usually, the SUN JDK 6 is recommended. But there is another way: you can use the OpenJDK 6. When you installed the required packages as described above, you will just need to configure your Java installation.
Check your Java version:
Code:
$ java -version
Verify the symlinks. Javac, Java, Javaws, Javadoc, Javah, Javap and Jar should all point to the right Java location and version:
Code:
$ ls -la /etc/alternatives/java* && ls -la /etc/alternatives/jar
If they are pointing to the wrong versions you have to change that to OpenJDK6.
Select the default Java version for your system:
Code:
$ sudo update-alternatives --config javac
$ sudo update-alternatives --config java
$ sudo update-alternatives --config javaws
$ sudo update-alternatives --config javadoc
$ sudo update-alternatives --config javah
$ sudo update-alternatives --config javap
$ sudo update-alternatives --config jar
That's it.
IV. The sources
Install repo:
Repo is a tool that makes it quite easy to download and maintain the sources of Cyanogenmod.
Code:
$ mkdir ~/bin
$ PATH=~/bin:$PATH
$ cd ~/bin
$ curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$ chmod a+x ~/bin/repo
Create the working directory:
Code:
$ mkdir ~/cm11
$ cd ~/cm11
Initialize Repo:
Code:
$ repo init -u git://github.com/CyanogenMod/android.git -b cm-11.0
and enter your credentials.
Download the sources:
Code:
$ repo sync
Wait until it's finished - takes some time to download the hefty 12 GB of source code!
Have a break, have a KitKat!
If the process stops responding, use Ctrl+C to break out of it and resume the download with another
Code:
$ repo sync
If you are running into a lot of syncing errors the reason might be that the 'repo sync' command is establishing four threads automatically. This might be too much. So try to change the command to run with one thread only by using
Code:
$ repo sync -j1
Initialize the environment
Code:
$ . build/envsetup.sh
Obtain the files:
Add repositories for the MOTO G 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 already there, create it with
Code:
$ mkdir ~/cm11/.repo/local_manifests
Use this code to create the file falcon.xml
Code:
$ gedit ~/cm11/.repo/local_manifests/falcon.xml
Paste the following lines to the editor (20140219: repos changed to CyanogenMod)
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="[COLOR="DarkRed"]CyanogenMod[/COLOR]/android_device_motorola_falcon" path="device/motorola/falcon" remote="github" revision="cm-11.0"/>
<project name="[COLOR="DarkRed"]CyanogenMod[/COLOR]/android_kernel_motorola_msm8226" path="kernel/motorola/msm8226" remote="github" revision="cm-11.0"/>
<project name="[COLOR="DarkRed"]CyanogenMod[/COLOR]/android_device_motorola_msm8226-common" path="device/motorola/msm8226-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.
Use this code to create the file vendor.xml (in case you already have a vendor.xml file because you are buiilding for multiple devices, just add the project line to your vendor.xml file)
Code:
$ gedit ~/cm11/.repo/local_manifests/vendor.xml
Paste the following lines to the editor
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.
Run
Code:
$ repo sync
again to get the files needed.
Download the necessary prebuilts from cyanogenmod by running
Code:
$ cd ~/cm11
$ vendor/cm/get-prebuilts
And you're done syncing!
V. Building the ROM
Now build it:
Code:
$ brunch falcon
And the building process starts. Have patience now. Building takes around half an hour on fast systems and a lot more on older and slower machines.
When everything worked as it should you will find your new ROM-image in ~/cm11/out/target/product/falcon
It is called cm-11-DATE-UNOFFICIAL-falcon-zip. You can flash it via CWM/TWRP as usual.
VI. Rebuilding with newest sources
Whenever you like to update your sources and build a new version you have to run these four simple commands:
Code:
$ cd ~/cm11
$ repo sync
$ . build/envsetup.sh
$ brunch falcon
Compiling again takes less time than compiling took the first time because it's only building new parts while reusing old parts that haven't changed.
Happy building!
Reserved
Reserved
Good
Thanks for taking the effort to write this down.
Docker template for building CyanogenMod
Have you seen this?
http://forum.xda-developers.com/showthread.php?t=2650345
Guide changed
New V1.1 - 20140219 Repos changed
First post has been changed accordingly.
VI. Rebuilding with newest sources
Whenever you like to update your sources and build a new version you have to run these four simple commands:
Code:
$ cd ~/cm11
$ repo sync
$ . build/envsetup.sh
$ brunch falcon
Compiling again takes less time than compiling took the first time because it's only building new parts while reusing old parts that haven't changed.
Click to expand...
Click to collapse
Is it not necessary to also run this again?
Code:
cd vendor/cm
./get-prebuilts
cd ../..
PS: At the end of part IV youve got "get-prebuilts" instead of "./get-prebuilts".
if you could add option to build with Linaro-Toolchain
tazlooney89 said:
if you could add option to build with Linaro-Toolchain
Click to expand...
Click to collapse
+1
michalurban said:
Is it not necessary to also run this again?
Code:
cd vendor/cm
./get-prebuilts
cd ../..
Click to expand...
Click to collapse
It is the pre-built terminal program. You just need it the first time you build. Otherwise you would get an error message while compiling the ROM. It is unnecessary to get the program over and over again. Since it's pre-built, it gets its updates from the market/play store.
michalurban said:
PS: At the end of part IV youve got "get-prebuilts" instead of "./get-prebuilts".
Click to expand...
Click to collapse
Something got mixed up there. Changed my lines. But your solution works too, of course. Thanks for pointing me to it.
tazlooney89 said:
if you could add option to build with Linaro-Toolchain
Click to expand...
Click to collapse
Really depends on the time I will have on my hands and the interest the thread draws. Maybe I'll add some tweaks and tricks including a basic set of compiling against Linaro TC 4.8.x next week. We will see...
Is there an automatic way to have the build.prop file (the system/build.prop option ro.build.date) altered?
I have a script renaming the compiled rom - to make the filaname end with "-michalurban-$NOW" where $NOW is a variable containing date and time of creation. And I would like to remove the ro.build.date value and replace it with michalurban-$NOW so I would easily know if Im using Official NIGHTLY or my build ...
My Linux (Bash, whatever) skill is knee deep in manure Im afraid ... is this possible?
michalurban said:
Is there an automatic way to have the build.prop file (the system/build.prop option ro.build.date) altered?
I have a script renaming the compiled rom - to make the filaname end with "-michalurban-$NOW" where $NOW is a variable containing date and time of creation. And I would like to remove the ro.build.date value and replace it with michalurban-$NOW so I would easily know if Im using Official NIGHTLY or my build ...
My Linux (Bash, whatever) skill is knee deep in manure Im afraid ... is this possible?
Click to expand...
Click to collapse
I usually change the build.prop indirectly before the building process.
I delete a few files before rebuilding. E.g. the old build.prop with
Code:
rm -f out/target/product/falcon/system/build.prop
Whenever I am setting up a new build environment I edit the file common.mk in /vendor/cm/config
In line 317 or 323 you could try to change the value of CM_DISPLAY_VERSION or ro.cm.display.version to suit your needs.
Or you can do what I am doing - I usually add a time value to my ROMs (Rom-name and CyanogenMod-version under 'About phone'):
line 288 reads:
Code:
CM_VERSION := $(PRODUCT_VERSION_MAJOR)-$(shell date -u +%Y%m%d)-$(CM_BUILDTYPE)$(CM_EXTRAVERSION)-$(CM_BUILD)
and I changed it to
Code:
CM_VERSION := $(PRODUCT_VERSION_MAJOR)-$(shell TZ=":Europe/Berlin" date +%Y%m%d\-%H%M%S)[email protected]$(CM_BUILDTYPE)$(CM_EXTRAVERSION)-$(CM_BUILD)
I also added [email protected] You can change practically everything here.
Then save the file and rebuild.
The CyanogenMod Version in 'about phone' should look like this when you flash the ROM:
Happy building!
Is it possible to do this on a NTFS-formatted drive? Im running low on space on my linux /home directory but Ive got plenty of space on my Win7 NTFS drive ... Im just afraid of file permission troubles ...
you can make an image file on the NTFS partition loopmount it, then format it to ext4.
Sent from my XT1032
Rhyn said:
you can make an image file on the NTFS partition loopmount it, then format it to ext4.
Sent from my XT1032
Click to expand...
Click to collapse
You mean to create a file on the NTFS partition, format it as EXT4, mount it somewhere and then use it for compilation via Ubuntu but "on" the NTFS drive? Wouldnt it mean a hard hit to the performance? I suppose it wont but as my PC is not high-end everything matters ...
BTW I found some guide on the Net and Ive modified it for my needs (probably lol). Is it ok?
Code:
# Create file to store EXT4 partition on NTFS partition (100GB)
dd if=/dev/urandom of=/media/D/linux.img bs=2048 count=50000000
# Create and format loop device (of the EXT4 file)
losetup /dev/loop0 /media/D/linux.img
mkfs.ext4 -b 1024 /dev/loop0
# Mount the new EXT4 file
mount -o loop /media/D/linux.img /home/michal/NTFSdrive
EDIT: Script tested and running fine (I got so excited I wrote this edit in czech not english the first time lol).
yeah I meant exactly that. This guide seems ok. The performance won't be as good as with a native partition, but won't be terribly bad either
Sent from my XT1032
Another weird question of mine:
I deleted all files, set the CCACHE to be 100GB using command "prebuilts/misc/linux-x86/ccache/ccache -M 100G" which was confirmed and started the whole process. But after successfully finishing compilation the directory is again "only" 50GB ... why? I expected it to be twice as large ...
michalurban said:
Another weird question of mine:
I deleted all files, set the CCACHE to be 100GB using command "prebuilts/misc/linux-x86/ccache/ccache -M 100G" which was confirmed and started the whole process. But after successfully finishing compilation the directory is again "only" 50GB ... why? I expected it to be twice as large ...
Click to expand...
Click to collapse
You have to inform the compiler that the cache will be used first, then config a directory and last, set the cache size to xx GB which creates the hidden dir. (to see it, use Ctrl+H)
Code:
$ export USE_CCACHE=1
$ export CCACHE_DIR=/your_path_here/.ccache
$ prebuilts/misc/linux-x86/ccache/ccache -M 100G
Btw: it's a good idea to use a 'make clean' first...
To see what's going on while caching, open another terminal, go to your cm11 root dir and execute
Code:
watch -n1 -d prebuilts/misc/linux-x86/ccache/ccache -s
Now, Ive got a script building the ROM for me. It usually works fine for first sync and compilation as well as for any secondary syncs. But sometimes it returns a message that something isnt present in some file (it differs) and the compilation ends with "Error 1" which I found to be "Out of memory". Now, the guide at CM web says that I should
Code:
edit: system/build/tools/releasetools/common.py
change: java -Xmx2048m to java -Xmx1024m or java -Xmx512m
BTW the right file path is
Code:
build/tools/releasetools/common.py
But Im curious if this change could be done in an automated way by the script (and Im not really familiar with sed, awk and all this regular expressions) ... If not, I guess Ill put some READ command before the compilation itself, giving me time to change it - or just add "nano system/build/tools/releasetools/common.py". But still, automatic way would be better.
EDIT: Solution (with JAVAMEM being set in the beginning of the script):
Code:
sed -i 's/Xmx2048m/Xmx'$JAVAMEM'm/' build/tools/releasetools/common.py
ADD:
Weird, when I try to set the directory and size for CCACHE, nothing happens - it stays at /home/michal/.ccache and 100GB ...
About two days ago a new problem emerged. I followed the guide exactly but in the end, after "brunch falcon"
Code:
make: *** [/home/michal/Build/MotoG-CM11/out/target/product/falcon/obj/SHARED_LIBRARIES/hwcomposer.msm8226_intermediates/hwc_utils.o] Error 1
It happened before so I erased all content of the directory and did all the commands from scratch. But its the same ... even after changing Java memory something (Xmx2048m) to 1024, which was recommended in the CM guide.

Guide on building Lollipop for the OnePlus One

Today I went about and built a copy of CM12 for my phone so that I can control when I get updates and I can get the most latest update. There was a few issues I ran into following other peoples guides in the Android L Dicussions, so I thought I'll do a quick write on exactly what I did so you can go about building it for yourself.
A good resource on building CyanogenMod is available at http://wiki.cyanogenmod.org/w/Build_for_bacon, they don't have a guide for CM12, but still has some useful information.
Make sure you use the same operating system as I am using which is Ubuntu. I tried using Debian earlier, but had issues which may have been resulted to me not having enought memory on disk or me interupting the download of source code.
Preparing System for Build
Install the following items via apt-get.
Code:
sudo apt-get install bison build-essential curl flex git gnupg gperf libesd0-dev libncurses5-dev libsdl1.2-dev libwxgtk2.8-dev libxml2 libxml2-utils lzop openjdk-6-jdk openjdk-6-jre pngcrush schedtool squashfs-tools xsltproc zip zlib1g-dev g++-multilib gcc-multilib lib32ncurses5-dev lib32readline-gplv2-dev lib32z1-dev
As per the instructions on the wiki for building CM, if you use a 32bit system, do not install g++-multilib gcc-multilib lib32ncurses5-dev lib32readline-gplv2-dev lib32z1-dev.
Install the latest version of Java's development kit using the following.
Code:
sudo apt-get install openjdk-7-jdk
Install the Android Development Kit using the following.
Code:
sudo apt-get install android androidsdk-uiautomatorviewer android-copyright android-src-vendor android-emulator android-tools-adb android-headers android-tools-adbd androidsdk-ddms android-tools-fastboot androidsdk-hierarchyviewer android-tools-fsutils androidsdk-traceview
Run the following in terminal.
Code:
mkdir -p ~/bin
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
reboot your system or use the following in terminal to load the .profile file again.
Code:
. ~/.profile
Getting the source code.
Now we can get onto grabbing the source code of CM12.
Run the following in terminal.
Code:
mkdir ~/cm
cd ~/cm
repo init -u git://github.com/CyanogenMod/android.git -b cm-12.0
mkdir .repo/local_manifests
nano .repo/local_manifests/local_manifests.xml
When nano appears, paste the following into it and then exit using ctrl-x and choose to save.
Code:
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<project name="CyanogenMod/android_device_oneplus_bacon" path="device/oneplus/bacon" remote="github" />
<project name="CyanogenMod/android_device_qcom_common" path="device/qcom/common" remote="github" />
<project name="CyanogenMod/android_device_oppo_msm8974-common" path="device/oppo/msm8974-common" remote="github" />
<project name="CyanogenMod/android_device_oppo_common" path="device/oppo/common" remote="github" revision="cm-12.0" />
<project name="CyanogenMod/android_kernel_oneplus_msm8974" path="kernel/oneplus/msm8974" remote="github" />
<project name="TheMuppets/proprietary_vendor_oppo" path="vendor/oppo" remote="github" />
<project name="TheMuppets/proprietary_vendor_oneplus" path="vendor/oneplus" remote="github" />
<project name="CyanogenMod/android_frameworks_opt_connectivity" path="frameworks/opt/connectivity" remote="github" revision="cm-11.0" />
</manifest>
Continue getting the code using the following.
Code:
repo sync
cd vendor/cm
./get-prebuilts
cd ../..
Building CM12
Run the following commands to build CyanogenMod.
Code:
. build/envsetup.sh
breakfast bacon
brunch bacon
After successful build, you should be able to go about copying the built CyanogenMod and installing it into your phone. The CyanogenMod build is located in ~/cm/out/target/product/bacon/ named something like cm-12-*-UNOFFICIAL-bacon.zip
You can install folllowing: http://forum.xda-developers.com/oneplus-one/general/lollipop-install-guide-oneplus-one-t2940091
Re-building to update.
To re-build, you should just be able to run the following (Not yet tested myself, but makes logical sense).
Code:
make clobber
repo sync
cd vendor/cm
./get-prebuilts
cd ../..
. build/envsetup.sh
brunch bacon
Q&A
Q: Recieve error: fatal: duplicate path device/qcom/sepolicy in ~/cm/.repo/manifest.xml
A: edit .repo/local_manifests/local_manifests.xml to remove the item which matches the item located in bold.
Q: How big is the repo?
A: 20GB just source code and 40GB when built. Therefore you should aim to have about 60GB free on your system.
you don't necessarily need Ubuntu 14.04. You could do just fine on 12.04 or 13.10 or whatever.
Also, something that's good to know: if you have a build environment that you've been building kitkat in, the only thing you need to do is update your Java from 1.6 to 1.7
how big is the cm 12 download?
This is a really nice tutorial. Thanks OP.
Nice guide!
Umm.... As far as I know, it isn't necessary to croot...
And it seems to compile fine with just . build/envsetup.sh && brunch bacon.
Just my two cents.
Sent from my A0001 using XDA Premium 4 mobile app
rudi_j7 said:
Nice guide!
Umm.... As far as I know, it isn't necessary to croot...
And it seems to compile fine with just . build/envsetup.sh && brunch bacon.
Just my two cents.
Sent from my A0001 using XDA Premium 4 mobile app
Click to expand...
Click to collapse
Exactly this.
Croot "change root (directory)" is unneeded when you're already in the root directoy.
Code:
. build/envsetup.sh
breakfast bacon
brunch bacon
is more than than enough. This will automatically allocate to cores as is needed and compiles the flashable zips. Silly to make the build with make -j*of cores* and then make otapackage when one command will do both for you.
On the grounds of repo sync, inputting it just like that "repo sync" runs on 4 threads with -c already which is more than fast enough for people.
The CM manifests include a sensible default configuration for repo, which we strongly suggest you use (i.e. don't add any options to sync). For reference, our default values are -j 4 and -c. The -j 4 part means that there will be four simultaneous threads/connections. If you experience problems syncing, you can lower this to -j 3 or -j 2. -c will ask repo to pull in only the current branch, instead of the entire CM history.
Click to expand...
Click to collapse
As for the platform tools, those are all installable through Ubuntu's apt repositories.
Code:
[email protected]:~$ sudo apt-get install android
android androidsdk-uiautomatorviewer
android-copyright android-src-vendor
android-emulator android-tools-adb
android-headers android-tools-adbd
androidsdk-ddms android-tools-fastboot
androidsdk-hierarchyviewer android-tools-fsutils
androidsdk-traceview
No offense to @GRMrGecko but people should read up on what they're inputting into their Terminals.
What Envsetup does: http://wiki.cyanogenmod.org/w/Envsetup_help
linezero said:
how big is the cm 12 download?
Click to expand...
Click to collapse
20GB, probably larger once compiled.
pandasa123 said:
you don't necessarily need Ubuntu 14.04. You could do just fine on 12.04 or 13.10 or whatever.
Also, something that's good to know: if you have a build environment that you've been building kitkat in, the only thing you need to do is update your Java from 1.6 to 1.7
Click to expand...
Click to collapse
I completely forgot to add the java install into the guide.
Nburnes said:
No offense to @GRMrGecko but people should read up on what they're inputting into their Terminals.
What Envsetup does: http://wiki.cyanogenmod.org/w/Envsetup_help
Click to expand...
Click to collapse
Thanks for the input. I had an understanding on what I was doing as far as envsetup.sh setting the environment for the commands for croot, breakfast, ect and that breakfast builds the make configuration somewhat like how configure on many other software. But I never took the time to go about and research as I wanted to make a working build and had issues using Debian. I thought that I will share what I did and just make a general resource for people to come to and get help with building as I only saw build instructions here and there in the Lollipop discussions.
I have incorporated your feedback into the instructions and I am testing the re-build now with your commands to verify that they work the way they are.
Thank you.
This is great, now there's no excuse for anyone!
?good job
Sent from my NX507J using XDA Premium 4 mobile app
Nburnes said:
Code:
. build/envsetup.sh
breakfast bacon
brunch bacon
Click to expand...
Click to collapse
According to the URL you posted (http://wiki.cyanogenmod.org/w/Envsetup_help) breakfast isn't even needed as brunch does breakfast and mka in one go.
GRMrGecko said:
According to the URL you posted (http://wiki.cyanogenmod.org/w/Envsetup_help) breakfast isn't even needed as brunch does breakfast and mka in one go.
Click to expand...
Click to collapse
Exactly why I said only . build/envsetup.sh && brunch bacon
Sent from my A0001 using XDA Premium 4 mobile app
rudi_j7 said:
Exactly why I said only . build/envsetup.sh && brunch bacon
Click to expand...
Click to collapse
Thanks, I wasn't sure if that was true as Nburnes said to use both brunch and breakfast and from what I saw in the discussions posts, he knew what he was doing.
I have this problem. How to solve it?
E: Unable to locate package android
E: Unable to locate package android-copyright
E: Unable to locate package android-src-vendor
E: Unable to locate package android-emulator
scafroglia57 said:
I have this problem. How to solve it?
E: Unable to locate package android
E: Unable to locate package android-copyright
E: Unable to locate package android-src-vendor
E: Unable to locate package android-emulator
Click to expand...
Click to collapse
What version of Ubuntu do you have? lsb_release -a
I think you may be fine with those packages not being available, as long as you get adb/fastboot.
GRMrGecko said:
What version of Ubuntu do you have? lsb_release -a
I think you may be fine with those packages not being available, as long as you get adb/fastboot.
Click to expand...
Click to collapse
lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04.1 LTS
Release: 14.04
Codename: trusty
scafroglia57 said:
lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04.1 LTS
Release: 14.04
Codename: trusty
Click to expand...
Click to collapse
That is the same as mine. Try running sudo apt-get update and see if that changes what packages are available.
GRMrGecko said:
That is the same as mine. Try running sudo apt-get update and see if that changes what packages are available.
Click to expand...
Click to collapse
Nothing
scafroglia57 said:
Nothing
Click to expand...
Click to collapse
Just try continuing without those packages.

[GUIDE] build lineageOS for titan in ubuntu 16.04 (or Debian 8) environment

LineageOS is in an official state, so that's for the ones with no patience, like me. I want my nightlies!! So DIY!!
This is not about flashing. Only how to build a ROM in an Ubuntu (meanwhile Debian 8) environment! So I have nothing to do with what you do with the finished Zip-file.
I am not responsible for your phone or your computer! Everything you read here resulting in taking action is at your own risk!
All credits go to all devs and supporters here on XDA, CyanogenMod / LineageOS for all their work they provide for free on github. We just take thankful the benefit!! Mainly LuK1337 provided the best hints and informations!
## These sites will help you:
http://wiki.lineageos.org/titan_build.html
http://web.archive.org/web/20160722172103/http://wiki.cyanogenmod.org/w/Envsetup_help
http://web.archive.org/web/20160421170720/http://wiki.cyanogenmod.org/w/Build_for_titan
http://gojira.tokyo/?building_cyanogenmod_14_from_source
http://source.android.com/source/initializing.html
## GIT and repos
https://forum.xda-developers.com/showthread.php?t=2329228
## SET UP THE ENVIRONMENT
## Install (in VMware Player or Virtualbox?) 64-bit-Ubuntu 16.04.1 LTS / 8GB RAM / 100GB HDD
## All following is done in a terminal
## These are the packets you need (if you use debian some will fail (e.g. JAVA) -take them out of the list manually):
Code:
sudo apt-get install android-tools-adb automake bc bison build-essential bzip2 ccache curl dpkg-dev flex git gnupg gperf libbz2-1.0 libesd0-dev libghc-bzlib-dev liblz4-tool libncurses5-dev libsdl1.2-dev libwxgtk2.8-dev libxml2 libxml2-utils lzop make maven openjdk-8-jdk pngcrush python-networkx schedtool squashfs-tools xsltproc zip zlib1g-dev g++-multilib gcc-multilib lib32ncurses5-dev lib32z1-dev lib32readline6 lib32readline6-dev
## To install JAVA 8 in Debian:
Code:
echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main" | tee /etc/apt/sources.list.d/webupd8team-java.list
echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main" | tee -a /etc/apt/sources.list.d/webupd8team-java.list
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886
apt-get update
apt-get install oracle-java8-installer
## Add all needed paths and the ccache command (following two lines) to the end of ~/.bashrc
## copy the whole box to your terminal and the lines will be added...
Code:
echo "export PATH=~/bin:~/android/lineageos/toolchain:~/android/lineageos/external/v8/build/toolchain:~/android/lineageos/prebuilts/sdk/tools:$PATH
export USE_CCACHE=1" >> ~/.bashrc
## Maybe here is a good point to restart the Ubuntu machine once...
## I'm not sure if necessary you need an account at https://github.com but it complains when not...
Code:
git config --global user.email "your-GIT-REG-email"
git config --global user.name "your-GIT-REG-username"
Code:
mkdir -p ~/bin
mkdir -p ~/android/lineageos/
mkdir -p ~/android/lineageos/.repo/local_manifests
## get the repo command
Code:
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
## The right git-repos to sync are in: ~/android/lineageos/.repo/local_manifests/roomservice.xml
## copy the whole box into the terminal and the roomservice.xml will be written:
Code:
echo "<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<remote fetch="ssh://[email protected]" name="bitbucket" />
<remote fetch="ssh://[email protected]" name="gitlab" />
<remote fetch="git://codeaurora.org/" name="caf" review="codeaurora.org" sync-c="true" />
<project name="LineageOS/android_device_motorola_titan" path="device/motorola/titan" remote="github" />
<project name="LineageOS/android_device_motorola_thea" path="device/motorola/thea" remote="github" />
<project name="LineageOS/android_device_motorola_msm8226-common" path="device/motorola/msm8226-common" remote="github" />
<project name="LineageOS/android_device_qcom_common" path="device/qcom/common" remote="github" />
<project name="LineageOS/android_kernel_motorola_msm8226" path="kernel/motorola/msm8226" remote="github" />
<project name="LineageOS/android_packages_resources_devicesettings" path="packages/resources/devicesettings" remote="github" />
<project name="TheMuppets/proprietary_vendor_motorola" path="vendor/motorola" remote="github" />
<project name="TheMuppets/proprietary_vendor_qcom_binaries" path="vendor/qcom/binaries" remote="github" />
<project name="TheMuppets/proprietary_vendor_asus" path="vendor/asus" remote="github" />
</manifest>" > ~/android/lineageos/.repo/local_manifests/roomservice.xml
## Get the github to the machine
Code:
repo init -u git://github.com/lineageos/android.git -b cm-14.1
## additional folders to put the repos and binaries for building
## O.K. lets start the first try
Code:
cd ~/android/lineageos/
source build/envsetup.sh
Code:
repo sync
## Wait VERY LONG (really hours) and IF STUCKS, press "ctrl+C" and once more "repo sync" again.
## Then Extract proprietary blobs from the phone
## the device must be connected via USB cable (adb has to be functional) and go to the TITAN directory:
Code:
cd ~/android/lineageos/device/motorola/titan
## and
Code:
./extract-files.sh
## and maybe (only once before the first time of building) configure the CCACHE, which makes compiling much faster:
Code:
prebuilts/misc/linux-x86/ccache/ccache -M 50G
##WHEN ALL IS DONE
## we now can forget all steps before! ...Until we run in trouble - then look at the bottom or restart from scratch.
## In my experience now it shows, that the compiling processes recompiles and replaces "new synced packets" in the out-directory and leave the untouched untouched. So we can (nearly) always restart a broken build process... maybe the devs will VETO this. Some delete the whole out-directory every time - I think you can easily start over
## However, what we should do everytime before we start building is:
Code:
cd ~/android/lineageos/
source build/envsetup.sh
repo sync
## OKAY, lets build.... Nooooooo! Not yet!
## The most Important question now:
## "Do you want to have a ROOTED phone?" If yes, then you have to
Code:
export WITH_SU=true
## If you don't want root then just start with:
Code:
brunch titan
## Now you can wait again for hours and hopefully got finished
## ~/android/lineageos/out/target/product/titan/lineage-14.1-2017****-UNOFFICIAL-titan.zip
------------------------------------------------------------------------
------------------------------------------------------------------------
## TROUBLE with compilation stops / stucks with error:
## JACK-SERVER error:
## reinstall the Jack Server
Code:
cd ~/android/lineageos/prebuilts/sdk/tools
jack-admin kill-server
jack-admin uninstall-server
jack-admin install-server jack-launcher.jar jack-server-4.8.ALPHA.jar
## sometimes a permission problem:
Code:
chmod 700 ~/.jack-server
find ~/.jack-server -type f -print0 | xargs -0 chmod 600
chmod 664 ~/.jack-settings
##Also helpful if Java stops compiling is to limit the usage of RAM:
Code:
export ANDROID_JACK_VM_ARGS="-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx4G"
##NINJA error:
## increase RAM of VM, or you cant put
Code:
export USE_NINJA=false
command to the .bashrc
## APPS/org.cyanogenmod.platform-res_intermediates error:
Code:
javac: file not found: ~android/lineageos/out/target/common/obj/APPS/org.cyanogenmod.platform-res_intermediates/src/cyanogenmod/platform/Manifest.java
Usage: javac <options> <source files>
use -help for a list of possible options
ninja: build stopped: subcommand failed.
build/core/ninja.mk:151: recipe for target 'ninja_wrapper' failed
make: *** [ninja_wrapper] Error 1
make: Leaving directory '~/android/lineageos'
#### make failed to build some targets (25:19 (mm:ss)) ####
When this happens, give a:
Code:
mka org.cyanogenmod.platform-res
This also works for most other Errors, which stop the process... Find the line with "****_intermediate" and give the "mka ****" WITHOUT the "_intermediate".
After compiling of the single package is finished - once more:
Code:
brunch titan
## New one: *** This repo is now deprecated. Move your blobs to your device's vendor repo..
Code:
find: "~/android/lineageos/out/target/common/obj/SHARED_LIBRARIES/libwifi-hal-mock_intermediates": Datei oder Verzeichnis nicht gefunden
build/core/package_internal.mk:143: Empty argument supplied to find-subdir-assets
./vendor/qcom/binaries/Android.mk:1: *** This repo is now deprecated. Move your blobs to your device's vendor repo..
The solution is given here by mirkosrc:
Code:
~/android/lineageos$ mv vendor/qcom/binaries/Android.mk vendor/qcom/binaries/Android.mk.bak
Now we have the proper solution given by kessaras in post #37 (thanks a lot!!):
the solution is not to rename the .mk or even remove that repo since we ignore it by renaming the .mk.
The proper solution is to edit the .mk and remove the 1st line that redirects to an error on purpose because its depricated (old).
This way, IF the .mk is needed during the build, it will get called.
If its not needed , then the compiler will just not use it.
At least thats my point of view here. We dont just remove things by renaming. We add them properly in case they r needed. If they are not needed then they wont be used.
Click to expand...
Click to collapse
## LAST OPTION:
When nothing works at all anymore you can delete the whole content of the out-folder:
Code:
rm -rf ~/android/lineageos/out/*
But then the first compiling last very long again...
## If the DISK runs full,
look into android/lineageos/out/target/product/titan/obj/PACKAGING/target_files_intermediates and delete the files...
## repo sync crashes with error:
Code:
repo sync -j1 -f --force-sync
------------------------------------------------------------------------
Thank you for this guide. I'll try to build CM14.1 here
Danilo-Sanchez said:
Thank you for this guide. I'll try to build CM14.1 here
Click to expand...
Click to collapse
Ah, great keep me informed, so I can make it better. Try myself from the scratch and have found some issues in the chronological order... is getting better. So look out for changes
mankokoma said:
Ah, great keep me informed, so I can make it better. Try myself from the scratch and have found some issues in the chronological order... is getting better. So look out for changes
Click to expand...
Click to collapse
Ok. As soon as I try I'll let you know
For the Ninja error:
export USE_NINJA=false
Has been asked for RAM usage. Battery life is as CM always have been - not the best, could be worse, so what?
mankokoma said:
Has been asked for RAM usage. Battery life is as CM always have been - not the best, could be worse, so what?
Click to expand...
Click to collapse
Thank you
It's almost the same RAM usage as CM13.
i will also try to build the rom from ur guide........really thanks.......so much for the guide
:laugh:Thank you for share!!!:good:
@mankokoma Can I extract proprietary files even if I'm not using CM14.1?
Danilo-Sanchez said:
@mankokoma Can I extract proprietary files even if I'm not using CM14.1?
Click to expand...
Click to collapse
Why not? As far as I can follow the scripts, the files will be extracted (in our case) to ~/android/lineageos/vendor/motorola/titan/proprietary/... (and maybe also to /android/lineageos/vendor/motorola/msm8226-common/proprietary...) I'm not sure if they are always the same for the different Android Versions, but I assume: Yes.
I put some more order in the guide and cleaned the chaos in case there is still interest in building LineageOS yourself. In fact preparing of the environment and the first setup and building of the ZIP lasts really (annoying) long but the following building processes are done within ONE and a HALF hours. So I enjoy immediately the last build when there has something good changed in the Repos: https://www.cmxlog.com/14.1/titan/
Have a lot of fun!
mankokoma said:
I put some more order in the guide and cleaned the chaos in case there is still interest in building LineageOS yourself. In fact preparing of the environment and the first setup and building of the ZIP lasts really (annoying) long but the following building processes are done within ONE and a HALF hours. So I enjoy immediately the last build when there has something good changed in the Repos: https://www.cmxlog.com/14.1/titan/
Have a lot of fun!
Click to expand...
Click to collapse
Did you managed to build Lineage OS 13.0?
I've tried to build Lineage OS 13.0 but unfortunately it didn't work.
Danilo-Sanchez said:
Did you managed to build Lineage OS 13.0?
I've tried to build Lineage OS 13.0 but unfortunately it didn't work.
Click to expand...
Click to collapse
No, I didn't. "Shoot from the hip": Downgrade Java to 1.7 first. Maybe it's easier to building up Ubuntu 14.x environment as I don't know about gcc or other libs-things for CM13
mankokoma said:
No, I didn't. "Shoot from the hip": Downgrade Java to 1.7 first. Maybe it's easier to building up Ubuntu 14.x environment as I don't know about gcc or other libs-things for CM13
Click to expand...
Click to collapse
Did you managed to include OMS support in Lineage 14.1?
Danilo-Sanchez said:
Did you managed to include OMS support in Lineage 14.1?
Click to expand...
Click to collapse
No, didn't have any efforts, though a dark notification panel would be nice.
I just take, what comes from the "normal" repositories.
@mankokoma any idea?
Makefile:795: *** multiple target patterns. Stop.
hashroot said:
@mankokoma any idea?
Makefile:795: *** multiple target patterns. Stop.
Click to expand...
Click to collapse
I'm sorry, have only very little time these days... can you provide some more lines before this error occurs?
Are you using Ubuntu or Debian?
I have read something about cleaning the "obj" folder could help
Hi, I am building klte version of CrdroidAndroid ( a LineageOS based ROM) on a ubuntu 16.04 LTS VM.
I am getting the following error. I am not sure what to do here. I have been cleaning the build folder and ccache and trying to build. I keep ending at this error. Any help to solve this issue is greatly appreciated.
----------------------------------
/usr/bin/x86_64-linux-gnu-ld: /home/sadanand/crdroid/android/system/out/host/linux-x86/obj/SHARED_LIBRARIES/libart_intermediates/base/allocator.o: relocation R_X86_64_PC32 against protected symbol `_ZN3art18g_malloc_allocatorE' can not be used when making a shared object
/usr/bin/x86_64-linux-gnu-ld: final link failed: Bad value
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
-----------------------------------------------------------
Thanks
Did you try just "mka libart" to compile only the package with the error?
Usually then it's finishing without errors and you can brunch again.

Categories

Resources