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

Root Build CyanogenMod7 from source | Development area

isaacj87

Android Expert
Dec 17, 2010
1,139
1,793
Dallas, TX
github.com
Build CM7 from source | Developer's area

Getting the source and building it is actually fairly straight-forward. For this guide, I'm going to assume that you're using Ubuntu 10.10 or higher. I'm using 11.10, but I'm pretty sure most of this is still applicable to Maverick (10.10). Also, the steps following getting the build-deps on Ubuntu should be usable in any other Linux distro (Fedora, openSUSE, etc.). You'll just have to find the proper way to getting the environment set-up on that distro.

I've adapted this guide from the Cyanogen wiki to fit specifically for the Motorola Triumph. Essentially, I've modified their repo manifest to add my Triumph repo as well. By using these instructions, you have the same thing that I've been working on in my Github: https://github.com/ikarosdev

NOTE: I'd like this thread to stay on track. Remember, this is a guide about building Android. I'm assuming you know your way around Linux distributions. However, I do encourage any help on getting things working with CM7.

Part I - Prepare your Build Environment

Let's go ahead and prepare our comps for building.


Go ahead and open up your terminal. You'll need to add a partner repository from Maverick in order to get sun-java6. I don't think openjdk is compatible.

Code:
sudo add-apt-repository "deb http://archive.canonical.com/ maverick partner"

We've enabled the repo, but we need to update our package lists.

Code:
sudo apt-get update


Now, we'll need to install our build dependencies. There are build-deps only applicable to the 64-bit (x86_64) systems. However, both 32-bit and 64-bit share common build-deps.

For 32-bit & 64-bit:

Code:
sudo apt-get install git-core gnupg flex bison gperf libsdl1.2-dev libesd0-dev  libwxgtk2.6-dev squashfs-tools build-essential zip curl libncurses5-dev  zlib1g-dev sun-java6-jdk pngcrush schedtool
64-bit only:

Code:
sudo apt-get install g++-multilib lib32z1-dev lib32ncurses5-dev lib32readline5-dev gcc-4.4-multilib g++-4.4-multilib
NOTE: According to the original guide gcc and g++ multilib is not necessary. However, I always install them anyways.

Now, we can create directories for the build:

Code:
mkdir -p ~/android/system && mkdir -p ~/bin
Now, we need to download the program "repo" and make it executable:

Code:
curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
Make it executable:

Code:
chmod a+x ~/bin/repo
NOTE: You'll need to logout for this to take effect.

Now, we initialize the repository and grab the source:

Code:
cd ~/android/system
Code:
repo init -u [URL="git://github.com/CyanogenMod/android.git"]git://github.com/ikarosdev/android.git[/URL] -b gingerbread
Code:
repo sync -j16
NOTE: Due to the large size, this make take several hours depending on your connection.

Part II - Pull proprietary files from device

Still with me? Alright, after staring at repo pulling all those files, guess what? You get to pull more files! However, this part only takes a few seconds.

First, you'll need to get ADB set-up. Thankfully, the CM-wiki has a nice how-to on doing so. Follow these instructions and then come back: Howto: Install the Android SDK - CyanogenMod Wiki

NOTE: You'll need to enable USB Debugging on the Triumph. You can achieve this by going to Settings --> Applications --> Development and lastly, enable "USB Debugging."

Okay, let's navigate to our device directory and pull the files. Make sure the device is plugged into the comp.

Code:
cd ~/android/system/device/motorola/triumph
Code:
sh ./extract-files.sh
NOTE: This is a work in progress. There are some files that still need to be pulled. However, at the moment, CM7 will still build "correctly" regardless.

Part III - Configure and Build

Now, we're getting to the fun part. First, we need to get ROM-Manager. CM7 will fail to build without it.

Get back to the home folder:

Code:
cd
Now, run this:

Code:
~/android/system/vendor/cyanogen/get-rommanager
Once that finishes, we can finally build CM7:

Code:
cd ~/android/system
Code:
repo sync -j16
NOTE: This makes sure that everything is up-to-date. While this is recommended, it is not required. However, sometimes there are changes to the source that will be missed if you do not do this.

Code:
. build/envsetup.sh && brunch triumph
This will take some time. Depending on how fast your comp is, this could take several hours. For me, on a dual-core system, it takes about an hour. After it is done, you'll find a zip generated in:

Code:
~/android/system/out/target/product/triumph/update.cm-XXXXX-signed.zip
And that's all there is to it.



Build ClockworkMod Recovery

