[GUIDE] How to make your own CM-11.0 for your S4 mini

aguaz

Senior Member
Jan 16, 2014
136
31
0
Ok, my bad.
I was checking github site which defaults to cm-10.1 branch. I see serrano-common cm-11.0 got indeed updated. All good thanks.
 
T

thomson.aa

Guest
Compiled cm11 some days ago. It is important to run:
Code:
./get-prebuilts in /vendor/cm
prior running the building procedure. Otherwise there will be build errors and the build will eventually fail.
@k2wl: Maybe you should mention this in your first post.
 

245

Member
May 4, 2015
9
1
0
@k2wl

Where to find a changelog for CM11?
Now that there are no more nightlies cmxlog does not work anymore. How to find out about patches to the CM11 codebase w/o going through every git repo?
 

245

Member
May 4, 2015
9
1
0
sun java 6 is needed to build from source upto kitkat.
i have experienced openjdk building while jb...it is hopless....too many errors....better to stick for java6.
it has been said that from android L mostly google will support openjdk 7
i dont know that yet for sure.
Meanwhile openjdk7 works just fine, both for cm-11 & cm-12
 

csendre

Senior Member
Aug 30, 2013
2,244
4,795
203
Burlington
@k2wl would it be possible to update OP for latest version tools and CM13?
For reasons and error messages unknown to me I failed to succeed with CM11, but would like to start from scratch again with CM 13 Thanks!

Questions:
- I am running Ubuntu 15.10 and installed Java 8, will this work for CM13?
- When tried to install the developer utilities as directed in A.3. of the OP, got missing links. Instead I followed another guide which recommended:
Code:
$sudo apt-get install git-core gnupg flex bison gperf build-essential \
  zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 \
  lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev ccache \
  libgl1-mesa-dev libxml2-utils xsltproc unzip
This installed well. Will it work?
- For B.1 of OP; For CM 13 I just replaced CM 11 with CM 13 and seem to have worked. Was it correct what I have done?
- For B.3 of OP; If I follow instructions, the S4Mini.xml is created in the .repo folder. Shouldn't this be in the .repo/local_manifests folder?
- For B.4 of OP. After syncing I ended up with 24.7 GB. Is this about right for CM 13 or did I download the wrong stuff?
- For C.3 of OP; can you please give more details on how to patch and build for 9192? I don't see a /device/Samsung folder in the downloaded sources. Shouldn't we download the patches from you?

Thanks!

Update: I tried again building a CM 11 as well, and this time the build process was running and seem to have completed. I have lots of stuff in the /out/target/product/serranodsdd folder but how do I make a flashable zip? How do I know if the build process finished successfully?
 
Last edited:

k2wl

Senior Member
Apr 19, 2008
3,166
7,573
0
@k2wl would it be possible to update OP for latest version tools and CM13?
For reasons and error messages unknown to me I failed to succeed with CM11, but would like to start from scratch again with CM 13 Thanks!

Questions:
- I am running Ubuntu 15.10 and installed Java 8, will this work for CM13?
- When tried to install the developer utilities as directed in A.3. of the OP, got missing links. Instead I followed another guide which recommended:
Code:
$sudo apt-get install git-core gnupg flex bison gperf build-essential \
  zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 \
  lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev ccache \
  libgl1-mesa-dev libxml2-utils xsltproc unzip
This installed well. Will it work?
- For B.1 of OP; For CM 13 I just replaced CM 11 with CM 13 and seem to have worked. Was it correct what I have done?
- For B.3 of OP; If I follow instructions, the S4Mini.xml is created in the .repo folder. Shouldn't this be in the .repo/local_manifests folder?
- For B.4 of OP. After syncing I ended up with 24.7 GB. Is this about right for CM 13 or did I download the wrong stuff?
- For C.3 of OP; can you please give more details on how to patch and build for 9192? I don't see a /device/Samsung folder in the downloaded sources. Shouldn't we download the patches from you?

Thanks!

Update: I tried again building a CM 11 as well, and this time the build process was running and seem to have completed. I have lots of stuff in the /out/target/product/serranodsdd folder but how do I make a flashable zip? How do I know if the build process finished successfully?
use this instructions to initialize build environment for cm13
http://developer.sonymobile.com/kno...aosp-marshmallow-for-unlocked-xperia-devices/

1. jdk 8 is not supported for building so please dont use it.
2.use following xml in .repo/local_manifests
Code:
  <project name="CyanogenMod/android_device_samsung_msm8930-common" path="device/samsung/msm8930-common" remote="github" revision="cm-13.0" />
  <project name="CyanogenMod/android_device_samsung_serrano-common" path="device/samsung/serrano-common" remote="github" revision="cm-13.0" />
  <project name="CyanogenMod/android_kernel_samsung_msm8930-common" path="kernel/samsung/msm8930-common" remote="github" revision="cm-13.0" />
  <project name="k2wl/android_device_samsung_serranodsdd" path="device/samsung/serranodsdd"  remote="github" revision="cm-13.0" />
  <project name="CyanogenMod/android_device_samsung_qcom-common" path="device/samsung/qcom-common" remote="github" revision="cm-13.0" />
  <project name="CyanogenMod/android_hardware_samsung" path="hardware/samsung" remote="github" revision="cm-13.0" />
  <project name="sileshn/proprietary_vendor_samsung" path="vendor/samsung" remote="github" revision="cm-13.0" />
  <project name="CyanogenMod/android_device_qcom_common" path="device/qcom/common" remote="github" revision="cm-13.0"/>
  <project name="CyanogenMod/android_external_stlport" path="external/stlport" revision="cm-13.0" remote="github" />
<remove-project name="CyanogenMod/android_device_generic_arm64" groups="pdk" remote="cm" />
<remove-project name="CyanogenMod/android_device_generic_armv7-a-neon" groups="pdk" remote="cm" />
<remove-project name="CyanogenMod/android_device_generic_common" groups="pdk" remote="cm" />
<remove-project name="CyanogenMod/android_device_generic_goldfish" groups="pdk" remote="cm" />

<remove-project name="CyanogenMod/android_device_generic_mips" groups="pdk" remote="cm" />
<remove-project name="CyanogenMod/android_device_google_atv" groups="device,fugu,broadcom_pdk,generic_fs" remote="cm" />

<remove-project name="CyanogenMod/android_hardware_intel_common_libmix" groups="intel" remote="cm" />
<remove-project name="CyanogenMod/android_hardware_intel_common_libva" groups="intel" remote="cm" />
<remove-project name="CyanogenMod/android_hardware_intel_common_libwsbm" groups="intel" remote="cm" />
<remove-project name="CyanogenMod/android_hardware_intel_common_omx-components" groups="intel" remote="cm" />
<remove-project name="CyanogenMod/android_hardware_intel_img_hwcomposer" groups="intel" remote="cm" />
<remove-project name="CyanogenMod/android_hardware_intel_img_psb_headers" groups="intel" remote="cm" />
<remove-project name="CyanogenMod/android_hardware_intel_img_psb_video" groups="intel" remote="cm" />
<remove-project name="CyanogenMod/android_hardware_invensense" groups="invensense" remote="cm" />
<remove-project name="CyanogenMod/android_hardware_nvidia_audio" groups="nvidia_audio" remote="cm" />
<remove-project name="CyanogenMod/android_hardware_samsung_slsi_exynos5" remote="cm" />
<remove-project name="CyanogenMod/android_hardware_ti_omap4" remote="cm" />
<remove-project name="CyanogenMod/android_hardware_ti_omap4xxx" groups="omap4" remote="cm" />
<remove-project name="CyanogenMod/android_hardware_ti_wlan" remote="cm" />
<remove-project name="CyanogenMod/android_hardware_ti_wpan" remote="cm" />
<remove-project name="device/generic/mini-emulator-arm64" groups="pdk" remote="aosp" />
<remove-project name="device/generic/mini-emulator-armv7-a-neon" groups="pdk" remote="aosp" />

