{All 2011}[GUIDE][DEV] How to build CyanogenMod 11.0

Search This thread

mikeioannina

Recognized Developer
Mar 22, 2011
1,949
26,987
Ioannina
Lenovo P2
Xiaomi Mi Mix 2
This thread is intended for devs & advanced users only.

Here you can learn how to build CyanogenMod 11.0 for any of the 2011 xperia devices.
I will use 'smultron' as an example device, you should replace the codename with the device you want to build.


For the first time you try to build CM11.0
Follow this guide up to "Initialize the CyanogenMod source repository" step (don't execute this step).
http://wiki.cyanogenmod.org/w/Build_for_smultron

Initialize the CyanogenMod source repository
Enter the following to initialize the repository:
Code:
cd ~/android/system/
repo init -u git://github.com/CyanogenMod/android.git -b cm-11.0

Get the required local manifest
Code:
mkdir -p ~/android/system/.repo/local_manifests
curl https://raw.githubusercontent.com/LegacyXperia/local_manifests/cm-11.0/semc.xml > ~/android/system/.repo/local_manifests/semc.xml

Download the source code
Code:
repo sync

Setup the build environment
Code:
. build/envsetup.sh

Download some commits from CyanogenMod gerrit which are not accepted yet
Code:
ln -s vendor/extra/updates.sh updates.sh
./updates.sh

Get the prebuilts
Code:
cd ~/android/system/vendor/cm
./get-prebuilts

Setup the build environment & prepare the device-specific code.
Code:
cd ~/android/system
. build/envsetup.sh
breakfast smultron

Build the ROM (takes long time)
Code:
brunch smultron

If the build finishes successfully, you will find the build here (change DATE into the date):
~/android/system/out/target/product/smultron/cm-11.0-DATE-UNOFFICIAL-LegacyXperia-smultron.zip


The next times you want to build, you only need to do the following:
Sync the repositories & make sure you are using the latest local_manifest.
Code:
cd ~/android/system/
curl https://raw.githubusercontent.com/LegacyXperia/local_manifests/cm-11.0/semc.xml > ~/android/system/.repo/local_manifests/semc.xml
repo sync

Setup the build environment
Code:
. build/envsetup.sh

Download some commits from CyanogenMod gerrit which are not accepted yet
Code:
./updates.sh

Build the ROM
Code:
brunch smultron

If the build finishes successfully, you will find the build here (change DATE into the date):
~/android/system/out/target/product/smultron/cm-11.0-DATE-UNOFFICIAL-LegacyXperia-smultron.zip


Steps to build only the kernel:
Sync the repositories.
Code:
cd ~/android/system/
repo sync

Setup the environment
Code:
. build/envsetup.sh

Download some commits from CyanogenMod gerrit which are not accepted yet
Code:
./updates.sh

Build the kernel
Code:
breakfast smultron
make -j4 bootimage

If the build finishes successfully, you will find the boot image here:
~/android/system/out/target/product/smultron/boot.img

Some suggestions for faster builds:
* Enable ccache
* Use the fastest hdd on your pc to store the source, build output & ccache
* You can also buy an ssd, if it's not large enough to hold everything, just store the build output & ccache
* mount /tmp on tmpfs (RAM).

The above have greatly improved my dirty build times with removed /out/target from 1h30m to 30m.
Mounting /tmp on tmpfs made the biggest improvement for me.


Credits: Thanks to hnl_dk for the initial CM9 & CM10 guides.
 
Last edited:

johnny.tifosi

Senior Member
Dec 11, 2012
103
26
Sorry for the noob question, first time builder here. You say you prepare the device specific code, but there is no official CM11 for 2011 Xperia. Where does this code come from? Do you upload somehow your ROMs to Cyanogenmod servers? If it is true, that means that if I build CM11 on my own I can get the latest features before you even release them with a nightly?
 

andogeek10

Senior Member
Apr 7, 2012
1,560
786
24
Mumbai
Sorry for the noob question, first time builder here. You say you prepare the device specific code, but there is no official CM11 for 2011 Xperia. Where does this code come from? Do you upload somehow your ROMs to Cyanogenmod servers? If it is true, that means that if I build CM11 on my own I can get the latest features before you even release them with a nightly?

Legacy Xperia maintains the device trees on github. All the respective devices have their codes there. No, the builds are not uploaded to CM servers. But, if you build CM11 at whatever respective time you build, the latest feautes merged till that time will be incorporated in the build.

Sent from my Xperia Mini Pro using XDA Premium 4 mobile app
 

johnny.tifosi

Senior Member
Dec 11, 2012
103
26
Hi,
For compile KitKat which better 32bit or 64bit Ubuntu ?

The link in the OP states:
"Note:

You want to use a 64-bit version of Linux. According to Google, 32-bit Linux environment will only work if you are building older versions prior to Gingerbread (2.3.x)/CyanogenMod 7. However, as of 10.1 CyanogenMod does not build with 64bit host binaries on some systems. You will have to set something like BUILD_HOST_32bit=1 in your environment when building on such 64bit system. "
 
  • Like
Reactions: r00lz

johnny.tifosi

Senior Member
Dec 11, 2012
103
26
Building stops after about 10 minutes with the following error: AttributeError: 'NoneType' object has no attribute 'group'.

Code:
target thumb C++: third_party_WebKit_Source_wtf_wtf_gyp <= external/chromium_org/third_party/WebKit/Source/wtf/ArrayBuffer.cpp
Traceback (most recent call last):
  File "../../base/android/jni_generator/jni_generator.py", line 1070, in <module>
    sys.exit(main(sys.argv))
  File "../../base/android/jni_generator/jni_generator.py", line 1066, in main
    options.optimize_generation)
  File "../../base/android/jni_generator/jni_generator.py", line 1001, in GenerateJNIHeader
    jni_from_javap = JNIFromJavaP.CreateFromClass(input_file, namespace)
  File "../../base/android/jni_generator/jni_generator.py", line 514, in CreateFromClass
    jni_from_javap = JNIFromJavaP(stdout.split('\n'), namespace)
  File "../../base/android/jni_generator/jni_generator.py", line 457, in __init__
    contents[1]).group('class_name')
