【发布时间】:2019-04-03 01:12:31
【问题描述】:
按照this post 中给出的示例,我将这些行添加到/init.rc:
on property:dev.bootcomplete=1
start boot_handler
service boot_handler /system/bin/bc_handler.sh
class main
user root
group root
disabled
oneshot
还有这个/system/bin/bc_handler.sh:
#!/system/bin/sh
echo hi > /data/local/hi.txt
我正在为模拟器构建 Android 8.0。当系统启动时,我可以看到脚本没有运行,并且在日志中看到了这条消息:
[ 217.280853] init: service boot_handler does not have a SELinux domain defined
我尝试将我的服务更改为如下所示:
service boot_handler /system/bin/sh /system/bin/bc_handler.sh
class main
user root
group root
disabled
oneshot
seclabel u:r:shell:s0
现在错误是
init: Service 'boot_handler' (pid 1729) killed by signal 1
是否有关于如何在 SELinux 下向 Android 添加新服务的文档?或有关如何在 Android 上禁用 SELinux 的文档?我已经用谷歌搜索了几个小时,我发现的所有信息似乎都已经过时了。
【问题讨论】:
标签: android android-source selinux