I want to start a custom program in the init
process. I compiled this program statically that run fine from my booted up android stock ROM.
From the android init.rc
docs I read that the exec
command is what I need.
BTW all I can see in dmesg
is that my program exit with code -1
(I can't return that).
init.rc
snippet:
on post-fs-data
write /dev/kmsg "launching test"
exec /data/test
All I see in dmesg
is this:
<4>[ 6.336816] launching test
<6>[ 6.336902] init: command 'write' r=0
<6>[ 6.337115] init: command 'exec' r=-1
Here you are the executable source code: http://pastebin.com/Hym1APWx
UPDATE
I tried to statically compile and run this program:
int main(){return 0; }
But the result is always command 'exec' r=-1
. Maybe user uselen are right, maybe I cannot run executables from /data
in the early-boot phase.