Jump to content


Photo

Guide Compiling your own rom from CyangenoMod Souces (Gingerbread)


  • Please log in to reply
28 replies to this topic

#1
GuyOverThere

GuyOverThere

    Enthusiast

  • Members
  • PipPipPip
  • 176 posts
  • Gender:Male
  • Location:Caracas, Venezuela
  • Interests:Gaming, Linux, Tech and other stuff
  • Devices:ZTE Racer x850
  • Twitter:@netalien
Hi all,

Wanted to make this guide earlier but you know, life stuff gets in the way :P

What this guide does is show you how you can use cyanogenmod sources to build your own roms, now a few things to clear before you do anything.

A) Things to know

- Cyangenomod sources are big, as in 11GB download by my last count, and after that several files are created by repo to keep the sources in sync with git and those files accounts for 15GB of additional space, so in total, cyanogenmod source folder is 26GB in my hard drive right now.
- ZTE Racer Gen1 or Gen2 isn't officially supported by Cyanogenmod team, not even unofficially, there's no Cyangenomod Kang for ZTE Racer, so don't expect support from cyanogenmod team
- Compilation time depends on the hardware you have, mine isn't fancy (Core 2 Duo 3GHz, 4GB Ram) and it takes 40 minutes to make a rom (afaik, the estimated times for builds are between 30 to 90 minutes)
- With this guide you'll get a barebone cyanogenmod rom, want ICS looks? MUI mod, blablabla ... that have to be added after building the rom (you have to cook it)
- All you're about to see is how "I" do it, while I don't think others differ much from what I do, a few things can be done differently.
- You'll need Linux and while you don't have to be a guru, some knowledge of linux usage will help, I've tested this on ubuntu and fedora (latest versions).
- You'll need a file with udev rules so adb can recognize your device (this will be needed later), create a file named 51-android.rules with this content: SUBSYSTEM=="usb", ATTR{idVendor}=="19d2", MODE="0666", GROUP="plugdev" and put it in /etc/udev/rules.d and restart the system (restarting udev only doesn't work most of the time :-\). Sample file here.
- You'll need a working zte racer already
- Have your prefered kernel (deadlink or vamshi) and your prefered rom in the root of your sdcard in case something goes wrong
- HAVE A NANDROID BACKUP in case something goes really really wrong!
- Use this guide at your own risk!!!


B ) Build the rom

Let's start!

1) First you'll need Cyanogenmod Sources, for that read Cyanogenmod Build ZTE Blade wiki untill you get to the part "Copy Propietary Files". (meaning, after repo sync -j16 you'll have the sources needed)

2) Using the console go to ~/android/system (or whatever you named the dir with the cm sources) and execute sh vendor/cyanogen/get-rommanage otherwise cyanogenmod won't build

3) Now, go to elgomes github and download a zip from that and extract it. What's important from those files are the ones in the "vendor" folder, and you have two options, number one is to copy "vendor" folder from elgomes files you just downloaded and paste it in ~/android/system and answer yes when it ask to merge/replace files. The other option is to modify cyanogenmod's files to match what you get from elgomes repo.

4) Now go to this github repo and download a zip from that and extract it. You'll end up with several files. From a console, go to ~/android/system, execute mkdir -p device/zte/mooncake and copy all the files you extracted to the folder ~/android/system/device/zte/mooncake you just created.

5) Connect your phone to the PC with the usb cable and make sure you can access it with android's adb. Execute adb devices and if it shows something like this you're good to go:

List of devices attached
mooncake device

(if it says something different from "mooncake" like Racer or a number, that's ok as well)

5-1) If adb isn't detecting your device make sure you have put the .rules file for udev

6) In the console, go to ~/android/system/device/zte/mooncake and execute sh extract-files.sh this will copy several files needed from your device that can't be compiled from sources (either because the sources doesn't work or because there are no sources! :P (adrenolibs... I'm watching at you... ;)). What you should see after executing extract-files.sh is something like this:

➜ mooncake sh extract-files.sh
274 KB/s (24032 bytes in 0.085s)
1005 KB/s (107992 bytes in 0.104s)
960 KB/s (108924 bytes in 0.110s)
40 KB/s (3327 bytes in 0.080s)
1176 KB/s (79780 bytes in 0.066s)
4438 KB/s (1812980 bytes in 0.398s)
1872 KB/s (162912 bytes in 0.084s)
1609 KB/s (210640 bytes in 0.127s)
688 KB/s (38412 bytes in 0.054s)
13 KB/s (1156 bytes in 0.080s)
110 KB/s (9220 bytes in 0.081s)
3425 KB/s (900432 bytes in 0.256s)
122 KB/s (10268 bytes in 0.081s)
379 KB/s (17904 bytes in 0.046s)
909 KB/s (93004 bytes in 0.099s)
814 KB/s (86708 bytes in 0.103s)
290 KB/s (25752 bytes in 0.086s)
60 KB/s (5008 bytes in 0.080s)
157 KB/s (13336 bytes in 0.082s)
2003 KB/s (185892 bytes in 0.090s)
647 KB/s (66844 bytes in 0.100s)
553 KB/s (54364 bytes in 0.095s)
512 KB/s (50364 bytes in 0.095s)
1157 KB/s (78940 bytes in 0.066s)
606 KB/s (62660 bytes in 0.100s)
679 KB/s (37856 bytes in 0.054s)
286 KB/s (25784 bytes in 0.087s)
884 KB/s (94036 bytes in 0.103s)
110 KB/s (9260 bytes in 0.081s)
3580 KB/s (486712 bytes in 0.132s)
1381 KB/s (164428 bytes in 0.116s)
2457 KB/s (576104 bytes in 0.228s)
289 KB/s (26052 bytes in 0.087s)
695 KB/s (71704 bytes in 0.100s)
2947 KB/s (590316 bytes in 0.195s)
725 KB/s (38376 bytes in 0.051s)
246 KB/s (22160 bytes in 0.087s)
707 KB/s (38372 bytes in 0.052s)
700 KB/s (38376 bytes in 0.053s)
1307 KB/s (168032 bytes in 0.125s)
482 KB/s (46856 bytes in 0.094s)
627 KB/s (38396 bytes in 0.059s)
442 KB/s (42496 bytes in 0.093s)
332 KB/s (30148 bytes in 0.088s)
443 KB/s (42548 bytes in 0.093s)
1398 KB/s (186916 bytes in 0.130s)
1504 KB/s (190608 bytes in 0.123s)
368 KB/s (17636 bytes in 0.046s)
243 KB/s (21900 bytes in 0.087s)
113 KB/s (9412 bytes in 0.081s)
1477 KB/s (197192 bytes in 0.130s)
1128 KB/s (134812 bytes in 0.116s)
904 KB/s (97548 bytes in 0.105s)
817 KB/s (88164 bytes in 0.105s)
1136 KB/s (134204 bytes in 0.115s)
661 KB/s (68028 bytes in 0.100s)
831 KB/s (89668 bytes in 0.105s)
709 KB/s (39592 bytes in 0.054s)
288 KB/s (25916 bytes in 0.087s)
61 KB/s (5136 bytes in 0.081s)
➜ mooncake


7) In the console, go to ~/android/system and execute . build/envsetup.sh (Notice there's a dot and a space before "build", but you can use sh build/envsetup.sh or bash build/envsetup.sh or source build/envsetup.sh, whatever works for you guys)

8) In the console, go to ~/android/system (you should be already there) and execute brunch mooncake

9) Go for coffe or something, as I said, it'll take a while.


After the build is done, if there are no errors, you'll have a .zip in the folder out/target/product/mooncake with the rom (named Cyangenomod-something-KANG.zip or similar, that name is defined in ~/android/system/vendor/cyanogen/products/cyanogen_mooncake.mk)

Now, the rom you have build can be flashed with cwm, however it won't boot unless you also flash a kernel for zte racer (either deadlink's or vamshi's, that's why I told you earlier to have it in the root of your sdcard). Thing is, "kernel" in device/zte/mooncake folder is for blade phones, you could change it with another racer compatible kernel image however a kernel image is somewhat tied to ramdisk contents so if you only change the kernel image with a default ramdisk it might not boot, thus is prefered to just flash one of the available working kernels which already include a compatible ramdisk.

You're Done!

At least at this point you should a rom that boots without issues and have a working phone (I use a rom build using cyanogen sources with those steps so I know that if you've done everything correctly it should work.)


C) Tips, semi knowledge base and other stuff

- If you take the time to read mooncake files you'll notice a few things like BUILD_VOLD := false and BUILD_VOLD2 := false or BUILD_NETD := false. The reason for this is that you can actually build vold (either version 1 or 2) from sources successfully however it won't work, it won't allow you to mount the sdcard as removable storage when you connect the phone to the PC. If you don't know what vold is, read here. Netd is a similar thing, you can build it successfully from sources but it'll hang the boot because incompatible definitions of dsnproxy subsystem. The exact reasons for why this two things doesn't work correctly are unknown to me, I mean, reading lines and lines of C code, debugging and such takes time and a lot of testing, I started to do it at one point but you won't believe how difficult is to find documentation sometimes when something is going wrong. Relevant xkcd comic.

- RacerParts is a utility package made by deadlink, kinda to keep in sync with blade files (BladeParts, CMParts...), as of right now the most notable thing this offers is hard keys lights. You know, call/end call lights. Many have asked if this can be turned on, why are they turned off and such, and well, is turned off in the kernel the reason is to conserve battery life so not a bug but a feature! :D The only way to turn them is from userspace (or recompile the kernel) and that was deadlink did, basically he implements a function in RacerParts that calls the needed gpios to turn on the leds on specific activities. It offers an option (Menu -> Device Settings -> Backlight control) where you can turn off/on this leds, however keep in mind that if you uncheck it (turn off) the leds will still be used but a lot less (one time during boot and a few ocassions)

- Not a lot of documentation and support when things doesn't work as expected so if you get at some point stuck trying to integrate your super uber modification during cyanogenmod builds all I can say is that I know your pain and wish you the best of lucks!

- For those thinking "hmmm maybe if I build my rom I can do something about the damn calibration! :D" well that's only half-true, you see, the thing with calibration is that for it to work you need tslib integrated in two parts: 1. the kernel 2. android it self. In the kernel, values got from pointercal have to be hardcoded and used while reporting input events, in android a patched libui (more specifically InputReader.cpp from frameworks base) is required to implement tslib equations to "calibrate" the values the driver sends, also this calibration is done with the help of IDC files (read about here) so in the end is: Driver + Patched Libui + IDC file. Also, tslib isn't native of android, it needs to be cross compiled for arm, it has been done (I've done it also) and while is not a pain is the first requirement since after getting tslib runing on android you'll use ts_calibrate to generate the pointercal file from which you'll use the values needed to integrate in the kernel... that are then interpreted from libui.... in addition to idc file... you get the idea, if you sum up everything is a pain in the butt and requires a lot of testing, also, touchscreen variations (two zte racer may have different imperfections on their touchscreens resistive screens...) also play a part so is possible for two different devices need two different sets of pointercal values. Yeah, a pain.

- Cooking will help you improve your recently build rom, many things can be modified directly without uncompressing the zip file (using winrar or 7zip), others will require you to extract the rom (I use dsixda's kitchen for the rom, and racer kitchen2 for kernel images), related to porting however I don't know much about that stuff, only that it requires modifying framework-res.apk and systemUI. Others might give you tips on that, just ask.



Acknowledgements

I'm not that smart so many had to help me directly or indirectly to get this thing working, so thanks to:

Google (not only for android but for his search engine as well xD), CyanogenMod team, deadlink, equiliym, racerboy, vamshi, tigex, rickywatt, sebastian404 and many others here at modaco (while many don't even own a racer anymore their posts help me a lot while researching), xda-developers forum, elgomes github owner, 4pda forums and modaco forums for still keeping a section dedicated to my zte :P


Peace out!

Edit:// Corrected typos, grammar, wording and the like

Edited by GuyOverThere, 20 October 2012 - 04:31 PM.

  • 5

#2
equiliym

equiliym

    Hardcore

  • Members
  • PipPipPipPipPipPip
  • 1,346 posts
  • Gender:Male
  • Location:Novi Sad
  • Devices:ZTE Racer
  • Twitter:@equiliym
nice tutorial bro, kudos to you :D now people can compile and i can retire xD

  • 0
Suffering-oriented programming.. "First make it possible. Then make it beautiful. Then make it fast."
if i helped please press the vote up button :3

#3
noobzone

noobzone

    Regular

  • Members
  • PipPip
  • 57 posts
  • Devices:zte racer
c'mon equiliym don't retire man :( I know we don't have proper sources for some hw but some of us also don't have disk space or computer to compile from sources even if we know how to. I would start compiling right away. but school is starting and my laptop is my only computer available so I don't have the chance to install linux even if I do a partition because I don't have space :( We don't ask for cyanogenmod releases every week. just the ones that have big fixes are enough :)

also I would be really happy to test future roms. until now I had no problems what so ever :) that only means that the work is being done. next time I buy a cellphone will be like in a few years (got to get job first haha) but it will be a MAJOR upgrade believe me :P until then keep up the work ^_^

  • 0

#4
equiliym

equiliym

    Hardcore

  • Members
  • PipPipPipPipPipPip
  • 1,346 posts
  • Gender:Male
  • Location:Novi Sad
  • Devices:ZTE Racer
  • Twitter:@equiliym
im actually moving out in 10 hours to a new home and wont be online for a while so someone will have to do some building.. will check back the stats of racer users once i get my internets back :)

  • 1
Suffering-oriented programming.. "First make it possible. Then make it beautiful. Then make it fast."
if i helped please press the vote up button :3

#5
noobzone

noobzone

    Regular

  • Members
  • PipPip
  • 57 posts
  • Devices:zte racer
ow ok :) have a nice trip to your new home :D

  • 0

#6
GuyOverThere

GuyOverThere

    Enthusiast

  • Members
  • PipPipPip
  • 176 posts
  • Gender:Male
  • Location:Caracas, Venezuela
  • Interests:Gaming, Linux, Tech and other stuff
  • Devices:ZTE Racer x850
  • Twitter:@netalien

now people can compile and i can retire xD


Lol... you just like to make people suffer xD

Thanks mate! happy moving :D

  • 2

#7
Divinetoaura

Divinetoaura

    Newbie

  • Members
  • Pip
  • 16 posts
  • Gender:Male
  • Location:Indonesia,Jakarta
  • Devices:ZTE V-852 & ZTE Skate
whether this method works on windows xp?

  • 0

#8
GuyOverThere

GuyOverThere

    Enthusiast

  • Members
  • PipPipPip
  • 176 posts
  • Gender:Male
  • Location:Caracas, Venezuela
  • Interests:Gaming, Linux, Tech and other stuff
  • Devices:ZTE Racer x850
  • Twitter:@netalien

whether this method works on windows xp?


No, building android roms from source (cyanogenmod, aosp, aokp, etc..) only works on linux at the moment.

On windows xp the only thing you could do is to have a virtual machine with linux using virtualbox or vmware player or whatever.

  • 0

#9
Kyrii

Kyrii

    Newbie

  • Members
  • Pip
  • 30 posts
  • Gender:Male
  • Location:Campinas - SP
  • Devices:ZTE Racer/Future Galaxy Nexus
  • Twitter:@kyrii_br
Cool
But now you have to make a tutorial to do the kernel :P

  • 0
Posted Image

Galaxy X - Paranoid Android - Jellybean 4.2.2
Zte Racer - Unnoficial CyanogenMod 7.2 port

#10
GuyOverThere

GuyOverThere

    Enthusiast

  • Members
  • PipPipPip
  • 176 posts
  • Gender:Male
  • Location:Caracas, Venezuela
  • Interests:Gaming, Linux, Tech and other stuff
  • Devices:ZTE Racer x850
  • Twitter:@netalien
Cyanogenmod's wiki already have an accurately enough guide for kernels ;)

You'll only need to use other sources instead the cm-kernel thing, use the optional eabi if you don't have access to cyanogenmod's sources, use something like racer_kitchen to create the .img or .zip files from kernel image and that's it. The kernel wifi thing isn't needed nor the module builds for debian chroots (unless of course you're using that)

  • 0

#11
Divinetoaura

Divinetoaura

    Newbie

  • Members
  • Pip
  • 16 posts
  • Gender:Male
  • Location:Indonesia,Jakarta
  • Devices:ZTE V-852 & ZTE Skate
how to adb mode?
if the phone is lit when debuging or fastboot mode vol-call-vol down power?

  • 0

#12
GuyOverThere

GuyOverThere

    Enthusiast

  • Members
  • PipPipPip
  • 176 posts
  • Gender:Male
  • Location:Caracas, Venezuela
  • Interests:Gaming, Linux, Tech and other stuff
  • Devices:ZTE Racer x850
  • Twitter:@netalien

how to adb mode?
if the phone is lit when debuging or fastboot mode vol-call-vol down power?


read here: Android Debug Bridge

To use adb you don't need to put the phone in any special mode, you can have it running normally (although it should work as well while in recovery mode)

  • 0

#13
Divinetoaura

Divinetoaura

    Newbie

  • Members
  • Pip
  • 16 posts
  • Gender:Male
  • Location:Indonesia,Jakarta
  • Devices:ZTE V-852 & ZTE Skate
oh ok

if I could compile CM7 on my phone? ZTE V852 phone me
sorry many questions hehehehe

Edited by Divinetoaura, 29 September 2012 - 12:43 AM.

  • 0

#14
GuyOverThere

GuyOverThere

    Enthusiast

  • Members
  • PipPipPip
  • 176 posts
  • Gender:Male
  • Location:Caracas, Venezuela
  • Interests:Gaming, Linux, Tech and other stuff
  • Devices:ZTE Racer x850
  • Twitter:@netalien

oh ok

if I could compile CM7 on my phone? ZTE V852 phone me
sorry many questions hehehehe


Uhhh... I think that if you're trying to compile CM7 for v852 you're pretty much on your own :-\ at the very least it will take a lot of experimentation on your part, the thing is that you'll most likely need to change a few things, which ones I'm not sure. First you need to make sure to get the correct propietary files (I can't tell you which ones are needed since I don't know that phone model), also you'll need to test the libraries (the propietary ones) and I've no idea if you'll be able to use the kernel you currently have with CM7 (2.3 gingerbread) even if CM is builded successfully.

So far I haven't been able to find any 2.3 rom made for your phone (CM7 or not), I've read on androidforums that someone used a rom from here and was able to boot but it have issues and wasn't stable so can't help you much there :(

Edited by GuyOverThere, 29 September 2012 - 02:36 AM.

  • 0

#15
equiliym

equiliym

    Hardcore

  • Members
  • PipPipPipPipPipPip
  • 1,346 posts
  • Gender:Male
  • Location:Novi Sad
  • Devices:ZTE Racer
  • Twitter:@equiliym
racer roms do work on freddo but they have camera (2/3.2mp thing) and wifi issues.. wifi driver is afaik prebuilt so dunno about that and camera libs can be edited/modded.. you should totally disassemble your phone and check camera model to fix the driver :D

  • 0
Suffering-oriented programming.. "First make it possible. Then make it beautiful. Then make it fast."
if i helped please press the vote up button :3

#16
Divinetoaura

Divinetoaura

    Newbie

  • Members
  • Pip
  • 16 posts
  • Gender:Male
  • Location:Indonesia,Jakarta
  • Devices:ZTE V-852 & ZTE Skate
yes it may be very difficult to try to compile CM7 for my phone
but for this problem I will try porting the kernel from boot.img freddo me and break it down to take the kernel from boot.img freddo.
I will keep trying hehehehe

and below is the community for a phone that I use
https://www.facebook...09945992434619/

  • 0

#17
mikeioannina

mikeioannina

    Regular

  • Members
  • PipPip
  • 147 posts
  • Gender:Male
  • Location:Ioannina, Greece
  • Devices:ZTE Carl
I'm also trying to compile CM7 for my ZTE Carl which is based on mooncake board too. Everything goes fine until netd errors show up in the logcat and the phone just hangs at the bootanimation. I also noticed that there is an error in deadlink's extract-files.sh, as it copies incorrectly akmd2 as netd. You should use my forked github https://github.com/m...e_zte_mooncake/ in which i have fixed this.
But even when I copied the correct netd and gave it correct permissions, my phone still didn't boot CM7 and the same error shows up about netd... If you have any idea help me

Edited by mikeioannina, 10 October 2012 - 03:09 PM.

  • 0

If you like my work, don't forget to press the vote up button!
Current phones:
SE Xperia x10 mini - MiniCM10 & nAa-jb kernel
Using custom built roms by me:
SE Xperia mini - CyanogenMod 10 & FXP kernel

ZTE Carl - CyanogenMod 7 & 2.6.35.7 kernel


#18
GuyOverThere

GuyOverThere

    Enthusiast

  • Members
  • PipPipPip
  • 176 posts
  • Gender:Male
  • Location:Caracas, Venezuela
  • Interests:Gaming, Linux, Tech and other stuff
  • Devices:ZTE Racer x850
  • Twitter:@netalien

I'm also trying to compile CM7 for my ZTE Carl which is based on mooncake board too. Everything goes fine until netd errors show up in the logcat and the phone just hangs at the bootanimation. I also noticed that there is an error in deadlink's extract-files.sh, as it copies incorrectly akmd2 as netd. You should use my forked github https://github.com/m...e_zte_mooncake/ in which i have fixed this.
But even when I copied the correct netd and gave it correct permissions, my phone still didn't boot CM7 and the same error shows up about netd... If you have any idea help me


Yeah I remember the akmd2-netd glitch, it shouldn't matter since board-mooncake.mk should replace the file, however I think I that I still needed to correct the extract-files.sh to copy the correct netd, otherwise for some unknown reason netd wouldn't be replaced by board-mooncake.mk

Regarding netd block, I only had problems if I used the compiled one, as long as I had BUILD_NETD := false in boardconfig.mk and board-mooncake.mk pushing the prebuilt netd everything was fine, in your case here's an idea, modify extract-files.sh so it takes a copy of netd from your working phone, add another one to push it back, keep the BUILD_NETD as false but remove the push from board-mooncake.mk that sends the prebuilt netd.

I mean, this in your extract-files.sh:


adb pull /system/bin/akmd2 ../../../vendor/zte/$DEVICE/proprietary/akmd2
chmod 755 ../../../vendor/zte/$DEVICE/proprietary/akmd2
adb pull /system/bin/netd ../../../vendor/zte/$DEVICE/proprietary/netd
chmod 755 ../../../vendor/zte/$DEVICE/proprietary/netd

......
PRODUCT_COPY_FILES += \\
vendor/zte/__DEVICE__/proprietary/akmd2:system/bin/akmd2 \\
vendor/zte/__DEVICE__/proprietary/netd:system/bin/netd \\

Keep this in boardconfig.mk:
BUILD_NETD :=false

and remove netd push from board-mooncake.mk (including the backslash after vold):
PRODUCT_COPY_FILES += \
	device/zte/mooncake/prebuilt/vold:system/bin/vold \
device/zte/mooncake/prebuilt/netd:system/bin/netd

Edited by GuyOverThere, 10 October 2012 - 04:32 PM.

  • 0

#19
mikeioannina

mikeioannina

    Regular

  • Members
  • PipPip
  • 147 posts
  • Gender:Male
  • Location:Ioannina, Greece
  • Devices:ZTE Carl
Thanks, I did the corrections but I'm on my laptop now so I can't compile to see if it works

  • 0

If you like my work, don't forget to press the vote up button!
Current phones:
SE Xperia x10 mini - MiniCM10 & nAa-jb kernel
Using custom built roms by me:
SE Xperia mini - CyanogenMod 10 & FXP kernel

ZTE Carl - CyanogenMod 7 & 2.6.35.7 kernel


#20
Divinetoaura

Divinetoaura

    Newbie

  • Members
  • Pip
  • 16 posts
  • Gender:Male
  • Location:Indonesia,Jakarta
  • Devices:ZTE V-852 & ZTE Skate
how to create a proprietary file from my phone and uploaded on github

  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users