So I'm working on some lock screen stuff in frameworks/base/policy/src/com/android/internal/policy/impl/ for CyanogenMod 9, and I was wondering how I would go about compiling it? Would I just run something like `make -j4 impl`, like I would for something like SystemUI? Then how would I go about applying it to my device?
Sorry for the noob question, but thanks for the help!
Chiggins said:
So I'm working on some lock screen stuff in frameworks/base/policy/src/com/android/internal/policy/impl/ for CyanogenMod 9, and I was wondering how I would go about compiling it? Would I just run something like `make -j4 impl`, like I would for something like SystemUI? Then how would I go about applying it to my device?
Sorry for the noob question, but thanks for the help!
Click to expand...
Click to collapse
If you look here:
https://github.com/CyanogenMod/android_frameworks_base/tree/gingerbread/policy
You will see Android.mk
Code:
LOCAL_PATH:= $(call my-dir)
# the library
# ============================================================
include $(CLEAR_VARS)
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_MODULE := android.policy
include $(BUILD_JAVA_LIBRARY)
# additionally, build unit tests in a separate .apk
include $(call all-makefiles-under,$(LOCAL_PATH))
The local module you will need to call this is "android.policy"
It will build what it needs to. When it finishes compiling you will see a list of "Install:" Push those to your phone.
Code:
make -j$ android.policy
So to my understanding, if something that I'm working on has an Android.mk by it, I could build JUST that thing using the name defined by LOCAL_MODULE, right?
Chiggins said:
So to my understanding, if something that I'm working on has an Android.mk by it, I could build JUST that thing using the name defined by LOCAL_MODULE, right?
Click to expand...
Click to collapse
Yup just about. There might be issues at some point... but I have never had issues testing bits like this.
Alright sweet deal, thanks mate!
Related
Hi everyone,
I'm currently trying to compile Android 2.2.1 for my HTC Desire. My question is simple : how do i add Superuser and su to my build ? I managed to add Superuser but su isn't included... my android/system/extras/su/Makefile looks like that :
Code:
ifeq ($(BUILD_ORIGINAL_SU),true)
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES:= su.c su.c activity.cpp
LOCAL_C_INCLUDES += external/sqlite/dist
LOCAL_SHARED_LIBRARIES := liblog libsqlite libandroid_runtime
LOCAL_MODULE:= su
LOCAL_FORCE_STATIC_EXECUTABLE := true
LOCAL_STATIC_LIBRARIES := libc
LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES)
LOCAL_MODULE_TAGS := debug
include $(BUILD_EXECUTABLE)
endif
I took the code from Cyanogenmod.. but it doesn't work ...
Thanks in advance for your help,
Renan.
su.c didn't produce any output? Was there an error in the build?
You could probably fake it by just copying sh to su and giving it SIUD (root:root 4755) permissions
Thanks for your reply.
I tried to compile with different Makefiles (stock, modified, cyanogenmod one) and different files (su.c or su.c, su.h and activity.cpp) but there's no output :/ I don't see su in /system/bin or in /system/xbin... And when I load my ROM on my phone, Superuser doesn't work because there isn't su. I tried to flash superuser.zip but there's an issue with the symbolic link I think.
I found a guide who explaned how to root aosp for motorola sholes but this method (the one I used) doesn't work for me..
It it's just a matter of the su executable, one from any android build would probably work. The command line tools are all ELF ARM-NONE-EABI.
It doesn't work at all...
If I remove su (chainsdd's android_system_extras) and add the binary, then create symlinks, it doesn't work.
su causes an issue when I'm building source:
Code:
android/system/system/extras/su/su.c:149: undefined reference to `_mktemp'
But it's strange... when I build without it and then re-add the source, all is ok. But on the phone, I get a seg fault when I try to run su...
What's wrong ? :/
I'm also interested in this...
Look at the sources of my ROM : http://github.com/python08/android_system_extras.git
Look at su/Android.mk
You will understand the problem
Sent from my HTC Desire using XDA App
I dont know if it is too late to answer you~
Be aware of the following:
LOCAL_MODULE_TAGS := debug
It means this module is included ONLY when you are building an "eng" or "userdebug" version.
If you build your android with "user" this module will not be included.
Try change LOCAL_MODULE_TAGS to "optional".
Questions should be posted in Q&A forums, not Development forums.
http://forum.xda-developers.com/announcement.php?a=81
See rule #15
Thread moved.
I've been racking my brain about this for a while now (whenever I've had some spare time over the past week or so) and scouring the internets in search of an answer but either I'm not very good at searching, or there aren't very many people doing what I'm doing that do not already know the answer to my question.
Here's what I would like to do. I have completed a full build of AOKP for my device (GSII Skyrocket). If I were to make an edit to a system app package, Contacts in particular, how can I rebuild the package without redoing an entire build? I am aware of the "mmm" command, but if I run
Code:
$ mmm packages/apps/Contacts
$ make packages/apps/Contacts
$ make Contacts
or any derivation of that command, it defaults to building:
PLATFORM_VERSION=4.0.4
TARGET_PRODUCT=full
TARGET_BUILD_VARIANT=eng
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a
HOST_ARCH=x86
HOST_OS=linux
HOST_BUILD_TYPE=release
BUILD_ID=IMM76I
which then immediately craps out because it's building for a generic product which has no kernel source configured:
Code:
make: Entering directory `/home/m4570d0n/AOKP'
build/core/tasks/kernel.mk:53: **********************************************************
build/core/tasks/kernel.mk:54: * Kernel source found, but no configuration was defined *
build/core/tasks/kernel.mk:55: * Please add the TARGET_KERNEL_CONFIG variable to your *
build/core/tasks/kernel.mk:56: * AndroidBoard.mk file *
build/core/tasks/kernel.mk:57: **********************************************************
build/core/tasks/kernel.mk:58: *** "NO KERNEL CONFIG". Stop
make: Leaving directory `/home/m4570d0n/AOKP'
When I was building CM9 it would actually make a Contacts.apk in /out/target/product/generic, but even then it was mdpi, odexed, and pretty much garbage.
What I'm trying to figure out (and rather surprised that I haven't found more info on it yet), is what configuration changes do I have to make or flags that I have to set so that I can just rebuild Contacts in the same way it would get built if I were doing a full build for the skyrocket so that I can incorporate the changes I made to the Contacts package? (Obviously this question would apply for any device, I'm just using the Skyrocket as an example since that's the device for which I'm building.)
On a similar note, if I can get that first question resolved, can I just add:
Code:
LOCAL_AAPT_FLAGS := -c xhdpi -x 10
to my Android.mk for Contacts if I wanted to build contacts with xhdpi resources? Would that work?
this is probably the most useful info I've come across (in addition to the stuff on developer.android.com) but it seems like some of it is now outdated and I'm not sure if it addresses my particular question.
http://www.jokersax.com/dev-guides/android-building-faqs/
http://elinux.org/Android_aapt
Any help would be much appreciated.
Just type.
make Contacts
Sent from my Galaxy Nexus using xda premium
As I mentioned in my post, I have tried that.
m4570d0n said:
As I mentioned in my post, I have tried that.
Click to expand...
Click to collapse
Well that's how you build just one app.
Sent from my Galaxy Nexus using xda premium
lithid-cm said:
Well that's how you build just one app.
Sent from my Galaxy Nexus using xda premium
Click to expand...
Click to collapse
I am aware. That was not my question though. That command by itself will build one app by looking to build/target/product/full.mk which has:
$(call inherit-product, $(SRC_TARGET_DIR)/product/full_base_telephony.mk)
$(call inherit-product, $(SRC_TARGET_DIR)/board/generic/device.mk)
PRODUCT_NAME := full
PRODUCT_DEVICE := generic
PRODUCT_BRAND := Android
PRODUCT_MODEL := Full Android on Emulator
That's not going to work. What I'm trying to do is build it so that it looks to my device configuration which would be this:
$(call inherit-product, $(SRC_TARGET_DIR)/product/full_base_telephony.mk)
$(call inherit-product, device/samsung/skyrocket/device.mk)
PRODUCT_NAME := full_skyrocket
PRODUCT_DEVICE := skyrocket
PRODUCT_BRAND := samsung
PRODUCT_MANUFACTURER := samsung
PRODUCT_MODEL := SAMSUNG-SGH-I727
Then use lunch and select your device. Maybe I'm just not understanding why you are doing so strange.
Sent from my Galaxy Nexus using xda premium
I'm not trying to do an entire build though. That's exactly what I'm trying to avoid. I just want to rebuild one package based on my device configuration and current built sources in /out. I am not trying to make an app for a generic device/board to run on an emulator, which is what the "make Contacts" command will try to do by default.
m4570d0n said:
I'm not trying to do an entire build though. That's exactly what I'm trying to avoid. I just want to rebuild one package based on my device configuration and current built sources in /out. I am not trying to make an app for a generic device/board to run on an emulator, which is what the "make Contacts" command will try to do by default.
Click to expand...
Click to collapse
I do what you are all the time. For example. I make clean and clobber. Use lunch to load my device and build a specific app. I like my Mms with the holo dark theme and built just that. IRS possible you will come into errors while building though if that app needs other files compiled. If you are trying to make an app more "universal" do a port and build it in eclipse against the framework you need to.
Sent from my Galaxy Nexus using xda premium
oh wow. I'm retarded. I usually use brunch or use lunch aokp_skyrocket-userdebug && mka bacon 2> warn.log
or something like that. For some reason I was thinking that after I used lunch and selected my device it would automatically start doing an entire build. That worked though. Thank you!
Now, I had that LOCAL_AAPT_FLAG in the Android.mk for Contacts, but it still built the apk with hdpi resources. How might I be able to flag it to use xhdpi instead? The reason I ask is that I know that this build will work on the Galaxy Note even with the hdpi images, but would like to build a version with xhdpi instead.
I am not sure I understand clearly, but how exactly did you manage to go past
Code:
build/core/tasks/kernel.mk:68: **********************************************************
build/core/tasks/kernel.mk:69: * Kernel source found, but no configuration was defined *
build/core/tasks/kernel.mk:70: * Please add the TARGET_KERNEL_CONFIG variable to your *
build/core/tasks/kernel.mk:71: * BoardConfig.mk file *
build/core/tasks/kernel.mk:72: **********************************************************
toxicthunder said:
I am not sure I understand clearly, but how exactly did you manage to go past
Code:
build/core/tasks/kernel.mk:68: **********************************************************
build/core/tasks/kernel.mk:69: * Kernel source found, but no configuration was defined *
build/core/tasks/kernel.mk:70: * Please add the TARGET_KERNEL_CONFIG variable to your *
build/core/tasks/kernel.mk:71: * BoardConfig.mk file *
build/core/tasks/kernel.mk:72: **********************************************************
Click to expand...
Click to collapse
Let's say I want to build Contacts.apk from CM10 for the Skyrocket. The commands would be:
Code:
. /build/envsetup.sh
lunch cm_skyrocket-userdebug
make Contacts
It will build Contacts.apk and put it in the /out/target/produce/skyrocket/system/app/ directory.
My confusion when I created this thread was that I thought the lunch [device] command would start the build like the brunch command does, but all it does is essentially load the build configuration for the device. The "mka bacon" command is what will start a full build. The lunch command is the same as the breakfast command, except you can select devices that are not officially supported. The brunch command is the equivalent of "breakfast [device] && mka bacon".
That said, I'm not sure if the squisher and opticharger scripts are run when you build just one package this way, but my guess is that they are not.
glad its all working out
So I decided to lean how to build AOKP from source. I referenced other developers Github's and multiple tutorials. I finally manged to create a good device and vendor tree and successfully build AOKP from source. All is good, or so I thought. When I attempted to perform my first CWM backup, I was prompted (at the end) with the error message "MD5 error". Looking into the recovery log shows that the script nandroid-md5.sh was not found.
So, I check my build output, "out/target/product/i777/recovery/root/sbin" and discover that the script is missing. Next I start to dig into the bootable/recovery project. I evaluate the Android.mk file and I find the following:
Code:
include $(CLEAR_VARS)
LOCAL_MODULE := nandroid-md5.sh
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/sbin
LOCAL_SRC_FILES := nandroid-md5.sh
include $(BUILD_PREBUILT)
So the make file should include the script in the build, but I can't figure out what is missing. I've done the following without success.
Rebuilt with an earlier version (6.0.1.5) of CWM recovery.
Evaluated other devices to see if I'm missing something in my device/vendor trees.
Checked AOKP & CM forums for anyone reporting similar issues.
Built a supported device i9100 and the same problem occurs.
Now, I've found a workaround, but it seems more like a hack. If I include the following line in one of my make files, then the file will get copied.
Code:
PRODUCT_COPY_FILES += \
bootable/recovery/nandroid-md5.sh:recovery/root/sbin/nandroid-md5.sh
I'm hoping that someone can help me understand why my build is having this problem.
Hey guys,
I'm trying to build a unofficial version of CM12.1, but it fails while building with following error:
Code:
build/core/package_internal.mk:351: *** target pattern contains no '%'. stop.
the corresponing line from package_interal:
Code:
[348] private_key := $(LOCAL_CERTIFICATE).pk8
[349] certificate := $(LOCAL_CERTIFICATE).x509.pem
[350]
[351] $(LOCAL_BUILT_MODULE): $(private_key) $(certificate) $(SIGNAPK_JAR)
[352] $(LOCAL_BUILT_MODULE): PRIVATE_PRIVATE_KEY := $(private_key)
[353] $(LOCAL_BUILT_MODULE): PRIVATE_CERTIFICATE := $(certificate)
If you need further information about device (i don't think that's revelant?) etc. just ask.
revide said:
Hey guys,
I'm trying to build a unofficial version of CM12.1, but it fails while building with following error:
Code:
build/core/package_internal.mk:351: *** target pattern contains no '%'. stop.
the corresponing line from package_interal:
Code:
[348] private_key := $(LOCAL_CERTIFICATE).pk8
[349] certificate := $(LOCAL_CERTIFICATE).x509.pem
[350]
[351] $(LOCAL_BUILT_MODULE): $(private_key) $(certificate) $(SIGNAPK_JAR)
[352] $(LOCAL_BUILT_MODULE): PRIVATE_PRIVATE_KEY := $(private_key)
[353] $(LOCAL_BUILT_MODULE): PRIVATE_CERTIFICATE := $(certificate)
If you need further information about device (i don't think that's revelant?) etc. just ask.
Click to expand...
Click to collapse
Sorry for this bump, but being on the fourth site without any replies kinda frustrates me..
cmon guys, halp
Okay, solved problem.
For all of you who experience the same issue, my proprietary-blob list got entries that were not real files. update yours and you should be good.
Note:
I noticed alot more people have been using MultiRom, So I decided to make a really simple basic How to guide for people who pretty much already know what they are doing.
Step #1, you need the omni source tree, I use Omni-lp5.1.1, But to use that, you will need to make some changes to your device tree, like g3-common and qcomm_common,
Only thing you will be doing to those to device tree sections, in g3-common you will remove the "liblight" directory. and in the qcomm_common Dir, you will remove The "power" Directory.
reason for that, because its already defined in hardware.. The above is only if you decide to use Omni LP trees.
If you use the Normal Omni KitKat 4.4.4, Then you dont have to remove anything.. should work right out of the box.
If using Omni 4.4.4, you can use your device from: https://github.com/TeamWin,
if your using Omni LP you can use your own device tree that works with LP..
Ok now for the code part:
open your BoardConfig.mk
and enter this at the bottom:
Code:
# Edited for TWRP Recovery
DEVICE_RESOLUTION := 1440x2560
RECOVERY_GRAPHICS_USE_LINELENGTH := true
TW_NO_USB_STORAGE := true
TW_INCLUDE_JB_CRYPTO := true
TW_INCLUDE_CRYPTO := true
BOARD_SUPPRESS_SECURE_ERASE := true
RECOVERY_SDCARD_ON_DATA := true
BOARD_HAS_NO_REAL_SDCARD := true
TW_BRIGHTNESS_PATH := "/sys/devices/mdp.0/qcom\x2cmdss_fb_primary.175/leds/lcd-backlight/brightness"
TW_MAX_BRIGHTNESS := 255
TW_SCREEN_BLANK_ON_BOOT := true
# TW_NO_SCREEN_TIMEOUT := false
# MultiROM
MR_INPUT_TYPE := type_b
MR_INIT_DEVICES := device/lge/d851/multirom/mr_init_devices.c
MR_RD_ADDR := 0x2200000
MR_DPI := xhdpi
MR_DPI_MUL := 1.5
MR_FSTAB := device/lge/d851/twrp.fstab
MR_KEXEC_MEM_MIN := 0x0ff00000
MR_KEXEC_DTB := true
MR_USE_MROM_FSTAB := true
MR_DPI_FONT := 420
MR_DEFAULT_BRIGHTNESS := 80
#MR_CONTINUOUS_FB_UPDATE := true
#MultiRom Hooks, So that we can run stock roms as secondary
MR_DEVICE_HOOKS := device/lge/d851/mr_hooks.c
MR_DEVICE_HOOKS_VER := 4
Of course change your device name and locations.
You will need to make changes to omni_(your device).mk (AKA cm_(your device).mk
and add this to it:
Code:
# Copy needed files to make everything work for recovery
PRODUCT_COPY_FILES += \
# device/lge/d851/kernel:kernel \
device/lge/d851/img_info:img_info \
device/lge/d851/postrecoveryboot.sh:recovery/root/sbin/postrecoveryboot.sh \
device/lge/d851/sign:recovery/root/res/sign
PRODUCT_COPY_FILES += device/lge/d851/fstab.g3:recovery/root/fstab.g3
PRODUCT_COPY_FILES += device/lge/d851/twrp.fstab:recovery/root/etc/twrp.fstab
PRODUCT_NAME := omni_d851
PRODUCT_DEVICE := d851
PRODUCT_BRAND := LG
PRODUCT_MODEL := G3
PRODUCT_MANUFACTURER := LG
Im not going to tell you how to get your own fstab. you should already know that.
You will need this for your hooks file: mr_hooks.c
I am sure you can see the location that it will go into, you can change it to meet your device spec.
Now read this for the rest of the way: https://github.com/Tasssadar/multirom/wiki/Porting-MultiROM
I already created a patch that works very well with the latest MultiRom: D851-CM_hardboot_kexec_kernel.patch
Yes the patch says D851, but its for the G3 kernel which all models use. And yes, it will work with CM based and stock based. If anything you will have to change the config file settings
to match the ones for your device config. This one is set for the d851_defconfig.. So just point it to your config when it asks.
Command to run patch from terminal: patch --verbose -p1 < patch/D851-CM_hardboot_kexec_kernel.patch
Yes when you copy it over, place it in its own dir called patch from your kernel tree.
or if you rather take an already patched kernel: 777Kernel-patched Branch "Testing"
Above kernel was patched by me with pemish from @777jon, I did remove his patch created by @Skin1980 since it didnt work well with todays MultiRom
and I added in mine.. I also made some changes to allow Sabermod 5.1 and 6.0 to compile it.
Ok this is it for me, I told you it was a quick guide for people that already know what they are doing. I am no good at teaching. I wrote this really quick so that others
can have the ability to get MultiRom running on their device (Developers)..
I will only answer questions from Developers that plan on porting to thier device and make it public.
any1 working on this?
I honestly forgot that I posted this. I do hope that some are working on this for their device.
I just dont have the time to port over to every single G3 family device......