1. Download our Official Android App: Forums for Android!

Root Build CyanogenMod7 from source | Development area

Discussion in 'Android Devices' started by isaacj87, Aug 3, 2011.

  1. isaacj87

    isaacj87 Android Expert
    Thread Starter
    Rank:
    None
    Points:
    313
    Posts:
    1,139
    Joined:
    Dec 17, 2010

    Dec 17, 2010
    1,139
    1,793
    313
    Full-time college student
    Dallas, TX
    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 (Text):
    1. 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 (Text):
    1. 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 (Text):
    1. 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 (Text):
    1. 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 (Text):
    1. mkdir -p ~/android/system && mkdir -p ~/bin
    Now, we need to download the program "repo" and make it executable:

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

    Code (Text):
    1. 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 (Text):
    1. cd ~/android/system
    Code (Text):
    1. repo init -u [URL="git://github.com/CyanogenMod/android.git"]git://github.com/ikarosdev/android.git[/URL] -b gingerbread
    Code (Text):
    1. 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 (Text):
    1. cd ~/android/system/device/motorola/triumph
    Code (Text):
    1. 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 (Text):
    1. cd
    Now, run this:

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

    Code (Text):
    1. cd ~/android/system
    Code (Text):
    1. 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 (Text):
    1. . 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 (Text):
    1. ~/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 (Text):
    1. make clean && make clobber
    NOTE: make clean isn't technically necessary

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

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

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

    Code (Text):
    1. ~/android/system/out/target/product/triumph/recovery.img
    Follow the usual steps to get CWM on our phones.
     

    Advertisement

  2. isaacj87

    isaacj87 Android Expert
    Thread Starter
    Rank:
    None
    Points:
    313
    Posts:
    1,139
    Joined:
    Dec 17, 2010

    Dec 17, 2010
    1,139
    1,793
    313
    Full-time college student
    Dallas, TX
  3. streetpounder

    streetpounder Well-Known Member
    Rank:
    None
    Points:
    36
    Posts:
    108
    Joined:
    Jul 28, 2011

    Jul 28, 2011
    108
    9
    36
    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
     
  4. isaacj87

    isaacj87 Android Expert
    Thread Starter
    Rank:
    None
    Points:
    313
    Posts:
    1,139
    Joined:
    Dec 17, 2010

    Dec 17, 2010
    1,139
    1,793
    313
    Full-time college student
    Dallas, TX
    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?
     
  5. isaacj87

    isaacj87 Android Expert
    Thread Starter
    Rank:
    None
    Points:
    313
    Posts:
    1,139
    Joined:
    Dec 17, 2010

    Dec 17, 2010
    1,139
    1,793
    313
    Full-time college student
    Dallas, TX
    Updated the guide to show how to build my CWM port.
     
  6. streetpounder

    streetpounder Well-Known Member
    Rank:
    None
    Points:
    36
    Posts:
    108
    Joined:
    Jul 28, 2011

    Jul 28, 2011
    108
    9
    36
    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!
     
  7. streetpounder

    streetpounder Well-Known Member
    Rank:
    None
    Points:
    36
    Posts:
    108
    Joined:
    Jul 28, 2011

    Jul 28, 2011
    108
    9
    36
    I get down to the following area

    Code (Text):
    1. cd
    Now, run this:

    Code (Text):
    1. ~/android/system/vendor/cyanogenmod/get-rommanager
    Once that finishes, we can finally build CM7:

    I`m having trouble at this point... I get
    bash: /home/enigma/android/system/motorola/cyanogenmod/get-rommanager: No such file or directory


     
  8. streetpounder

    streetpounder Well-Known Member
    Rank:
    None
    Points:
    36
    Posts:
    108
    Joined:
    Jul 28, 2011

    Jul 28, 2011
    108
    9
    36
    ah found the problem... the line:

    Code (Text):
    1.  ~/android/system/vendor/cyanogenmod/get-rommanger[B]
    needed to be this [/B]

    Code (Text):
    1.  ~/android/system/vendor/cyanogen/get-rommanager
    Not sure if that needs changed on your walkthrough or was just specific to my case
     
    isaacj87 likes this.
  9. isaacj87

    isaacj87 Android Expert
    Thread Starter
    Rank:
    None
    Points:
    313
    Posts:
    1,139
    Joined:
    Dec 17, 2010

    Dec 17, 2010
    1,139
    1,793
    313
    Full-time college student
    Dallas, TX
    Ah, thanks. I fixed the guide. :)
     
  10. streetpounder

    streetpounder Well-Known Member
    Rank:
    None
    Points:
    36
    Posts:
    108
    Joined:
    Jul 28, 2011

    Jul 28, 2011
    108
    9
    36
    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.
     
  11. isaacj87

    isaacj87 Android Expert
    Thread Starter
    Rank:
    None
    Points:
    313
    Posts:
    1,139
    Joined:
    Dec 17, 2010

    Dec 17, 2010
    1,139
    1,793
    313
    Full-time college student
    Dallas, TX
    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.
     
  12. wsimon

    wsimon Well-Known Member
    Rank:
    None
    Points:
    53
    Posts:
    164
    Joined:
    Jul 31, 2011

    Jul 31, 2011
    164
    98
    53

    Almost- except get-rommanger should be get-rommanager.
    You left off an 'a' ;)

    Thanks for the guide!
     
    isaacj87 likes this.
  13. isaacj87

    isaacj87 Android Expert
    Thread Starter
    Rank:
    None
    Points:
    313
    Posts:
    1,139
    Joined:
    Dec 17, 2010

    Dec 17, 2010
    1,139
    1,793
    313
    Full-time college student
    Dallas, TX
    Oops! Thanks, guide is fixed.
     
  14. tickerguy

    tickerguy Android Enthusiast
    Rank:
     #124
    Points:
    163
    Posts:
    533
    Joined:
    Aug 15, 2011

    I attempted to build from this and failed here on the brunch command:


    Code (Text):
    1. Install: out/target/product/triumph/system/lib/libnetlink.so
    2. 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*)'
    3. collect2: ld returned 1 exit status
    4. make: *** [out/target/product/triumph/obj/SHARED_LIBRARIES/libandroid_runtime_intermediates/LINKED/libandroid_runtime.so] Error 1
    5. make: *** Waiting for unfinished jobs....
    6. 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.
     
  15. wsimon

    wsimon Well-Known Member
    Rank:
    None
    Points:
    53
    Posts:
    164
    Joined:
    Jul 31, 2011

    Jul 31, 2011
    164
    98
    53
    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.
     
  16. isaacj87

    isaacj87 Android Expert
    Thread Starter
    Rank:
    None
    Points:
    313
    Posts:
    1,139
    Joined:
    Dec 17, 2010

    Dec 17, 2010
    1,139
    1,793
    313
    Full-time college student
    Dallas, TX
    I broke the source last night. I'm looking for a way to get audio working. I'll let you guys know when it's back up.
     
  17. tickerguy

    tickerguy Android Enthusiast
    Rank:
     #124
    Points:
    163
    Posts:
    533
    Joined:
    Aug 15, 2011

    Thanks..... (figured that the repository was hosed due to edits "in process" ;-))
     
  18. isaacj87

    isaacj87 Android Expert
    Thread Starter
    Rank:
    None
    Points:
    313
    Posts:
    1,139
    Joined:
    Dec 17, 2010

    Dec 17, 2010
    1,139
    1,793
    313
    Full-time college student
    Dallas, TX
    Repo sync and try again. The systems should be jolly now.
     
  19. tickerguy

    tickerguy Android Enthusiast
    Rank:
     #124
    Points:
    163
    Posts:
    533
    Joined:
    Aug 15, 2011

    Yep - builds. Thanks!

    (Off to hack away...)
     
  20. isaacj87

    isaacj87 Android Expert
    Thread Starter
    Rank:
    None
    Points:
    313
    Posts:
    1,139
    Joined:
    Dec 17, 2010

    Dec 17, 2010
    1,139
    1,793
    313
    Full-time college student
    Dallas, TX
    Source is broken again, will fix later.
     
  21. tickerguy

    tickerguy Android Enthusiast
    Rank:
     #124
    Points:
    163
    Posts:
    533
    Joined:
    Aug 15, 2011

    What I got from the time when it was not broken builds correctly but does not boot. No obvious error messages, just nothing at all - just the splash screen.

    No problem restoring back, but obviously whatever I pulled when I pulled it had some problems ;-)

    Update: Never mind - re-sync'd, rebuilt, now boots. Hacking now ;-)
     
  22. vasqued2

    vasqued2 Lurker
    Rank:
    None
    Points:
    5
    Posts:
    4
    Joined:
    Sep 1, 2011

    Sep 1, 2011
    4
    0
    5
    Got everything built following the instructions but how do I debug? Found something in another forum that hinted at being able to connect via adb and step through the code w/ eclipse but no details. Is there a how to anywhere?
     
  23. mantera

    mantera Android Expert
    Rank:
    None
    Points:
    313
    Posts:
    1,319
    Joined:
    May 21, 2011

    May 21, 2011
    1,319
    1,587
    313
    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.
     
  24. isaacj87

    isaacj87 Android Expert
    Thread Starter
    Rank:
    None
    Points:
    313
    Posts:
    1,139
    Joined:
    Dec 17, 2010

    Dec 17, 2010
    1,139
    1,793
    313
    Full-time college student
    Dallas, TX
    What was the error? Also, I didn't know the recovery got updated. There's no problem with that.
     
  25. mantera

    mantera Android Expert
    Rank:
    None
    Points:
    313
    Posts:
    1,319
    Joined:
    May 21, 2011

    May 21, 2011
    1,319
    1,587
    313
    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.
     

Share This Page

Loading...