init.rc and daemon starting

2,759 views
Skip to first unread message

Ian Key

unread,
Mar 20, 2012, 10:15:33 AM3/20/12
to android...@googlegroups.com
Hi, 

I'm trying to inlcude a file that starts off several services when Android ICS boots up. I've modified the init.rc script and added :
chmod 0777 /system/etc/my.daemon.rc
# runs our daemons
service my-daemons /system/etc/my.daemon.rc
    user root
    group root system radio
    oneshot


file /system/etc/my.daemon.rc contains :
service modem-daemon system/bin/modem-daemon
    socket connectionServer.sock stream 660 root system
    user root
    group root radio system
    disabled

I believe this should work (from what I've managed to find on the web), but the daemon just isn't started, neither is the socket created in /dev/socket.

The reason for this approach, is so we can release test software without having to continually patch the init.rc file for different releases, we can use a single file with daemons we want to run in it. Have I done something incorrectly?

Ian

Alvin Wong

unread,
Mar 21, 2012, 10:30:08 AM3/21/12
to android-porting
Hi,

No, you can't do that. There is another command to include another
init script. But usually we don't do that in init.rc (is it?).

If you are including custom commands, the best method is to use `/
init.PLATFORM.rc`, where PLATFORM is set via the kernel cmdline
`androidboot.hardware=PLATFORM`. It will automatically be loaded by
init.

Also you have the line `disabled` in the service, which states that
the servics shall not be started automatically. You should either add
`start modem-daemon` in one or more event triggers or remove the line.

To sum up with, your `init.PLATFORM.rc` COULD have the following (for
example):
~~~~~~
on boot
start modem-daemon

service modem-daemon /system/bin/modem-daemon
    socket connectionServer.sock stream 660 root system
    user root
    group root radio system
    disabled
~~~~~~

Regards,
Alvin Wong
Reply all
Reply to author
Forward
0 new messages