AttributeError: 'NoneType' object has no attribute 'group'
make: *** [/home/johnny/android/system/out/target/product/urushi/obj/GYP/shared_intermediates/ui/gl/jni/Surface_jni.h] Error 1
make: *** Waiting for unfinished jobs....

Any help?
 

ivosat

Member
Jun 25, 2012
49
6
43
You will need more than 55 GB free space to build it from scratch ( Linux installation and everything else ).
 

plethorahil

Senior Member
Jun 12, 2013
244
200
You will need more than 55 GB free space to build it from scratch ( Linux installation and everything else ).

I have no issues with storage ...cause ofd 1 tb hdd
but how much data i have to download to build it from scratch ?
Does everyone downloads that who build their own build ? !!
(Dont high speed bandwidths costs expensive in your countries ?)
 
  • Like
Reactions: sahil9701

Top Liked Posts

  • There are no posts matching your filters.
  • 78
    This thread is intended for devs & advanced users only.

    Here you can learn how to build CyanogenMod 11.0 for any of the 2011 xperia devices.
    I will use 'smultron' as an example device, you should replace the codename with the device you want to build.


    For the first time you try to build CM11.0
    Follow this guide up to "Initialize the CyanogenMod source repository" step (don't execute this step).
    http://wiki.cyanogenmod.org/w/Build_for_smultron

    Initialize the CyanogenMod source repository
    Enter the following to initialize the repository:
    Code:
    cd ~/android/system/
    repo init -u git://github.com/CyanogenMod/android.git -b cm-11.0

    Get the required local manifest
    Code:
    mkdir -p ~/android/system/.repo/local_manifests
    curl https://raw.githubusercontent.com/LegacyXperia/local_manifests/cm-11.0/semc.xml > ~/android/system/.repo/local_manifests/semc.xml

    Download the source code
    Code:
    repo sync

    Setup the build environment
    Code:
    . build/envsetup.sh

    Download some commits from CyanogenMod gerrit which are not accepted yet
    Code:
    ln -s vendor/extra/updates.sh updates.sh
    ./updates.sh

    Get the prebuilts
    Code:
    cd ~/android/system/vendor/cm
    ./get-prebuilts

    Setup the build environment & prepare the device-specific code.
    Code:
    cd ~/android/system
    . build/envsetup.sh
    breakfast smultron

    Build the ROM (takes long time)
    Code:
    brunch smultron

    If the build finishes successfully, you will find the build here (change DATE into the date):
    ~/android/system/out/target/product/smultron/cm-11.0-DATE-UNOFFICIAL-LegacyXperia-smultron.zip


    The next times you want to build, you only need to do the following:
    Sync the repositories & make sure you are using the latest local_manifest.
    Code:
    cd ~/android/system/
    curl https://raw.githubusercontent.com/LegacyXperia/local_manifests/cm-11.0/semc.xml > ~/android/system/.repo/local_manifests/semc.xml
    repo sync

    Setup the build environment
    Code:
    . build/envsetup.sh

    Download some commits from CyanogenMod gerrit which are not accepted yet
    Code:
    ./updates.sh

    Build the ROM
    Code:
    brunch smultron

    If the build finishes successfully, you will find the build here (change DATE into the date):
    ~/android/system/out/target/product/smultron/cm-11.0-DATE-UNOFFICIAL-LegacyXperia-smultron.zip


    Steps to build only the kernel:
    Sync the repositories.
    Code:
    cd ~/android/system/
    repo sync

    Setup the environment
    Code:
    . build/envsetup.sh

    Download some commits from CyanogenMod gerrit which are not accepted yet
    Code:
    ./updates.sh

    Build the kernel
    Code:
    breakfast smultron
    make -j4 bootimage

    If the build finishes successfully, you will find the boot image here:
    ~/android/system/out/target/product/smultron/boot.img

    Some suggestions for faster builds:
    * Enable ccache
    * Use the fastest hdd on your pc to store the source, build output & ccache
    * You can also buy an ssd, if it's not large enough to hold everything, just store the build output & ccache
    * mount /tmp on tmpfs (RAM).

    The above have greatly improved my dirty build times with removed /out/target from 1h30m to 30m.
    Mounting /tmp on tmpfs made the biggest improvement for me.


    Credits: Thanks to hnl_dk for the initial CM9 & CM10 guides.
    15
    You overtaken me. I will reset the repo now and do a new build.

    If it works I think it's time to roll some builds... it's been 2 months without update
    13
    I have pushed some experimental changes:
    * Enabled real stereo recording (might need some adjustments)
    * Enabled in-call noise suppression (needs http://review.cyanogenmod.org/63399)
    * Added initial support for zeus devices in kernel. Should not affect mogami devices, but please test if I messed up anything
    * Enabled some LPA properties to test if there are any improvements
    * Enabled SIM hotswap (should fix the "New SIM inserted" popup on boot)
    * Enabled support for wiimote in kernel (CM just merged support for it in userspace, also needs this http://review.cyanogenmod.org/63389)
    * Removed some unused SEMC audio code from kernel

    I will push some more changes for frameworks/av in cm gerrit now and update the cherry-pick script so you don't miss anything.
    I'll edit this message when I'm done with the changes.
    EDIT: Done. Don't forget to run updates.sh before starting the build (https://github.com/LegacyXperia/local_manifests/blob/cm-11.0/updates.sh)
    12
    New Test

    Hi Guys,

    First off I would like to give you all a big Thank You :highfive: for testing the ion kernel on your devices. The comunity response has been really amazing :good:

    Mike has made some changes to the kernel that should sort out the graphics bug (works on my Ray)
    I have once again made kernels for all the 2011 Xperias currently enjoying KK support.

    If you don't mind, please test again.

    This time all should work, so please post your dmesg and device if you do still have the graphics glitch.

    If you can get into recovery with this kernel, your device is ready for the ion :D

    http://pacman.basketbuild.com/index.php?dir=main/devs/langes/iontest_2/
    (all uploads should be done in the next 30 minutes)