androidandroid-serviceandroid-sourceandroid-build

How to modify AOSP to run a bash script on device boot?


How can AOSP be modified to run a bash script on device boot? Which directory should the script be placed in and what defines the order that the scripts are run? Would any permissions need to be added?


Solution

  • Step-1: Create a .sh file and put it under vendor/

    Step-2: Create Android.mk with block

    include $(CLEAR_VARS)
    LOCAL_MODULE       := script.sh
    LOCAL_MODULE_TAGS  := optional
    LOCAL_MODULE_CLASS := EXECUTABLES
    LOCAL_SRC_FILES    := $(LOCAL_MODULE)
    LOCAL_MODULE_PATH  := $(TARGET_OUT_VENDOR_EXECUTABLES)
    include $(BUILD_PREBUILT)
    

    Step-3: Put entry in root mk

    PRODUCT_PACKAGES += script.sh