<remove-project name="device/generic/mini-emulator-mips" groups="pdk" remote="aosp" />
<remove-project name="device/generic/mini-emulator-x86" groups="pdk" remote="aosp" />
<remove-project name="device/generic/mini-emulator-x86_64" groups="pdk" remote="aosp" />
<remove-project name="device/generic/qemu" remote="aosp" />
<remove-project name="device/generic/x86" groups="pdk" remote="aosp" />
<remove-project name="device/generic/x86_64" groups="pdk" remote="aosp" />
<remove-project name="device/google/accessory/arduino" groups="device" remote="aosp" />
<remove-project name="device/google/accessory/demokit" groups="device" remote="aosp" />
<remove-project name="device/sample" groups="pdk" remote="aosp" />
<remove-project name="platform/hardware/intel/audio_media" groups="intel" remote="aosp" />
<remove-project name="platform/hardware/intel/bootstub" groups="intel" remote="aosp" />
<remove-project name="platform/hardware/intel/common/bd_prov" groups="intel" remote="aosp" />
<remove-project name="platform/hardware/intel/common/libstagefrighthw" groups="intel" remote="aosp"/>
<remove-project name="platform/hardware/intel/common/utils" groups="intel" remote="aosp" />
<remove-project name="platform/hardware/intel/common/wrs_omxil_core" groups="intel" remote="aosp" />
<remove-project name="platform/hardware/intel/sensors" groups="intel_sensors" remote="aosp" />
<remove-project name="platform/hardware/marvell/bt" groups="marvell_bt" remote="aosp" />
<remove-project name="platform/hardware/mediatek" groups="mediatek,mediatek_wear" remote="aosp" />
    
<remove-project name="platform/hardware/ti/omap3" groups="omap3" remote="aosp" />
<remove-project name="platform/hardware/ti/omap4-aah" groups="omap4-aah" remote="aosp" />

<remove-project name="platform/prebuilts/android-emulator" groups="pdk-fs" clone-depth="1" />
<remove-project name="platform/prebuilts/clang/darwin-x86/host/3.6" groups="pdk,darwin" />

<remove-project name="platform/prebuilts/gcc/darwin-x86/aarch64/aarch64-linux-android-4.9" groups="pdk,darwin,arm" />
<remove-project name="platform/prebuilts/gcc/darwin-x86/arm/arm-eabi-4.8" groups="pdk,darwin,arm" />
<remove-project name="platform/prebuilts/gcc/darwin-x86/arm/arm-linux-androideabi-4.9" groups="pdk,darwin,arm" />
<remove-project name="platform/prebuilts/gcc/darwin-x86/host/headers" groups="pdk,darwin" />
<remove-project name="platform/prebuilts/gcc/darwin-x86/host/i686-apple-darwin-4.2.1" groups="pdk,darwin" />
<remove-project name="platform/prebuilts/gcc/darwin-x86/mips/mips64el-linux-android-4.9" groups="pdk,darwin,mips" />
<remove-project name="platform/prebuilts/gcc/darwin-x86/x86/x86_64-linux-android-4.9" groups="pdk,darwin,x86" />

<remove-project name="platform/prebuilts/gcc/linux-x86/mips/mips64el-linux-android-4.9" groups="pdk,linux,mips" />

<remove-project name="platform/prebuilts/python/darwin-x86/2.7.5" groups="darwin,pdk,pdk-cw-fs" />
removing those unnecessary repos will speed up your syncing

3. make build.sh in your cm13 folder with following content
Code:
#!/bin/bash
cd ~/cm13
repo sync -f --force-sync
rm -rf out/target/product/serranodsdd
. device/samsung/serranodsdd/patches/install-all.sh
##############
cd ~/cm13
. build/envsetup.sh
brunch serranodsdd
this sync up and build your code automatically with patching the source with necessary patches everytime you run this script
Code:
./build.sh
4. your output folder is out/target/product/serranodsdd/
your output zip is in that folder named
cm-13.0-*-UNOFFICIAL-serranodsdd.zip
 
