I want to run the service through Init. (Android 8.1, sepolicy=permissive)
The service executes the script file, and the script file is as follows.
tcc898x:/ # cat /system/bin/tcc_dxb_service
#!/system/bin/sh
echo ----------------
echo RICHGOLD.
echo ----------------
Service execution in init proceeds as follows.
tcc898x:/ # cat init.tcc898x.rc
(...)
on boot
(...)
start tcc_dxb_service
(...)
service tcc_dxb_service /system/bin/tcc_dxb_service
class main
user root
u:object_r:tcc_dxb_service_exec:s0
And to add domain, sepolicy file is added as below.
# cat (Android 8.1 SDK)/device/(vendor)/(product)/sepolicy/tcc_dxb_service.te
type tcc_dxb_service, domain;
type tcc_dxb_service_exec, exec_type, system_file_type, file_type;
init_daemon_domain(tcc_dxb_service)
When the tcc_dxb_service service is executed, the following output is displayed.
tcc898x:/ # start tcc_dxb_service
init: could not get context while starting 'tcc_dxb_service'
Please tell me how to register the domain in Sepolicy to run the service.
Thanks.
You have to
seclabelto the seclabel of your service definition,object_rtor, andtcc_dxb_servicetype instead oftcc_dxb_service_exec.