• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Root [DEV][GUIDE] Compiling CM9

spock1104

Android Expert
Well I'm apparently behind in the times but better late than never. I finally cleaned up my source code mods and pushed to github, so hopefully this guide gives people an easy start so we can aid in PhenomX4's incredible JB efforts.

So of course, thanks to PhenomX4 and Giantpune, and anyone else who has contributed.

There may be a few inconsistencies in the information I give as I set up with Ubuntu 10.04 when that was what Google supported, but the guidance has switched to 12.04.

Environment
This can be done on either a dedicated box or a virtual machine. I've seen recommendations of 50-100GB of space, but I recommend 150 for managing several build directories at once. Follow most of the instructions on Initializing a Build Environment | Android Developers but ignore the java instructions. Also don't mind the RAM requirements, I run my virtual machine with 4GB and its fine.

instead, to install java, from a command line

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java6-installer
sudo update-java-alternatives -s java-6-oracle


and to install git

deb http://ppa.launchpad.net/git-core/ppa/ubuntu lucid main
deb-src http://ppa.launchpad.net/git-core/ppa/ubuntu lucid main
sudo apt-get install git-core


use the instructions at Downloading the Source | Android Developers to install Repo


Downloading the source
Decide on a directory structure for yourself on where you want to put your builds. I use ~/lg696/ics/

From the directory you want to work in, enter these commands

repo init -u git://github.com/oecm9/android.git -b ics
repo sync

This will pull the latest code from the ics branch of Cyanogenmod and the additions from the oecm9 group.

One time setup
Before you can compile, you need to grab prebuilt apps that aren't under Cyanogenmod control.

cd vendor/cm
./get-prebuilts
cd ../..

Build the code!
First we'll automatically set up variables that tell the system what we're building and how to do it

. ./build/envsetup.sh
lunch

This will bring up a prompt asking what device to build for. Select 4 (cm_m3s-userdebug). The command will take a moment, then put you back at the command prompt. Lastly, enter

mka bacon

Using the build
The result will be two flashable zip files in out/target/product/m3s.

cm_m3s-ota-eng.user.zip
cm-9-date-UNOFFICIAL-m3s.zip

Either of these is usable, but the second of them is the "optimized" version. Install using clockworkmod or TWRP and enjoy testing.

==========
If you have any feedback on this guide and how it can be better please let me know. I want this to be as informative as possible.


Hopefully I'll have one of these for CM10 soon so we can get more people helping out, making ROMs, and just plain making our phone better.
 
What I know about the phone and where we can pull enhancements

At the core of the phone is a Qualcomm msm8655, part of the Snapdragon S2 family (see http://en.wikipedia.org/wiki/Qualcomm_Snapdragon) that throughout the android code is referred to as msm7x30. This is what we compile for, and other phones using the msm architecture and ESPECIALLY the 7x30 line we should be able to use bits from.

Sister phones (on VM and use 7x30)
Motorola Triumph (check out mtcm9 and mtcm10)
HTC One V (codename primoc, check out the wealth on XDA http://forum.xda-developers.com/htc-one-v/cdma-development)

Cousin (on VM and uses Snapdragon S1)
Optimus V (check out inferiorhumanorgans)

Distant relative (Snapdragon 800)
Nexus 5! I only put this here because MAYBE there's something we can pull from here. The kernel in its repo still has the 7x30 code.
 
All these guides for building android related things looks awesome! I am about to get alot of free time and I will defiantly try to start looking back into my programming!(My new Internet now allows me to actually learn as the videos always help me the most) It would be so awesome if I was able to build android 4.4 for this phone:D Not anytime soon but hopefully one day. got ALOT more to learn but at least I am somewhat use to the programming language of Java now:p
 
All these guides for building android related things looks awesome! I am about to get alot of free time and I will defiantly try to start looking back into my programming!(My new Internet now allows me to actually learn as the videos always help me the most) It would be so awesome if I was able to build android 4.4 for this phone:D Not anytime soon but hopefully one day. got ALOT more to learn but at least I am somewhat use to the programming language of Java now:p

Aside from the lack of a 3.X kernel source, everything says 4.4 will run better on lower specked devices. From my own experience stock kitkat runs better than JB on my Nexus. Another interesting thing is when we first got our hands on the N5 system dump almost all the system apps are signed and installable apks...so imo this may be googles answer to existing 4.+ fragmentation.
 
Aside from the lack of a 3.X kernel source, everything says 4.4 will run better on lower specked devices. From my own experience stock kitkat runs better than JB on my Nexus. Another interesting thing is when we first got our hands on the N5 system dump almost all the system apps are signed and installable apks...so imo this may be googles answer to existing 4.+ fragmentation.

I don't want to get any hopes up, but the java code has frustrated me to the point that once I get a CM10 guide up I plan on focusing on the kernel, since I've already had prior success changing toolchains. One of the things I plan to try is merging the Nexus 5 kernel source with ours. They're both LG phones and well operating companies do some level of code reuse, and I still see 7x30 items in the source, so I think the only stumbling blocks may be drivers. That hasn't held be back before.
 
Thanks for creating this guide. Exactly what I needed to get started with learning about building ROMs.

Only two minor issues: had to use ./get-prebuilts instead of ./get_prebuilts, and in source file hardware/qcom/camerhal/cameraHAL.cpp, I had to edit the include statement for Overlay.h to remove the path.

Other than that, ROM built, installed, and booted successfully.
 
Thanks for creating this guide. Exactly what I needed to get started with learning about building ROMs.

Only two minor issues: had to use ./get-prebuilts instead of ./get_prebuilts, and in source file hardware/qcom/camerhal/cameraHAL.cpp, I had to edit the include statement for Overlay.h to remove the path.

Other than that, ROM built, installed, and booted successfully.

Thanks for the feedback, fixed!
 
Back
Top Bottom