Last edited:

csendre

Senior Member
Aug 30, 2013
2,244
4,795
203
Burlington
@k2wl, you are the best, thank you!

---------- Post added at 11:22 PM ---------- Previous post was at 10:27 PM ----------

4. your output folder is out/target/product/serranodsdd/
your output zip is in that folder named
cm-13.0-*-UNOFFICIAL-serranodsdd.zip
So if the zip file is missing it means that the build failed? will have to try again. So far still trying to at least replicate a CM11 build. Update: CM11 worked!!! - my 1st build! Now on to CM13 ....
What you do with the content of the output folder before each new build, do you delete everything?
 
Last edited:

k2wl

Senior Member
Apr 19, 2008
3,166
7,573
0
@k2wl, you are the best, thank you!

---------- Post added at 11:22 PM ---------- Previous post was at 10:27 PM ----------



So if the zip file is missing it means that the build failed? will have to try again. So far still trying to at least replicate a CM11 build. Update: CM11 worked!!! - my 1st build! Now on to CM13 ....
What you do with the content of the output folder before each new build, do you delete everything?
i delete just the serranodsdd folder so that it should get build with all new changes and i upload it to ftp through above script only.

:) welcome to rom building...
 
Last edited:

SilviuMik

Senior Member
Nov 17, 2011
1,494
1,511
0
csendre , k2wl I make a full clean before a new build. Maybe not needed but i prefer it like so :)
Paranoid command :) : make clobber && make clean && rm -rf ~/.ccache
 
  • Like
Reactions: csendre

k2wl

Senior Member
Apr 19, 2008
3,166
7,573
0
csendre , k2wl I make a full clean before a new build. Maybe not needed but i prefer it like so :)
Paranoid command :) : make clobber && make clean && rm -rf ~/.ccache
i didnt use ccache.... too many build errors for me...so to serranodsdd is the folder for device specific building so i just delete that...may it is on personal preferrences
 

SilviuMik

Senior Member
Nov 17, 2011
1,494
1,511
0
Do I run this from within the repective CM folder?

Sent from my GT-I9192 using XDA Free mobile app
Yes :)
And as k2wl said earlier ccache is kinda crap sometimes and is better if u disable it. So remove the last part from that command after u disable ccache :)
Add:
Code:
export CCACHE_DISABLE=1
to your ~/.bashrc
 
Last edited:
  • Like
Reactions: csendre

csendre

Senior Member
Aug 30, 2013
2,244
4,795
203
Burlington
:) welcome to rom building...
Thanks again, CM13 is building right now, hopefully it will work. I am only having issues with running the bash file (I think I forgot to set permissions), but could apply patches and start building manually. Will see in a few hours if it works.

If you don't mind, a few more questions of a more general nature:
1. How would I go about building a pure AOSP ROM? Would I just download AOSP sources and add the local manifests as with CM? If so, how can I find the location of these sources? Actually how do you look up links to any source even CM branches and device specific projects within? Could not find it with simple Google search.
2. How would I build an updated version of a CM13 ROM for another device? The original author has his sources posted on github, but how can I build a local manifest from this? To be more specific, here is the thread to this build.
Is it listed somewhere which CM projects belong to a specific device? For example if I never saw your manifest, how would I know that for the 9192 I needed the msm8930 and other projects?
I know these questions are somewhat off topic, but would like to learn a bit more about building and not just blindly following instructions. Thanks in advance!

---------- Post added at 03:59 PM ---------- Previous post was at 03:08 PM ----------

i didnt use ccache.... too many build errors for me...so to serranodsdd is the folder for device specific building so i just delete that...may it is on personal preferrences
Yes :)
And as k2wl said earlier ccache is kinda crap sometimes and is better if u disable it. So remove the last part from that command after u disable ccache :)
Add:
Code:
export CCACHE_DISABLE=1
to your ~/.bashrc
Guys, is there a simple way to explain what ccache is? Thanks!
 
Last edited:
  • Like
Reactions: umuturunc

k2wl

Senior Member
Apr 19, 2008
3,166
7,573
0
@csendre

1. How would I go about building a pure AOSP ROM? Would I just download AOSP sources and add the local manifests as with CM? If so, how can I find the location of these sources? Actually how do you look up links to any source even CM branches and device specific projects within? Could not find it with simple Google search.
you cant build aosp rom as you wanted it needs lots of patches to sources..we can build cm or other cm based roms easily because cm team has added compatibility and fixes for our devices..
AOSP tree needs lots of work.....there is always a manifest repo on github for specific rom like github.com/cyanogenmod/android for cm, the manifest repo may be named platform_manifests or manifest or name of the rom like pacman etc

if you want aosp then follow these instuctions
https://source.android.com/source/downloading.html

2. How would I build an updated version of a CM13 ROM for another device? The original author has his sources posted on github, but how can I build a local manifest from this? To be more specific, here is the thread to this build.
Is it listed somewhere which CM projects belong to a specific device? For example if I never saw your manifest, how would I know that for the 9192 I needed the msm8930 and other projects?
I know these questions are somewhat off topic, but would like to learn a bit more about building and not just blindly following instructions. Thanks in advance!
there is almost always *.dependencies file in the source and also you can look into device.mk and boardconfig.mk of source to see which boardconfig mk and other mk files it is importing from other projects .
with this you can make your own local manifests file.
https://wiki.cyanogenmod.org/w/Doc:_Using_manifests

now look into the source you posted above
https://github.com/lirokoa/android_device_samsung_n8013/blob/cm-13.0/cm.dependencies
this file has all the components for making of local manifests
 
Last edited:

csendre

Senior Member
Aug 30, 2013
2,244
4,795
203
Burlington
@k2wl Thank you!, hopefully I'll get better at these things one day.

Btw, successfully built my first CM13 build, clean flashed it to my phone and all seems to be working well. One difference I noticed though compared to your builds, is that when the setup is complete, I am not asked about how to setup the SD card (adoptive vs. external storage) Could this be a build issue or do you think it is a change by the CM team? I did notice lots of warnings during the build related to version conflicts with specifications in the AndroidManifest.xml I believe. The text disappeared too quickly to read it. Do you think this was a problem?

Also, I am building CM12.1 now, this is what I used in the local manifest. Please check if all is OK:
Code:
 <project name="CyanogenMod/android_device_samsung_msm8930-common" path="device/samsung/msm8930-common" remote="github" revision="cm-12.1" />
  <project name="CyanogenMod/android_device_samsung_serrano-common" path="device/samsung/serrano-common" remote="github" revision="cm-12.1" />
  <project name="CyanogenMod/android_device_samsung_serrano3gxx" path="device/samsung/serrano3gxx" remote="github" revision="cm-12.1" />
  <project name="CyanogenMod/android_kernel_samsung_msm8930-common" path="kernel/samsung/msm8930-common" remote="github" revision="cm-12.1" />
  <project name="k2wl/android_device_samsung_serranodsdd" path="device/samsung/serranodsdd"  remote="github" revision="cm-12.1" />
  <project name="CyanogenMod/android_device_qcom_common" path="device/qcom/common" remote="github" revision="cm-12.1" />
  <project name="CyanogenMod/android_device_samsung_qcom-common" path="device/samsung/qcom-common" remote="github" revision="cm-12.1" />
  <project name="CyanogenMod/android_hardware_samsung" path="hardware/samsung" remote="github" revision="cm-12.1" />
  <project name="CyanogenMod/android_hardware_qcom_fm" path="hardware/qcom/fm" remote="github" revision="cm-12.1" />
  <project name="TheMuppets/proprietary_vendor_samsung" path="vendor/samsung" remote="github" revision="cm-12.1" />
I did not use the remove-project lines because for some reason sync repo command exits every time with a fatal error when a project is already removed from sources. I am running it with the -f option but doesn't help
 
Last edited: