• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Root Building CM12: Work in Progress. Join In!

elisam98

Well-Known Member
Dec 11, 2014
107
136
NYC, NY
As I detailed in this thread: DeCAF Cyanogenmod 11, Alpha 3(working cell service/semi working data), I am trying hard to build Cyanogenmod 12 for the LG Volt based on LG's newly released ZV5 kernel sources. In deference to what @whoshotjr2006 and others are trying to accomplish with CM11 in that thread, I thought it would be appropriate to start a new separate thread dedicated to building CM12.
I have learned some more about building CM, so I will post detailed (but hopefully better than last time) instructions for setting up a build environment and getting the compile started on your system.


UPDATE (1/21/2015): Still a pre-alpha build, but with some progress.

Here is where we're at so far:

  • Thanks to @Bad_MOFO_33, I reverted the build tree back to the old way of doing things (pre-CM12). This allows recovery to flash the /system partition properly (as far as I can see)
  • adb now has a chance to load before the device gets stuck at the splash screen. This means we can now get logcats of boot errors. :)
  • However, the phone is still not booting - I have posted the latest logcat in my last post.

If there is a problem with my instructions, please reply to the thread with any comments!
As you build, if you have ANY build errors, please post them in the reply field. If we work together, we can try to get this configuration to finally build!

You do not need any fancy hardware configuration to build cyanogenmod, but the better your system specs, the faster it will build.

This thread is dedicated to building this configuration, so please keep the comments limited to the above parameters.


------------------------------------------------------------------------------------------

Now for the instructions! Here goes:

Start with a clean install of Debian or Ubuntu (I used Ubuntu 14.10 - you can use any fairly recent version)
To update to the latest sources, run:
Code:
sudo apt-get update
To make sure you don't have any other JDK installed, run:
Code:
sudo apt-get purge openjdk-\* icedtea-\* icedtea6-\*
Then install the latest version of OpenJDK:
Code:
sudo apt-get install openjdk-7-jdk
Install the build dependencies:
Code:
sudo apt-get install git gnupg ccache lzop flex bison gperf build-essential zip curl zlib1g-dev zlib1g-dev:i386 libc6-dev lib32bz2-1.0 lib32ncurses5-dev x11proto-core-dev libx11-dev:i386 libreadline6-dev:i386 lib32z1-dev libgl1-mesa-glx:i386 libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown libxml2-utils xsltproc libreadline6-dev lib32readline-gplv2-dev libncurses5-dev bzip2 libbz2-dev libbz2-1.0 libghc-bzlib-dev lib32bz2-dev squashfs-tools pngcrush schedtool dpkg-dev
.

To get the source, first download "repo" and put it in the system path:
Code:
mkdir ~/bin
PATH=~/bin:$PATH
cd ~/bin
curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo

Now we're ready to pull the source. This may take a while to complete depending on your connection speed:
Code:
mkdir ~/cm12
cd ~/cm12
repo init -u git://github.com/CyanogenMod/android.git -b cm-12.0
repo sync

Make a new local manifest file:
Code:
mkdir .repo/local_manifests
cd .repo/local_manifests
gedit local_manifest.xml

Here is where we combine the LG Volt code with the already downloaded cyanogenmod sources:
In the text editor, add these lines:
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<!-- CM removals -->
<remove-project name="CyanogenMod/android_frameworks_av" />
<project name="CyanogenMod/android_hardware_qcom_fm" path="hardware/qcom/fm" remote="github" />
<project name="CyanogenMod/android_hardware_qcom_display-caf-new" path="hardware/qcom/display-caf-new" remote="github" revision="cm-11.0" />
<project name="CyanogenMod/android_hardware_qcom_media-caf-new" path="hardware/qcom/media-caf-new" remote="github" revision="cm-11.0" />
<project name="CyanogenMod/android_device_qcom_common" path="device/qcom/common" remote="github" />
<project name="touchpro/android_device_lge_x5" path="device/lge/x5" remote="github" revision="cm11-caf"/>
<project name="elisam98/android_kernel_lge_x5" path="kernel/lge/x5" remote="github" revision="master" />
<project name="Quarx2k/android_kernel_lge_msm8226" path="kernel/lge/msm8226" />
<project name="Quarx2k/android_frameworks_av" path="frameworks/av" />
<project name="touchpro/android_vendor_lge_x5" path="vendor/lge/x5" revision="master" />
</manifest>

Then resync the repos to grab the new source code:
Code:
cd ~/cm12
repo sync

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

Now send the command to build:
Code:
brunch x5

The code will now begin to compile.

------------------------------------------------------------------------------------------
Thank you everyone who contributed and continues to contribute to porting Cyanogenmod to the LG Volt!
@whoshotjr2006, @Bad_MOFO_33, @bakerd62, @adamhos1234, @Sands207, @AnDroiDHackxr, @Corey Fields, and everyone else in these forums (sorry if I missed anyone)

BIG thanks to the guys in the ##LG_VOLT channel on freenode!!!
(especially @Zef_MOFO)

Sources:
  1. http://androidforums.com/threads/de...working-cell-service-semi-working-data.886984
  2. https://source.android.com/source/initializing.html
  3. http://developer.sonymobile.com/kno...ld-aosp-lollipop-for-unlocked-xperia-devices/
  4. http://forum.xda-developers.com/nexus-4/general/guide-cm11-how-to-build-cyanogenmod-11-t2515305
 
Last edited:
Following the above directions, I encountered my first build error:
Code:
***
*** Can't find default configuration "arch/arm/configs/x5_spr_us_defconfig"!
***
/home/elisam98/cm12/kernel/lge/msm8226/scripts/kconfig/Makefile:96: recipe for target 'x5_spr_us_defconfig' failed
make[3]: *** [x5_spr_us_defconfig] Error 1
/home/elisam98/cm12/kernel/lge/msm8226/Makefile:496: recipe for target 'x5_spr_us_defconfig' failed
make[2]: *** [x5_spr_us_defconfig] Error 2
Makefile:130: recipe for target 'sub-make' failed
make[1]: *** [sub-make] Error 2
make[1]: Leaving directory '/home/elisam98/cm12/kernel/lge/msm8226'
build/core/tasks/kernel.mk:162: recipe for target '/home/elisam98/cm12/out/target/product/x5/obj/KERNEL_OBJ/.config' failed
make: *** [/home/elisam98/cm12/out/target/product/x5/obj/KERNEL_OBJ/.config] Error 2
make: *** Waiting for unfinished jobs....
target thumb C++: libc_bionic <= bionic/libc/bionic/eventfd_read.cpp
# In case value of PACKAGES is empty.

This is due to the fact that in cm12/device/lge/x5/BoardConfig.mk, the variable "TARGET_KERNEL_SOURCE" is set to "kernel/lge/msm8226"

To fix this, open BoardConfig.mk in your favorite text editor and change the value to "kernel/lge/x5"
The full line should now look like this:
TARGET_KERNEL_SOURCE := kernel/lge/x5

Save the file and run
Code:
make clean
in the root directory (/cm12).

Then, start again!
Code:
. build/envsetup.sh
brunch x5

When you encounter the next build error (and you will :)), remember to post it here so everyone can try to contribute to solving it!
 
  • Like
Reactions: whoshotjr2006
Upvote 0
Following the above directions, I encountered my first build error:
Code:
***
*** Can't find default configuration "arch/arm/configs/x5_spr_us_defconfig"!
***
/home/elisam98/cm12/kernel/lge/msm8226/scripts/kconfig/Makefile:96: recipe for target 'x5_spr_us_defconfig' failed
make[3]: *** [x5_spr_us_defconfig] Error 1
/home/elisam98/cm12/kernel/lge/msm8226/Makefile:496: recipe for target 'x5_spr_us_defconfig' failed
make[2]: *** [x5_spr_us_defconfig] Error 2
Makefile:130: recipe for target 'sub-make' failed
make[1]: *** [sub-make] Error 2
make[1]: Leaving directory '/home/elisam98/cm12/kernel/lge/msm8226'
build/core/tasks/kernel.mk:162: recipe for target '/home/elisam98/cm12/out/target/product/x5/obj/KERNEL_OBJ/.config' failed
make: *** [/home/elisam98/cm12/out/target/product/x5/obj/KERNEL_OBJ/.config] Error 2
make: *** Waiting for unfinished jobs....
target thumb C++: libc_bionic <= bionic/libc/bionic/eventfd_read.cpp
# In case value of PACKAGES is empty.

This is due to the fact that in cm12/device/lge/x5/BoardConfig.mk, the variable "TARGET_KERNEL_SOURCE" is set to "kernel/lge/msm8226"

To fix this, open BoardConfig.mk in your favorite text editor and change the value to "kernel/lge/x5"
The full line should now look like this:

Save the file and run
Code:
make clean
in the root directory (/cm12).

Then, start again!
Code:
. build/envsetup.sh
brunch x5

When you encounter the next build error (and you will :)), remember to post it here so everyone can try to contribute to solving it!

If you have qcom display set to caf-new and media set to caf-new in boardconfig.Mk, comment out display with a #, and then change media from caf-new to just caf. We don't have much caf stuff in our stock kernel, audio and media will mostly build with caf though. Might have to comment media out to get an initial build.
 
  • Like
Reactions: elisam98
Upvote 0
If you have qcom display set to caf-new and media set to caf-new in boardconfig.Mk, comment out display with a #, and then change media from caf-new to just caf. We don't have much caf stuff in our stock kernel, audio and media will mostly build with caf though. Might have to comment media out to get an initial build.
Thanks, @whoshotjr2006!
I followed your instructions by changing these values in the file: "device/lge/x5/BoardConfig.mk"
I changed
TARGET_QCOM_DISPLAY_VARIANT := caf-new
to
#TARGET_QCOM_DISPLAY_VARIANT := caf-new

and I changed
TARGET_QCOM_MEDIA_VARIANT := caf-new
to
TARGET_QCOM_MEDIA_VARIANT := caf

I'm still getting the errors I was getting before the change:
Code:
In file included from hardware/qcom/display-caf/msm8226/libhwcomposer/hwc_utils.h:32:0,
                 from hardware/qcom/display-caf/msm8226/libqdutils/cb_utils.h:33,
                 from hardware/qcom/display-caf/msm8226/libqdutils/cb_utils.cpp:28:
hardware/qcom/display-caf/msm8226/liboverlay/overlayUtils.h:274:30: error: 'MDP_SMP_FORCE_ALLOC' was not declared in this scope
     OV_MDP_SMP_FORCE_ALLOC = MDP_SMP_FORCE_ALLOC,
                              ^
make: *** [/home/elisam98/cm12/out/target/product/x5/obj/SHARED_LIBRARIES/libqdutils_intermediates/cb_utils.o] Error 1
make: *** Waiting for unfinished jobs....

-------------------------------------------------------------

I'm going to comment out that line (274) in overlayUtils.h and recompile.
If anyone has any other ideas, let me know! :)

Also, does it make sense that it's still compiling from the hardware/qcom/display-caf folder even though I commented out the CAF display value?
 
Last edited:
Upvote 0
OK, Commented out line 274 in overlayUtils.h and recompiled and surprise! new errors! :)
Code:
hardware/qcom/display-caf/msm8226/libgralloc/ionalloc.cpp: In member function 'virtual int gralloc::IonAlloc::clean_buffer(void*, size_t, int, int, int)':
hardware/qcom/display-caf/msm8226/libgralloc/ionalloc.cpp:180:5: error: 'ion_user_handle_t' was not declared in this scope
     ion_user_handle_t handle;
     ^
hardware/qcom/display-caf/msm8226/libgralloc/ionalloc.cpp:180:23: error: expected ';' before 'handle'
     ion_user_handle_t handle;
                       ^
make: *** [/home/elisam98/cm12/out/target/product/x5/obj/SHARED_LIBRARIES/libmemalloc_intermediates/ionalloc.o] Error 1
make: *** Waiting for unfinished jobs....

and, later on (even though I thought "make" was exiting?!)
Code:
In file included from hardware/qcom/display-caf/msm8226/liboverlay/overlayRotator.h:35:0,
                 from hardware/qcom/display-caf/msm8226/libhwcomposer/hwc.cpp:30:
hardware/qcom/display-caf/msm8226/liboverlay/mdpWrapper.h:69:36: error: 'mdp_overlay_list' has not been declared
bool validateAndSet(const int& fd, mdp_overlay_list& list);
                                    ^
hardware/qcom/display-caf/msm8226/liboverlay/mdpWrapper.h:175:43: error: 'mdp_overlay_list' has not been declared
inline bool validateAndSet(const int& fd, mdp_overlay_list& list) {
                                           ^
hardware/qcom/display-caf/msm8226/liboverlay/mdpWrapper.h: In function 'bool overlay::mdp_wrapper::validateAndSet(const int&, int&)':
hardware/qcom/display-caf/msm8226/liboverlay/mdpWrapper.h:176:19: error: 'MSMFB_OVERLAY_PREPARE' was not declared in this scope
     if (ioctl(fd, MSMFB_OVERLAY_PREPARE, &list) < 0) {
                   ^
In file included from hardware/qcom/display-caf/msm8226/libhwcomposer/hwc.cpp:42:0:
hardware/qcom/display-caf/msm8226/libhwcomposer/hwc_virtual.h: At global scope:
hardware/qcom/display-caf/msm8226/libhwcomposer/hwc_virtual.h:89:18: warning: unused parameter 'ctx' [-Wunused-parameter]
     virtual void init(hwc_context_t *ctx) {};
                  ^
hardware/qcom/display-caf/msm8226/libhwcomposer/hwc.cpp:710:5: warning: unused parameter 'config' [-Wunused-parameter]
int hwc_getDisplayAttributes(struct hwc_composer_device_1* dev, int disp,
     ^
make: *** [/home/elisam98/cm12/out/target/product/x5/obj/SHARED_LIBRARIES/hwcomposer.msm8226_intermediates/hwc.o] Error 1
 
Last edited:
Upvote 0
i keep getting this error

Code:
hardware/qcom/display-caf/msm8226/libgralloc/ionalloc.cpp:163:5: warning: unused parameter 'offset' [-Wunused-parameter]
int IonAlloc::unmap_buffer(void *base, size_t size, int offset)
     ^
hardware/qcom/display-caf/msm8226/libgralloc/ionalloc.cpp: In member function 'virtual int gralloc::IonAlloc::clean_buffer(void*, size_t, int, int, int)':
hardware/qcom/display-caf/msm8226/libgralloc/ionalloc.cpp:180:5: error: 'ion_user_handle_t' was not declared in this scope
     ion_user_handle_t handle;
     ^
hardware/qcom/display-caf/msm8226/libgralloc/ionalloc.cpp:180:23: error: expected ';' before 'handle'
     ion_user_handle_t handle;
                       ^
make: *** [/home/allen/cm12/out/target/product/x5/obj/SHARED_LIBRARIES/libmemalloc_intermediates/ionalloc.o] Error 1
make: *** Waiting for unfinished jobs....

i think i had this same error on a previous build
 
Upvote 0
Upvote 0
Back to the old errors!
Code:
hardware/qcom/display-caf/msm8226/libgralloc/ionalloc.cpp:180:5: error: 'ion_user_handle_t' was not declared in this scope
     ion_user_handle_t handle;
     ^
hardware/qcom/display-caf/msm8226/libgralloc/ionalloc.cpp:180:23: error: expected ';' before 'handle'
     ion_user_handle_t handle;

I'm posting my current BoardConfig.mk:
http://pastebin.com/YmTBMGjq

If we can collaborate on the settings and try out different BoardConfig variations together, maybe we can get things moving along.
 
Upvote 0
Back to the old errors!
Code:
hardware/qcom/display-caf/msm8226/libgralloc/ionalloc.cpp:180:5: error: 'ion_user_handle_t' was not declared in this scope
     ion_user_handle_t handle;
     ^
hardware/qcom/display-caf/msm8226/libgralloc/ionalloc.cpp:180:23: error: expected ';' before 'handle'
     ion_user_handle_t handle;

I'm posting my current BoardConfig.mk:
http://pastebin.com/YmTBMGjq

If we can collaborate on the settings and try out different BoardConfig variations together, maybe we can get things moving along.


I'll do a fresh install of either Mint or Ubuntu 14.10 on my laptop and see if I can do anything to assist you on this, nice work :) I hope I can contribute some to help move this along as well.
 
Upvote 0
Switched to a new kernel from https://github.com/BigMajster/andro...tree/3c1bb87f50318fdd07d2125355961cab1dc33a33.
It includes a cm12 defconfig file.
I activated the CAF settings on my BoardConfig.
Here is the latest error message:
Code:
hardware/qcom/display-caf/msm8226/libhwcomposer/hwc_utils.cpp: In function 'void qhwc::setMdpFlags(hwc_layer_1_t*, overlay::utils::eMdpFlags&, int, int)':
hardware/qcom/display-caf/msm8226/libhwcomposer/hwc_utils.cpp:1398:17: error: 'OV_MDP_SMP_FORCE_ALLOC' is not a member of 'qhwc::ovutils'
                 ovutils::OV_MDP_SMP_FORCE_ALLOC);
                 ^
hardware/qcom/display-caf/msm8226/libhwcomposer/hwc_utils.cpp:1403:17: error: 'OV_MDP_SMP_FORCE_ALLOC' is not a member of 'qhwc::ovutils'
                 ovutils::OV_MDP_SMP_FORCE_ALLOC);
                 ^
make: *** [/home/elisam98/cm12/out/target/product/x5/obj/SHARED_LIBRARIES/hwcomposer.msm8226_intermediates/hwc_utils.o] Error 1

I will comment out lines 1397-1398:
ovutils::setMdpFlags(mdpFlags,
ovutils::OV_MDP_SMP_FORCE_ALLOC);
and lines 1403-1404:
ovutils::setMdpFlags(mdpFlags,
ovutils::OV_MDP_SMP_FORCE_ALLOC);

...and recompile

Whew, this is getting tedious! :)
 
  • Like
Reactions: Sands207
Upvote 0
Done, with new errors.
Code:
hardware/qcom/display-caf/msm8226/libhwcomposer/hwc_fbupdate.cpp: In member function 'bool qhwc::FBUpdateNonSplit::configure(hwc_context_t*, hwc_display_contents_1*, int)':
hardware/qcom/display-caf/msm8226/libhwcomposer/hwc_fbupdate.cpp:157:17: error: 'OV_MDP_SMP_FORCE_ALLOC' is not a member of 'qhwc::ovutils'
                 ovutils::OV_MDP_SMP_FORCE_ALLOC);
                 ^
hardware/qcom/display-caf/msm8226/libhwcomposer/hwc_fbupdate.cpp: In member function 'bool qhwc::FBUpdateSplit::configure(hwc_context_t*, hwc_display_contents_1*, int)':
hardware/qcom/display-caf/msm8226/libhwcomposer/hwc_fbupdate.cpp:305:17: error: 'OV_MDP_SMP_FORCE_ALLOC' is not a member of 'qhwc::ovutils'
                 ovutils::OV_MDP_SMP_FORCE_ALLOC);
                 ^
make: *** [/home/elisam98/cm12/out/target/product/x5/obj/SHARED_LIBRARIES/hwcomposer.msm8226_intermediates/hwc_fbupdate.o] Error 1
make: *** Waiting for unfinished jobs....

I'm definitely missing something. :p

Anyone know how to actually get "OV_MDP_SMP_FORCE_ALLOC" defined? I have zero C++ coding skills and google is turning up nothing!

Meanwhile, I'll continue hacking this to pieces and comment out these errors too...
 
  • Like
Reactions: Sands207
Upvote 0
I hope we're getting close! After a much longer build, I got a SELinux error:
Code:
device/lge/x5/sepolicy/app.te:2:ERROR 'unknown type media_app' at token ';' on line 11352:
allow media_app cache_backup_file:dir getattr;
#line 1 "device/lge/x5/sepolicy/app.te"
checkpolicy:  error(s) encountered while parsing configuration
make: *** [/home/elisam98/cm12/out/target/product/x5/obj/ETC/sepolicy.recovery_intermediates/sepolicy.recovery] Error 1
make: *** Waiting for unfinished jobs....

I commented out lines 1 and 2 in "device/lge/x5/sepolicy/app.te" and recompiling now...
 
  • Like
Reactions: Sands207
Upvote 0
More SELinux errors:
Code:
device/lge/x5/sepolicy/system.te:7:ERROR 'syntax error' at token 'qmux_socket' on line 11381:

qmux_socket(system)
checkpolicy:  error(s) encountered while parsing configuration
make: *** [/home/elisam98/cm12/out/target/product/x5/obj/ETC/sepolicy.recovery_intermediates/sepolicy.recovery] Error 1
make: *** Waiting for unfinished jobs....

Commenting app.te and system.te out of BoardConfig.mk.
EDIT: ditching entire SELinux include in BoardConfig

Rebuilding...
 
Last edited:
Upvote 0
Next error:
Code:
device/lge/x5/overlay/frameworks/base/core/res/res/values/config.xml:93: error: Resource at config_perf_profile_prop appears in overlay but not in the base package; use <add-resource> to add.

device/lge/x5/overlay/frameworks/base/core/res/res/values/config.xml:94: error: Resource at config_perf_profile_default_entry appears in overlay but not in the base package; use <add-resource> to add.

device/lge/x5/overlay/frameworks/base/core/res/res/values/config.xml:102: error: Resource at config_auto_provision_enable appears in overlay but not in the base package; use <add-resource> to add.

device/lge/x5/overlay/frameworks/base/core/res/res/values/config.xml:311: error: Resource at config_enableTorch appears in overlay but not in the base package; use <add-resource> to add.

device/lge/x5/overlay/frameworks/base/core/res/res/values/config.xml:322: error: Resource does not already exist in overlay at 'config_smartCoverWindowCoords'; use <add-resource> to add.

device/lge/x5/overlay/frameworks/base/core/res/res/values/config.xml:323: error: Resource at config_smartCoverWindowCoords appears in overlay but not in the base package; use <add-resource> to add.

device/lge/x5/overlay/frameworks/base/core/res/res/values/config.xml:324: error: Resource at config_smartCoverWindowCoords appears in overlay but not in the base package; use <add-resource> to add.

device/lge/x5/overlay/frameworks/base/core/res/res/values/config.xml:325: error: Resource at config_smartCoverWindowCoords appears in overlay but not in the base package; use <add-resource> to add.

device/lge/x5/overlay/frameworks/base/core/res/res/values/config.xml:326: error: Resource at config_smartCoverWindowCoords appears in overlay but not in the base package; use <add-resource> to add.

make: *** [/home/zusman/cm12/out/target/common/obj/APPS/framework-res_intermediates/package-export.apk] Error 1
make: *** Deleting file `/home/zusman/cm12/out/target/common/obj/APPS/framework-res_intermediates/package-export.apk'
make: *** Waiting for unfinished jobs....

I think this refers to features that don't exist in Cyanogenmod, but do exist in stock (e.g. SmartCover).
Commenting out these lines...

If anyone has any alternatives to me commenting out all of these errors, please reply with them. Thanks! :)
 
Upvote 0
Last edited:
Upvote 0
Last edited:
  • Like
Reactions: elisam98
Upvote 0
Well it's definitely still a work in progress! I soft bricked my phone! Recovering from backup now. Any ideas?

..? You posted before you tested? I'm all for testing and i don't mind having to redo my phone, but if you're going to post a test I would think you would at least make sure it boots first...

I haven't been able to download on my phone yet, when I try it just shows me the contents of the zip on drive and won't let me download... I am not familiar with drive so maybe I'm missing something but I will probably hold off on flashing until it boots...

Hope that didn't come off wrong and I truly do appreciate your efforts ... Thanks
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones