Skip to content Skip to sidebar Skip to footer

Copy A Shell Script To Android Out Folder And Execute It During Boot

I have a shell script which I need to copy to anywhere in out folder during Android build process so that it appears somewhere in Android RootFS. Now, once it is copied after Andro

Solution 1:

Well, I created a root folder in AOSP or anywhere, then created Android.mk and copied the script to be copied to out folder. Added below comments in Android.mk

$(shell cp -rf $(LOCAL_PATH)/myscript.sh `pwd`/$(TARGET_OUT)/path/to/folder/)

Now to make it run during Android boot, I added below code in last of init.goldfish.rc:

service myscript_start /system/bin/busybox ash /system/path/to/folder/myscript.sh
    class main
    oneshot

Also, I added below line under # start essential services section of init.goldfish.rc

start myscript_start

That way my script was copied to desired location of out folder and also got called during android boot time.

I wonder if there is any better way to do that. I would like to know if anyone has suggestions.

Post a Comment for "Copy A Shell Script To Android Out Folder And Execute It During Boot"