我想在这个过程中启动一个自定义程序init。我静态编译了这个程序,它从我启动的 android 库存 ROM 中运行良好。
从 androidinit.rc文档中我读到该exec命令是我需要的。
顺便说一句,我只能看到dmesg我的程序退出代码-1(我无法返回)。
init.rc片段:
on post-fs-data
write /dev/kmsg "launching test"
exec /data/test
我看到的dmesg是这样的:
<4>[ 6.336816] launching test
<6>[ 6.336902] init: command 'write' r=0
<6>[ 6.337115] init: command 'exec' r=-1
这是可执行的源代码: http: //pastebin.com/Hym1APWx
更新
我试图静态编译并运行这个程序:
int main(){return 0; }
但结果总是command 'exec' r=-1。也许用户uselen是对的,也许我无法/data在早期启动阶段运行可执行文件。