FORUMS
Remove All Ads from XDA

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

1,758 posts
Thanks Meter: 24,484
 
By mikeioannina, Recognized Developer on 26th February 2015, 08:52 PM
Post Reply Email Thread
This thread is intended for devs & advanced users only.

Here you can learn how to build CyanogenMod 12.1 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 CM12.1
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-12.1
Get the required local manifest
Code:
mkdir -p ~/android/system/.repo/local_manifests
curl https://raw.githubusercontent.com/LegacyXperia/local_manifests/cm-12.1/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
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-12.1-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-12.1/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-12.1-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.
The Following 22 Users Say Thank You to mikeioannina For This Useful Post: [ View ]
 
 
26th February 2015, 08:52 PM |#2  
mikeioannina's Avatar
OP Recognized Developer
Flag Ioannina
Thanks Meter: 24,484
 
More
Reserved
The Following 2 Users Say Thank You to mikeioannina For This Useful Post: [ View ]
27th February 2015, 03:51 AM |#3  
Druboo666's Avatar
Senior Member
Flag Dhaka
Thanks Meter: 380
 
More
getting insuficiant storage aviable in pa gappps (pico/micro) packages
27th February 2015, 04:32 PM |#4  
evil.demon_s's Avatar
Senior Member
Thanks Meter: 739
 
More
Quote:
Originally Posted by Druboo666

getting insuficiant storage aviable in pa gappps (pico/micro) packages

yes...same here
from build of 21st...i am getting this error
and even other zips are not getting flashed
The Following User Says Thank You to evil.demon_s For This Useful Post: [ View ] Gift evil.demon_s Ad-Free
27th February 2015, 05:30 PM |#5  
Junior Member
Thanks Meter: 10
 
More
TWRP
delete
18th May 2015, 11:36 AM |#6  
tinyXperia's Avatar
Senior Member
Flag The Netherlands
Thanks Meter: 1,458
 
More
Other than a fast HDD, does you computer need to be fast to build it? (Running a 2007 Core 2 Duo...)

Quote:
Originally Posted by Theonew

More cores are better. Here are the requirements to build it from source:

- 6GB of download.
- 25GB disk space to do a single build.
- 80GB disk space to build all AOSP configs at the same time.
- 16GB RAM recommended, more preferred, anything less will measurably benefit from using an SSD.
- 5+ hours of CPU time for a single build, 25+ minutes of wall time, as measured on a workstation (dual-E5620 i.e. 2x quad-core 2.4GHz HT, with 24GB of RAM, no SSD).



And I would say that a fast internet connection is also recommended, since the full source for initial sync is more than 10GBs (on ICS it already was, probably like 20GBs for lollipop).
21st May 2015, 08:25 AM |#7  
Member
Thanks Meter: 4
 
More
Prompt brunch build error 12.1
Hi,

I am trying to build the image from the sources as per the build instructions to make my own test build.
After repo downloads, while building i am getting error "init/Kconfig:953: can't open file "usr/Kconfig"" in the brunch smultron command.

I am following these commands:
1) repo init -u git://github.com/CyanogenMod/android.git -b cm-12.1
2) curl https://raw.githubusercontent.com/Le...-12.1/semc.xml > /tmp/android/system/.repo/local_manifests/semc.xml
3) repo sync
4) ln -s vendor/extra/updates.sh updates.sh
5) ./updates.sh
6) . build/envsetup.sh
7) breakfast smultron
8) brunch smultron
brunch smultron failed

Can you tell me whats wrong.

Thanks.
Attached Thumbnails
Click image for larger version

Name:	BrunchFailed.png
Views:	14336
Size:	102.2 KB
ID:	3323889  
The Following User Says Thank You to joshipallav For This Useful Post: [ View ] Gift joshipallav Ad-Free
21st May 2015, 09:14 AM |#8  
Langes's Avatar
Senior Member
Flag Sweet Spot
Thanks Meter: 2,755
 
Donate to Me
More
Quote:
Originally Posted by joshipallav

Hi,

I am trying to build the image from the sources as per the build instructions to make my own test build.
After repo downloads, while building i am getting error "init/Kconfig:953: can't open file "usr/Kconfig"" in the brunch smultron command.

I am following these commands:
1) repo init -u git://github.com/CyanogenMod/android.git -b cm-12.1
2) curl https://raw.githubusercontent.com/Le...-12.1/semc.xml > /tmp/android/system/.repo/local_manifests/semc.xml
3) repo sync
4) ln -s vendor/extra/updates.sh updates.sh
5) ./updates.sh
6) . build/envsetup.sh
7) breakfast smultron
8) brunch smultron
Can you tell me whats wrong.
Thanks.

Delete the folder ~/android/system/kernel
repo sync again and make sure you get no errors
run make clean
try to build again
19th July 2015, 12:59 PM |#9  
saqibkhan's Avatar
Senior Member
Thanks Meter: 302
 
Donate to Me
More
@Langes

hi.. just wanted to know.. any guide to Build for AOSP 5.1.1 Lollipop for Xperia Devices 2011 like cm12.1 here

and silly question time.. lol

is it possible that AOSP Android M source can also be built for Xperia Play (2011 Devices) .. I mean changes made by Mike (the AOSP Mike) + Source of Android M .. will it give us some output or :/
21st July 2015, 12:47 AM |#10  
Member
Jena
Thanks Meter: 5
 
More
I built this rom today with new 3.10 kernel. It seems to be improved in some points (what isn't neccessary because of kernel), but with new kernel I can't use wifi and mobile data seems to be not working too. To build I fetched the new kernel and cherry-picked following commits:
Code:
#msm7x30-common: Update USB configuration for 3.10
cherries+=(LX_594)

#Use common msm7x30 kernel
#cherries+=(LX_422)

#msm7x30-common: Use common msm7x30 kernel
cherries+=(LX_421)

#mogami-common: wl12xx updates for 3.10
cherries+=(LX_407)

#media/msm7x30: Update for 3.10 support
cherries+=(LX_403)

#display/msm7x30: Update for 3.10 support
cherries+=(LX_402)

#audio/msm7x30: Update for 3.10 support
cherries+=(LX_401)

#kernel
#usb: Import msm charger changes from 6.2.B.0.200
cherries+=(LX_430)

#usb: msm72k_otg: Remove userspace events [REVISIT]
cherries+=(LX_428)
Is there something I missed to get working internet connection? (I didn't really test the rom for other things so far)
22nd July 2015, 03:04 AM |#11  
saqibkhan's Avatar
Senior Member
Thanks Meter: 302
 
Donate to Me
More
Getting this error when building AOSP rest all goes fine..

build also starts but getting this error.. any suggestion ?
Attached Thumbnails
Click image for larger version

Name:	Screenshot from 2015-07-22 02:41:52.png
Views:	528
Size:	113.5 KB
ID:	3414186  
Post Reply Subscribe to Thread

Tags
12.0, 5.0, cm12.0, cyanogenmod, lollipop 5.0

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes