Trouble with Android init.rc process starting a service

已查看 129 次
跳至第一个未读帖子

Curt Schwaderer

未读,
2021年8月3日 23:50:402021/8/3
收件人 Android Building
We've built an AOSP build for our platform and the last step is to get our service stack (which is a C/C++ executable) started during the Android init process. For purposes of the explanation, I'll use "foo" as the device name.

The The device.mk file copies the service stack executables, libraries and scripts to /product/mfg under /bin, /lib/ and /scripts. 

The init.foo.rc file changes the permissions of the binaries, creates a /config directory under /product/mfg, and adds a symbolic link under the /lib directory under the "on boot" action.

When the board is started, the /product/mfg directory with all the expected modules there under /bin, /lib, and /scripts. But the permissions are not changed, no symbolic link was created, no /config directory was created, and the service didn't appear to be started.

If I change the init files to put the service stack in /data/mfg, the executables are there, permissions have been updated, the symbolic link created, and the config directory created. However, it doesn't look like the service was run.

The /data directory is system:system and the /product directory is root:root, so my guess is I need to do something about execution permissions, but I can't tell from the service options what needs to happen.

The service definition in my init.foo.rc file looks like this:

service vendor.mysvc /product/mfg/scripts/foo_start.sh
    class main
    user root
    group root
    console
    critical

1. Can I do something in the init file to log output to the screen as it runs the init script?
2. Do I have to set permissions somewhere to get it to work under /product instead of /data?
3. Is there a log somewhere that init generates so I can see if it tries to run the service at all?
4. I assume our custom service should live under and run within the /product directory. Is that correct or should it be put somewhere else?

Thanks for any help or pointers - I've read all the material on Android Init Language, but I'm not finding anything about how to make sure the init files and service permissions need to be set in order for things to work correctly under /product.

回复全部
回复作者
转发
0 个新帖子