Android System Module does not generate output on build

578 Views Asked by At

I am experiencing a problem while building android source code(Nougat). I have a system module named poweroffhandler, written in C++ and has Android.mk file as follow.

LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)

LOCAL_SRC_FILES:= \
    #src_files

LOCAL_SHARED_LIBRARIES := \
    #libraries

LOCAL_MODULE:= poweroffhandler

include $(BUILD_EXECUTABLE)  

When i add the file $(error error_message) it crashes(with error message "error_message") and stops the whole build.(So the module is included the building sequence) But it does not produce any output after build sequence.

I've tried creating a .rc file associated with it as follows.

Added Android.mk file ->

LOCAL_INIT_RC := PowerOffHandler.rc

Created a new file named PowerOffHandler.rc

service poweroffhandler /system/bin/poweroffhandler
    class core
    user graphics
    group graphics audio
    disabled
    oneshot

When i create an .rc file it does produce an output at intermediates folder but not in the system/bin folder.

And the weird part is i can build module with saying from project root: make poweroffhandler. Then i have no problem at all, problem is i can't use build all scripts for this module(so i can't proceed autonomous integration).

Any help will be appreciated, thank you

1

There are 1 best solutions below

0
On BEST ANSWER

I found the answer, when you write a system module:

  • You need to register your Android.mk (for example by saying include $(call all-subdir-makefiles) at top level folder)
  • You need to register your module (specified by LOCAL_MODULE:= poweroffhandler) to {root}/build/target/product/embedded.mk by saying PRODUCT_PACKAGES += poweroffhandler