Now, that I've fixed my CWM port specifically for the Triumph, I'll show you guys how to build that as well.

Make sure the build directory is clean:

Code:
make clean && make clobber
NOTE: make clean isn't technically necessary

Now, we'll get the build prepped for building a recovery:

Code:
. build/envsetup.sh && lunch cyanogen_triumph-eng
And lastly, we'll build a recovery image:

Code:
make -j4 recoveryimage
That's it! You'll find a generated recovery.img file in:

Code:
~/android/system/out/target/product/triumph/recovery.img
Follow the usual steps to get CWM on our phones.
 
I`m going to give this a go. I`m always up for a learning experience. Thanks for the walkthrough of this part.

EDIT:

Hmmmm??? on the
sh ./extract-files.sh
part I am getting a

./extract-files.sh: 121: adb: not found

Any ideas? I had adb working previously for changing my MTU settings and such

The best thing to do is get the adb server started and then it doesn't matter where you install adb. Where did you put the actual ADB binary?
 
Upvote 0
The best thing to do is get the adb server started and then it doesn't matter where you install adb. Where did you put the actual ADB binary?

Okay I fixed my adb issues. I forgot to get all the paths directed correctly. I`m now moving along with this. I do however have another issue you may help me with. I tried to flash your triumph specific CWM, but it did not load correctly. I suspected a corrupt file tranfer on my part so I went back to try again and now I can`t write to the MOBILE\image folder... it says the file system is read only all of the sudden.

EDIT:

After much mucking with disk utility, the trash bin (not quite deleted file had it in limbo?), and so on I managed to get read write back somehow after hours of poking around and rebooting. The new CWM for triumph (isaacj87 variation) is now booting properly. Thanks again!
 
Upvote 0
No problem. This is a learning process for me. I`m taking pokes at learning stuff in between graduate school and training to replace my boss as he is retiring.

I proceeded from that point in the tutorial and everything seemed to be singing right along,but I had a massive failure in the middle of the build. I`m going to try again tommorow and look at see if I can figure out where it bombed out on me. I might have fat fingered something somewhere earlier in the process that is coming back to haunt me.
 
Upvote 0
No problem. This is a learning process for me. I`m taking pokes at learning stuff in between graduate school and training to replace my boss as he is retiring.

I proceeded from that point in the tutorial and everything seemed to be singing right along,but I had a massive failure in the middle of the build. I`m going to try again tommorow and look at see if I can figure out where it bombed out on me. I might have fat fingered something somewhere earlier in the process that is coming back to haunt me.

I should mention that while I'm working on CM7, my device configs are changing all the time. Just do a repo sync if your build fails. I wish there was a way on Github to indicate if the code is currently broken or not.
 
Upvote 0
I attempted to build from this and failed here on the brunch command:


Code:
Install: out/target/product/triumph/system/lib/libnetlink.so
prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/../lib/gcc/arm-eabi/4.4.3/../../../../arm-eabi/bin/ld: out/target/product/triumph/obj/SHARED_LIBRARIES/libandroid_runtime_intermediates/AndroidRuntime.o: in function android::gRegJNI:AndroidRuntime.cpp(.data.rel.ro+0x148): error: undefined reference to 'register_android_hardware_fm_fmradio(_JNIEnv*)'
collect2: ld returned 1 exit status
make: *** [out/target/product/triumph/obj/SHARED_LIBRARIES/libandroid_runtime_intermediates/LINKED/libandroid_runtime.so] Error 1
make: *** Waiting for unfinished jobs....
karl@ubuntu:~/android/system$

It appears to be failing due to a missing routine related to the FM radio (which the Triumph doesn't have, right?)

Repository sync'd a couple of hours ago....

Recovery does build and works.
 
Upvote 0
I attempted to build from this and failed here on the brunch command:


Code:
Install: out/target/product/triumph/system/lib/libnetlink.so
prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/../lib/gcc/arm-eabi/4.4.3/../../../../arm-eabi/bin/ld: out/target/product/triumph/obj/SHARED_LIBRARIES/libandroid_runtime_intermediates/AndroidRuntime.o: in function android::gRegJNI:AndroidRuntime.cpp(.data.rel.ro+0x148): error: undefined reference to 'register_android_hardware_fm_fmradio(_JNIEnv*)'
collect2: ld returned 1 exit status
make: *** [out/target/product/triumph/obj/SHARED_LIBRARIES/libandroid_runtime_intermediates/LINKED/libandroid_runtime.so] Error 1
make: *** Waiting for unfinished jobs....
karl@ubuntu:~/android/system$
It appears to be failing due to a missing routine related to the FM radio (which the Triumph doesn't have, right?)

Repository sync'd a couple of hours ago....

Recovery does build and works.

At times, the code in the repo is broken and won't build... You may just need to try repo synching and building another day/time when it is fixed.
 
Upvote 0
I've been going through this tutorial and just wanted to verify a couple of things:

1. The ClockworkMod Recovery was updated to v5.0.2.3 and it's blue. (it does seem to work though--did a restore and it works ok).

2. The CM7 source is broken atm since every time I tried to build after a repo sync, I get an error?

Just wanted to make sure that it's just not me making a mistake. Thanks.

Edit: I see from the Tickerguy CM7 thread that he's updating from CM7 and the repo is broken atm. I assume that is why the recovery is also updated. I'll try another repo sync another day.
 
Upvote 0
I've been going through this tutorial and just wanted to verify a couple of things:

1. The ClockworkMod Recovery was updated to v5.0.2.3 and it's blue. (it does seem to work though--did a restore and it works ok).

2. The CM7 source is broken atm since every time I tried to build after a repo sync, I get an error?

Just wanted to make sure that it's just not me making a mistake. Thanks.

Edit: I see from the Tickerguy CM7 thread that he's updating from CM7 and the repo is broken atm. I assume that is why the recovery is also updated. I'll try another repo sync another day.

What was the error? Also, I didn't know the recovery got updated. There's no problem with that.
 
Upvote 0
What was the error? Also, I didn't know the recovery got updated. There's no problem with that.

I get a whole bunch of errors similar to this:

out/target/product/triumph/obj/include/loc_api/rpcgen/inc/loc_api_rpcgen_common_rpc.h:239: error: 'rpc_uint16' does not name a type
out/target/product/triumph/obj/include/loc_api/rpcgen/inc/loc_api_rpcgen_common_rpc.h:349: error: 'rpc_uint32' does not name a type
out/target/product/triumph/obj/include/loc_api/rpcgen/inc/loc_api_rpcgen_common_rpc.h:350: error: 'rpc_uint32' does not name a type
out/target/product/triumph/obj/include/loc_api/rpcgen/inc/loc_api_rpcgen_common_rpc.h:354: error: 'rpc_uint16' does not name a type
out/target/product/triumph/obj/include/loc_api/rpcgen/inc/loc_api_rpcgen_common_rpc.h:398: error: 'rpc_uint16' does not name a type
out/target/product/triumph/obj/include/loc_api/rpcgen/inc/loc_api_rpcgen_common_rpc.h:405: error: 'rpc_uint16' does not name a type
out/target/product/triumph/obj/include/loc_api/rpcgen/inc/loc_api_rpcgen_common_rpc.h:413: error: 'rpc_uint16' does not name a type
out/target/product/triumph/obj/include/loc_api/rpcgen/inc/loc_api_rpcgen_common_rpc.h:452: error: 'rpc_uint16' does not name a type

.
.
pp:45:
hardware/qcom/gps/loc_api/libloc_api_50001/loc_eng_log.h:34: warning: 'loc_eng_callback_log_header' initialized and declared 'extern'
hardware/qcom/gps/loc_api/libloc_api_50001/loc_eng_log.h:34: error: 'rpc_loc_client_handle_type' was not declared in this scope
hardware/qcom/gps/loc_api/libloc_api_50001/loc_eng_log.h:35: error: 'rpc_loc_event_mask_type' was not declared in this scope
hardware/qcom/gps/loc_api/libloc_api_50001/loc_eng_log.h:36: error: expected primary-expression before 'const'
hardware/qcom/gps/loc_api/libloc_api_50001/loc_eng_log.h:37: error: initializer expression list treated as compound expression
hardware/qcom/gps/loc_api/libloc_api_50001/loc_eng_log.h:40: warning: 'loc_eng_callback_log' initialized and declared 'extern'
hardware/qcom/gps/loc_api/libloc_api_50001/loc_eng_log.h:40: error: 'rpc_loc_event_mask_type' was not declared in this scope
hardware/qcom/gps/loc_api/libloc_api_50001/loc_eng_log.h:41: error: expected primary-expression before 'const'
hardware/qcom/gps/loc_api/libloc_api_50001/loc_eng_log.h:42: error: initializer expression list treated as compound expression
hardware/qcom/gps/loc_api/libloc_api_50001/loc_eng_log.h:44: warning: 'loc_get_event_name' initialized and declared 'extern'


Looks like a lot of stuff didn't get initialized basically.
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones