Building A New Android ROM for a Phone

clamum

Lifer
Feb 13, 2003
26,252
403
126
So I've gotten a new phone recently and I'd like to put Cyanogenmod on it. However, I don't see it on the officially supported devices nor do I see it on the unofficially supported devices.

So I assume I gotta port it myself. Fine, I'd like to learn something new and I'm a software developer by profession so I figure I can figure it out. Plus maybe it'll make someone else with my phone happy, haha.

I've been looking on XDA Developers and YouTube but I can't seem to piece together what exactly I need to do. So far, I've followed Android ROM Development from Source to End on XDA Developers. I've gotten Ubuntu on VirtualBox and the source from Github downloaded. I get to the part about "Building a ROM for a Particular Device" and I'm not sure where to go from here. I assume I base my ROM off a ROM from a similar phone but I don't even know if that's correct. Most guides I've read just say something like "find the correct device tree for your device" or something like that it seems.

Can anyone point me in the right direction here? My phone is the LG Ultimate 2, by the way; I can provide more info if you need it.

Thanks a ton!
 

paperwastage

Golden Member
May 25, 2010
1,848
2
76
First, try compiling cm for a working phone (eg nexus 5), just to get used to the process, make sure you have the right software tools/configuration and learn how to fix stuff if its broken. It takes roughly 20-60GB of space and 1-4 hours depending. You are using virtual box, which may be slow

Then try compiling the kernel sources that should be released from your phones manufacturer(for the stock ROM)

Then, find a similar device that already has a cm port (similar CPU/architecture), and transplant any necessary changes
 

clamum

Lifer
Feb 13, 2003
26,252
403
126
Hmmm. I didn't think of trying to compile CM for a working phone like that. Yeah I think I'll do that, it would be a good learning experience.

So phone manufacturers release these kernel sources (or should, you said)? Did not know that. And by "stock ROM" you mean the ROM/software that by default comes on a new phone, correct?

Finally, finding a similar device that already has a CM port definitely makes sense. I'm just not sure what changes I'd have to transplant, but perhaps by building CM for an existing device I'll learn more about this.

I appreciate the help man, thanks!
 

paperwastage

Golden Member
May 25, 2010
1,848
2
76
lmk if you find out useful resources (youtube/guides/...)

I tried porting cm for my verizon LTE lg g pad (there is an existing cm port for the non-LTE version). It required minor changes for the cm device tree, got things working except for modem... tried playing around with the kernel, but no luck, most likely a kernel issue -> see the changes I made
https://github.com/ngvincent/android_device_lge_vk810/commits/cm-11.0

it's a GPL requirement for anyone using a linux kernel to release the sources used to compile kernel. You can see a lot of chinese vendors skipping that requirement (manufacturers using mediatek chips almost never release sources), while some companies release kernel source that doesn't compile properly. Since the device ships with stock/default ROM (not entirely AOSP), the kernel source would be for that stock ROM

http://forums.ouya.tv/discussion/1291/linux-kernel-sources-gpl-request-l4t

some companies are more dev friendly (eg Sony, release source for stock ROM, AND AOSP/unified kernels for some of their devices, which makes porting to Cm easier)

http://www.gsmarena.com/sony_adds_xperia_z1_z2_m2_to_aosp_unveils_unified_kernel-news-9951.php
 
Last edited: