# How to add 'things' (features, apps) to build?



## mbroeders

Hi all,
So far I've successfully created both clean AOSP builds as well as CM builds. So far so good. However, I would like to add features to my source. For instance, how do I add CMParts to the source so that it will be compiled? I've been searching for a couple of days now, but I just can't find the answer. Could somebody tell me (or point me in the right direction) how to add such a feature, and if possible, how to add certain commits? Thanks -very much- in advance!!
Mark

Okay, I somewhat figured out how to add apps: Put the source in packages/apps and add the app to /build/.../core.mk. However, I still get messages about deprecated API's when trying to compile CMParts. Anyone managed to build that package??


----------



## Nis

You shouldn't have to do anything like that. What device are you building for? For example, a build for the Droid 2 is done by running 'brunch droid2' at the root of the CM source (assuming you have all the proprietary files pulled from the phone).


----------



## KeithN

It sounds like he is trying to add an app to a build he was already able to compile. So brunch already worked for him.


----------



## JBirdVegas

ok lets imagine you have an app call 'My Awesome App' with the package name 'MyAwesomeApp'. I place my app in packages/apps/MyAwesomeApp the compiler will see it and build the app but it won't get included in your ROM.

now lets say I'm building for the droid2 so in device/motorola/droid2/droid2.mk we need to tell the build system to include our app in the build



Code:


<br />
# Include My Awesome App by its package name<br />
PRODUCT_PACKAGES += \<br />
	MyAwesomeApp \<br />

I'll warn you though if you are planning on just dumping in CMParts into an aosp build it won't build or run as that app requires extensive frameworks support that simply doesn't exist in the aosp frameworks.


----------



## mbroeders

Thanks guys. Maybe I didn't make myself clear:

I compiled CM9 from source. But in CM7 there was a separate menu setting named "CM settings". As I understand, this is the CMParts.apk. When I compare a CM9 kang from Euroskank (Fitsnugly) with my own kang, my kang is missing the CM settings (or CMParts.apk). So I wondered how they managed to include that package. (although coincidentally yesterday I read a Google+ post from CM saying they were going to change the CM settings, so maybe the CMParts isn't necessary anymore. still confused though how Euroskank did it)

Another issue is this: I'm building for the Galaxy Nexus. One problem is that even after adding the proprietary drivers from the 'building for device' page, there are still a couple of libs missing in the /system/vendor/firmware/ folder. I pulled these libs from a 4.0.2 build and manually add those after a build. Is it possible to place them somewhere so that they are automatically added to the build?

Thanks! Appreciate your help.


----------



## doug piston

Add the libs to your propietary folder and modify the device-blobs.mk to include them. I'm not at that PC otherwise I'd show you, I will this evening if JBirdVegas has not already.


----------



## JBirdVegas

doug piston said:


> Add the libs to your propietary folder and modify the device-blobs.mk to include them. I'm not at that PC otherwise I'd show you, I will this evening if JBirdVegas has not already.


I can write up an example tomorrow I have in laws tonight.

@doug teaching is the best way to learn ;-)


----------



## KeithN

I'll be looking forward to seeing this also. I'm pretty much in the same place.

Sent from my SCH-I500


----------



## doug piston

JBirdVegas said:


> I can write up an example tomorrow I have in laws tonight.
> 
> @doug teaching is the best way to learn ;-)


In-laws? /me shudders

Anyways you'll find the proprietary directory in your /vendor/manufacture/device name/


Code:


<br />
[email protected]:~/android/vendor/samsung/toro$ ls<br />
BoardConfigVendor.mk  device-vendor-blobs.mk  device-vendor.mk  proprietary<br />

You will see the device-vendor-blobs.mk says "DO NOT EDIT" but I have done so on my Thunderbolt builds and have had zero issues. I have also considered modifying the extract-files.sh to include all needed libs but I am a lazy fella.

Move the libs to the proprietary directory. Once you're finished open device-vendor-blobs.mk with your favorite text editor and add the files using the same structure.

To follow JbirdVegas's example lets say you have lib named Awesome.so put it in proprietary and then add it to the device-vendor-blobs.mk


Code:


<br />
vendor/samsung/toro/proprietary/Awesome.so:system/vendor/lib/Awesome.so \<br />

Notice the first part of code is where the .so resides in your build environment and the second is where you would like it installed.

Side note, the "\" is only if you do not place your code as the last line.


----------



## mbroeders

Guys, thanks for all the help!! I've been too busy the past few days to look into this, but I will try later today. Thanks for the advice!


----------



## mbroeders

Mmm, strange enough they were already in the .mk file and they already had been extracted using extract-files.sh. Somehow they don't get copied to the final build. Strange, because the rom compiles just fine.


----------



## JBirdVegas

Check in the vendor blobs for commented out lines


----------



## mbroeders

JBirdVegas said:


> Check in the vendor blobs for commented out lines


The device-vendor-blobs.mk file looks fine:



Code:


<br />
# All the blobs necessary for maguro<br />
PRODUCT_COPY_FILES += \<br />
    vendor/samsung/maguro/proprietary/fRom:system/bin/fRom \<br />
    vendor/samsung/maguro/proprietary/libsecril-client.so:system/lib/libsecril-client.so \<br />
    vendor/samsung/maguro/proprietary/pvrsrvinit:system/vendor/bin/pvrsrvinit \<br />
    vendor/samsung/maguro/proprietary/sirfgps.conf:system/vendor/etc/sirfgps.conf \<br />
    vendor/samsung/maguro/proprietary/bcm4330.hcd:system/vendor/firmware/bcm4330.hcd \<br />
    vendor/samsung/maguro/proprietary/ducati-m3.bin:system/vendor/firmware/ducati-m3.bin \<br />
    vendor/samsung/maguro/proprietary/libpn544_fw.so:system/vendor/firmware/libpn544_fw.so \<br />
    vendor/samsung/maguro/proprietary/libEGL_POWERVR_SGX540_120.so:system/vendor/lib/egl/libEGL_POWERVR_SGX540_120.so \<br />
    vendor/samsung/maguro/proprietary/libGLESv1_CM_POWERVR_SGX540_120.so:system/vendor/lib/egl/libGLESv1_CM_POWERVR_SGX540_120.so \<br />
   ...<br />
    vendor/samsung/maguro/proprietary/libusc.so:system/vendor/lib/libusc.so<br />

Anyway, I inserted the same lines of code in the device/samsung/maguro/full-maguro.mk file and now it works fine, the correct libs are all there in the final build. Thanks for your help!


----------

