Guide on how I build my own CM9 test builts

Search This thread

hnl_dk

Senior Member
Nov 1, 2010
1,362
480
A follow up on this - http://xdaforums.com/showpost.php?p=28177937&postcount=1768 - in the CM9 FXP thread, have I promised to make a little guide.

Guide how I build CM9 for my Mango.

For the first time you try to build CM9.
Create ~/bin and download repo to that directory. Afterwards set executable bit to make it possible to ”execute”.
Code:
mkdir -p ~/bin
curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo 
chmod a+x ~/bin/repo
Now reboot the computer.

Create ~/android/system amd initialize the repository.
Code:
mkdir -p ~/android/system
cd ~/android/system/ 
repo init -u git://github.com/CyanogenMod/android.git -b ics 
repo sync
Setup the environmental settings and initialize the Mango build.
Code:
. build/envsetup.sh
brunch mango
Setup the environmental settings and initialize the Mango build.
Code:
git clone git://github.com/TheMuppets/proprietary_vendor_semc.git  -b ics ~/android/system/vendor/semc
cd ~/android/system/device/semc/mango/
./setup-makefiles.sh
Download the prebuilts
Code:
~/android/system/vendor/cm/get-prebuilts
Check for new changes
Code:
cd ~/android/system/ 
repo sync
Setup the environment again and build the ROM (takes long time)
Code:
. build/envsetup.sh
brunch mango
You will now find the build here (change DATE into the date).
~/android/system/out/target/product/mango/cm-9-DATE-UNOFFICIAL-mango.zip

The next times you try to build it, you only need to do the following.
Delete build.prop, if not will build.prop not get generated.
Code:
rm -f ~/android/system/out/target/product/mango/system/build.prop
Syncronise the git repositories.
Code:
cd ~/android/system/
repo sync
Setup the environmental settings.
Code:
. build/envsetup.sh
Configure/build.
Code:
brunch mango
You will now find the build here (change DATE into the date).
~/android/system/out/target/product/mango/cm-9-DATE-UNOFFICIAL-mango.zip

If you are trying to build it on a 32bit system, you should change line 374 in ~/android/system/device/semc/msm7x30-common/releasetools/common.py
from:
Code:
  cmd = ["java", "-Xmx2048m", "-jar",
to:
Code:
  cmd = ["java", "-Xmx1024m", "-jar",

If you get into any trouble, please let me know, I may have missed something.

EDIT (July 2. 2012): I have made a patch to msm7x30-common, so you do not need to edit the file (with this patch does it automatically check if you run on a 64bit or a 32bit system):
http://code.google.com/p/freexperia/issues/detail?id=527

EDIT (July 6. 2012): If there has been an update on git://github.com/koush/proprietary_vendor_semc.git (like there has been today), shall you do the following (pull the updates):
Code:
cd ~/android/system/vendor/semc
git pull

EDIT (July 8. 2012): Adding the following, just before "</manifest>" in ".repo/local_manifest.xml" and the proprietary files will also get updated, when you make a normal "repo sync". Got this idea after talking to Andreas (so thank you Andreas).
Code:
  <project name="TheMuppets/proprietary_vendor_semc" path="vendor/semc" remote="github" revision="ics" />

EDIT (July 11. 2012): Changed the proprietary repository from git://github.com/koush/proprietary_vendor_semc.git to git://github.com/TheMuppets/proprietary_vendor_semc.git
 
Last edited:

gandhar

Senior Member
Jan 20, 2012
1,037
679
Goa
allright, i have already synched the cm9 repo. about 5.8 gbs
can you tell me what folders does it include?
edit:took me a few days to download, just don't want to download again
 
Last edited:

hnl_dk

Senior Member
Nov 1, 2010
1,362
480
allright, i have already synched the cm9 repo. about 5.8 gbs
can you tell me what folders does it include?
Are you thinking of the "clean" repo?

My ~/android/system/ consists of the following (remember the hidden directories):
abi
android
bionic
bootable
build
dalvik
development
device
external
frameworks
hardware
kernel
libcore
ndk
out
packages
prebuilt
sdk
system
vendor
.repo
.repoconfig
Makefile
 

hnl_dk

Senior Member
Nov 1, 2010
1,362
480
You should be able to move your current directory and "just" sync it, to get it up to date.
 

gandhar

Senior Member
Jan 20, 2012
1,037
679
Goa
Are you thinking of the "clean" repo?

My ~/android/system/ consists of the following (remember the hidden directories):
abi
android
bionic
bootable
build
dalvik
development
device
external
frameworks
hardware
kernel
libcore
ndk
out
packages
prebuilt
sdk
system
vendor
.repo
.repoconfig
Makefile


allright, out of these except for kernel, out and .repoconfig i have all the others synced.
will using
Code:
repo init -u git://github.com/CyanogenMod/android.git -b ics 
repo sync

work?


i am missing kernel, out and .repoconfig
 

hnl_dk

Senior Member
Nov 1, 2010
1,362
480
allright, out of these except for kernel, out and .repoconfig i have all the others synced.
will using
Code:
repo init -u git://github.com/CyanogenMod/android.git -b ics 
repo sync

work?


i am missing kernel, out and .repoconfig
They are possibly first created when running brunch the first time. So it should be fine.
 

gandhar

Senior Member
Jan 20, 2012
1,037
679
Goa
successfully building, but getting loads of warnings..
is that normal for the first build?
will report if it boots after compile is over.
 

hnl_dk

Senior Member
Nov 1, 2010
1,362
480
successfully building, but getting loads of warnings..
is that normal for the first build?
will report if it boots after compile is over.
There are lots of warnings.
Personally I usually remove all that warnings (using the -Werror option, so warnings get treated as errors) in the projects I am working on. But I understand why it can be a big problem with CM9, that is based on many different projects.

Looking forward to hear if you get a successful built.
 

gandhar

Senior Member
Jan 20, 2012
1,037
679
Goa
There are lots of warnings.
Personally I usually remove all that warnings (using the -Werror option, so warnings get treated as errors) in the projects I am working on. But I understand why it can be a big problem with CM9, that is based on many different projects.

Looking forward to hear if you get a successful built.

building will take some time...
well, most warnings are 'some variable has been set but not used', is that much significant?
 

hnl_dk

Senior Member
Nov 1, 2010
1,362
480
building will take some time...
well, most warnings are 'some variable has been set but not used', is that much significant?
Yes, first build takes a lot of time... the next times it will be a lot faster.

No that is not very significant, but things like that should still get fixed, to to make it easier to find the significant things.
The less warnings the more easy it is to spot what is important. This also goes for things that should get changed when upgrading to a new major version of the toolchain.
 

gandhar

Senior Member
Jan 20, 2012
1,037
679
Goa
succesfull build!

phone:coconut-wt19i
time: 56 mins for the complete build.
cpu: 2.9 ghz - 4 cores
os:ubuntu 12.04 64 bit

backed up the phone.
boots into recovery
errorless install.
 

hnl_dk

Senior Member
Nov 1, 2010
1,362
480
running fine.

but i see some dependencies missing from the libs needed from
http://wiki.cyanogenmod.com/wiki/Template:Build_from_source_(CM9)
downloading them, will build again later..

is that the reason for the warnings?
looks like a nice guide that is working with most devices, will save that link :D
No, the warnings are simply that you rarely find "clean" code, where most warnings have been fixed.
You also need to think of all the code from external projects.
You also only get many of the warnings, if you do not compile the code for some specific platforms.
 

gandhar

Senior Member
Jan 20, 2012
1,037
679
Goa
looks like a nice guide that is working with most devices, will save that link :D
No, the warnings are simply that you rarely find "clean" code, where most warnings have been fixed.
You also need to think of all the code from external projects.
You also only get many of the warnings, if you do not compile the code for some specific platforms.

saw that guide after i started checking for dependencies.

1.hey i see two zips in the output,
one cm-9-20120702-UNOFFICIAL-coconut and other cm_coconut-ota-eng.gandhar
the second is bigger.
i used the first one. why is the second one built i wonder?

2.i think of compiling aosp from source too, but the out folder is 11.3 gbs, what about that?
i do not want to end up falling short on space.

3.this is a system related question, how much will it hinder performance if i move the source to a different internal hd from the main one and build from there?
 

hnl_dk

Senior Member
Nov 1, 2010
1,362
480
saw that guide after i started checking for dependencies.

1.hey i see two zips in the output,
one cm-9-20120702-UNOFFICIAL-coconut and other cm_coconut-ota-eng.gandhar
the second is bigger.
i used the first one. why is the second one built i wonder?
Try to read the name ;-)
OTA - Over The Air... I guess that it can mbe used tfor OTA updates, like the mobile companies makes.
2.i think of compiling aosp from source too, but the out folder is 11.3 gbs, what about that?
i do not want to end up falling short on space.
You could do a "make clear", but if you have enough space, would I keep it, so you do not need to wait for the already up to date files.
3.this is a system related question, how much will it hinder performance if i move the source to a different internal hd from the main one and build from there?
There will be no problem with performance, as long as you move it to a HDD that is not too slow.
 
  • Like
Reactions: gandhar

gandhar

Senior Member
Jan 20, 2012
1,037
679
Goa
i do a repo sync again, at end of it i get errors on changed files. i think its not replacing the old files.
it's red text
error: bootable/recovery/: CyanogenMod/android_bootable_recovery checkout f8fc12e741d566af215407f35cfc52e5c1cc0023
error: build/: CyanogenMod/android_build checkout df7d6893a59e62c15dd20e306d8280b16969097c
error: external/openssl/: CyanogenMod/android_external_openssl checkout d4004ae717232b83ea445f74c881d9ddc24f589d
error: frameworks/base/: CyanogenMod/android_frameworks_base checkout e0a8c35c1572f0f0dbbda4d871d0a919a79cbe3f
error: hardware/samsung/: CyanogenMod/android_hardware_samsung checkout 23280fc439163a1971956167217283c4ae70bce3
error: packages/apps/Camera/: CyanogenMod/android_packages_apps_Camera checkout 644384a979ec9bd6b237e9031d5afbf592d3056b
error: packages/apps/Settings/: CyanogenMod/android_packages_apps_Settings checkout a946d9a905d460fa9d6c153e031285b566f8d223
error: system/core/: CyanogenMod/android_system_core checkout 389a2fa1d7e4bb8b6be411f272de2e8c92817964
 

hnl_dk

Senior Member
Nov 1, 2010
1,362
480
i do a repo sync again, at end of it i get errors on changed files. i think its not replacing the old files.
it's red text
error: bootable/recovery/: CyanogenMod/android_bootable_recovery checkout f8fc12e741d566af215407f35cfc52e5c1cc0023
error: build/: CyanogenMod/android_build checkout df7d6893a59e62c15dd20e306d8280b16969097c
error: external/openssl/: CyanogenMod/android_external_openssl checkout d4004ae717232b83ea445f74c881d9ddc24f589d
error: frameworks/base/: CyanogenMod/android_frameworks_base checkout e0a8c35c1572f0f0dbbda4d871d0a919a79cbe3f
error: hardware/samsung/: CyanogenMod/android_hardware_samsung checkout 23280fc439163a1971956167217283c4ae70bce3
error: packages/apps/Camera/: CyanogenMod/android_packages_apps_Camera checkout 644384a979ec9bd6b237e9031d5afbf592d3056b
error: packages/apps/Settings/: CyanogenMod/android_packages_apps_Settings checkout a946d9a905d460fa9d6c153e031285b566f8d223
error: system/core/: CyanogenMod/android_system_core checkout 389a2fa1d7e4bb8b6be411f272de2e8c92817964
Have not tried that.
You can try to do a "repo forall -c git reset --hard" this "resets" all the repositories (removes all changes, also if something has been corrupted).
 
  • Like
Reactions: Uchiha_Dev

Top Liked Posts

  • There are no posts matching your filters.
  • 11
    A follow up on this - http://xdaforums.com/showpost.php?p=28177937&postcount=1768 - in the CM9 FXP thread, have I promised to make a little guide.

    Guide how I build CM9 for my Mango.

    For the first time you try to build CM9.
    Create ~/bin and download repo to that directory. Afterwards set executable bit to make it possible to ”execute”.
    Code:
    mkdir -p ~/bin
    curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo 
    chmod a+x ~/bin/repo
    Now reboot the computer.

    Create ~/android/system amd initialize the repository.
    Code:
    mkdir -p ~/android/system
    cd ~/android/system/ 
    repo init -u git://github.com/CyanogenMod/android.git -b ics 
    repo sync
    Setup the environmental settings and initialize the Mango build.
    Code:
    . build/envsetup.sh
    brunch mango
    Setup the environmental settings and initialize the Mango build.
    Code:
    git clone git://github.com/TheMuppets/proprietary_vendor_semc.git  -b ics ~/android/system/vendor/semc
    cd ~/android/system/device/semc/mango/
    ./setup-makefiles.sh
    Download the prebuilts
    Code:
    ~/android/system/vendor/cm/get-prebuilts
    Check for new changes
    Code:
    cd ~/android/system/ 
    repo sync
    Setup the environment again and build the ROM (takes long time)
    Code:
    . build/envsetup.sh
    brunch mango
    You will now find the build here (change DATE into the date).
    ~/android/system/out/target/product/mango/cm-9-DATE-UNOFFICIAL-mango.zip

    The next times you try to build it, you only need to do the following.
    Delete build.prop, if not will build.prop not get generated.
    Code:
    rm -f ~/android/system/out/target/product/mango/system/build.prop
    Syncronise the git repositories.
    Code:
    cd ~/android/system/
    repo sync
    Setup the environmental settings.
    Code:
    . build/envsetup.sh
    Configure/build.
    Code:
    brunch mango
    You will now find the build here (change DATE into the date).
    ~/android/system/out/target/product/mango/cm-9-DATE-UNOFFICIAL-mango.zip

    If you are trying to build it on a 32bit system, you should change line 374 in ~/android/system/device/semc/msm7x30-common/releasetools/common.py
    from:
    Code:
      cmd = ["java", "-Xmx2048m", "-jar",
    to:
    Code:
      cmd = ["java", "-Xmx1024m", "-jar",

    If you get into any trouble, please let me know, I may have missed something.

    EDIT (July 2. 2012): I have made a patch to msm7x30-common, so you do not need to edit the file (with this patch does it automatically check if you run on a 64bit or a 32bit system):
    http://code.google.com/p/freexperia/issues/detail?id=527

    EDIT (July 6. 2012): If there has been an update on git://github.com/koush/proprietary_vendor_semc.git (like there has been today), shall you do the following (pull the updates):
    Code:
    cd ~/android/system/vendor/semc
    git pull

    EDIT (July 8. 2012): Adding the following, just before "</manifest>" in ".repo/local_manifest.xml" and the proprietary files will also get updated, when you make a normal "repo sync". Got this idea after talking to Andreas (so thank you Andreas).
    Code:
      <project name="TheMuppets/proprietary_vendor_semc" path="vendor/semc" remote="github" revision="ics" />

    EDIT (July 11. 2012): Changed the proprietary repository from git://github.com/koush/proprietary_vendor_semc.git to git://github.com/TheMuppets/proprietary_vendor_semc.git
    2
    So I should first cd my android directory and give the command clean repo. And then do the above mentioned changes right?
    personally I would make a new repo init, at another place, so you are sure that everything is "clean".
    1
    saw that guide after i started checking for dependencies.

    1.hey i see two zips in the output,
    one cm-9-20120702-UNOFFICIAL-coconut and other cm_coconut-ota-eng.gandhar
    the second is bigger.
    i used the first one. why is the second one built i wonder?
    Try to read the name ;-)
    OTA - Over The Air... I guess that it can mbe used tfor OTA updates, like the mobile companies makes.
    2.i think of compiling aosp from source too, but the out folder is 11.3 gbs, what about that?
    i do not want to end up falling short on space.
    You could do a "make clear", but if you have enough space, would I keep it, so you do not need to wait for the already up to date files.
    3.this is a system related question, how much will it hinder performance if i move the source to a different internal hd from the main one and build from there?
    There will be no problem with performance, as long as you move it to a HDD that is not too slow.
    1
    i do a repo sync again, at end of it i get errors on changed files. i think its not replacing the old files.
    it's red text
    error: bootable/recovery/: CyanogenMod/android_bootable_recovery checkout f8fc12e741d566af215407f35cfc52e5c1cc0023
    error: build/: CyanogenMod/android_build checkout df7d6893a59e62c15dd20e306d8280b16969097c
    error: external/openssl/: CyanogenMod/android_external_openssl checkout d4004ae717232b83ea445f74c881d9ddc24f589d
    error: frameworks/base/: CyanogenMod/android_frameworks_base checkout e0a8c35c1572f0f0dbbda4d871d0a919a79cbe3f
    error: hardware/samsung/: CyanogenMod/android_hardware_samsung checkout 23280fc439163a1971956167217283c4ae70bce3
    error: packages/apps/Camera/: CyanogenMod/android_packages_apps_Camera checkout 644384a979ec9bd6b237e9031d5afbf592d3056b
    error: packages/apps/Settings/: CyanogenMod/android_packages_apps_Settings checkout a946d9a905d460fa9d6c153e031285b566f8d223
    error: system/core/: CyanogenMod/android_system_core checkout 389a2fa1d7e4bb8b6be411f272de2e8c92817964
    Have not tried that.
    You can try to do a "repo forall -c git reset --hard" this "resets" all the repositories (removes all changes, also if something has been corrupted).
    1
    From Guide on how I build my own CM10 test builts:


    For CM9 the file is in:

    ~/android/system/device/semc/msm7x30-common/libsensors/sensors

    This fix should only work for satsuma, coconut, smultron & mango which use bma250 sensor. For anzu, hallon, haida, iyokan, urushi you need to edit bma150_input.c instead

    mindelay should be 5000 which is 5ms and not 0. I tested with value 5000 and it works fine, already pushed the changes to bring DASH up-to-date with the sonyxperiadev repository (the CM fork is currently 21 commits behind) and fix the lag on all xperia 2011 for CM10 to gerrit. I also made a pull request for this fix to the sonyxperiadev github.

    EDIT: The fix is merged in CM10