复制一个shell脚本到Android出来的文件夹,并在启动时执行它 [英] Copy a shell script to android out folder and execute it during boot
问题描述
我有一个shell脚本,我需要在Android编译过程中复制到文件夹出的任何地方,以便它在Android的根文件系统的某处出现。
现在,一旦Android的构建过程后复制,成为Android的根文件系统的一部分,我想在启动时执行shell脚本。
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 Android build process and becomes part of Android RootFS, I want to execute the shell script during boot time.
我该怎么办呢?
推荐答案
好吧,我创建了AOSP或任何,然后创建Android.mk根文件夹,并复制到被复制到文件夹出的脚本。添加下面的评论中Android.mk
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/)
现在,使它的Android启动过程中运行,我在下面加code去年init.goldfish.rc的:
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
另外,我在下面加线下#启动基本服务init.goldfish.rc第
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.
这篇关于复制一个shell脚本到Android出来的文件夹,并在启动时执行它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!