没有合适的资源?快使用搜索试试~ 我知道了~
首页[Android][frameworks][HIDL]使用HIDL新建虚拟HAL以实现system_server与native进程双向通信(二)——踩坑篇
前言 在上一篇中,我们已经搭建好了服务端的代码结构,并且保证编译通过; 但是由于各种坑的存在,我们无法直接让服务端跑起来,因此本篇不是写客户端调用,而是一篇和编译规则定义、selinux规则添加等相关的踩坑总集,如果你已经保证服务端已经跑起来了,那么本篇可以跳过,等下一篇吧; 添加编译规则 在device///device.mk或等效的位置添加: PRODUCT_PACKAGES += \ vendor.zsui.hardware.example@1.0 \ vendor.zsui.hardware.example@1.0-service 然后全编译userdebug版本,
资源详情
资源评论
资源推荐
[Android][frameworks][HIDL]使用使用HIDL新建虚拟新建虚拟HAL以实现以实现
system_server与与native进程双向通信(二)进程双向通信(二)——踩坑篇踩坑篇
前言前言
在上一篇中,我们已经搭建好了服务端的代码结构,并且保证编译通过;
但是由于各种坑的存在,我们无法直接让服务端跑起来,因此本篇不是写客户端调用,而是一篇和编译规则定义、selinux规
则添加等相关的踩坑总集,如果你已经保证服务端已经跑起来了,那么本篇可以跳过,等下一篇吧;
添加编译规则添加编译规则
在device///device.mk或等效的位置添加:
PRODUCT_PACKAGES += \
vendor.zsui.hardware.example@1.0 \
vendor.zsui.hardware.example@1.0-service
然后全编译userdebug版本,刷机;
添加添加SELinux规则规则
开机以后会发现service并未启动,且报了如下权限拒绝:
01-29 19:27:59.819 0 0 E init : File /vendor/bin/hw/vendor.zsui.hardware.example@1.0-service(labeled "u:object_r:vendor_file:s0") has incorrect label or
no domain transition from u:r:init:s0 to another SELinux domain defined. Have you configured your service correctly?
https://source.android.com/security/selinux/device-policy#label_new_services_and_address_denials
01-29 19:27:59.819 0 0 I init : starting service 'example-hal-1-0'...
02-26 10:45:58.440 2978 2978 I auditd : type=1400 audit(0.0:127): avc: denied { execute } for comm="init" name="vendor.zsui.hardware.example@1.0-
service" dev="mmcblk0p48" ino=515 scontext=u:r:init:s0 tcontext=u:object_r:vendor_file:s0 tclass=file permissive=0
01-29 19:27:59.822 0 0 E init : cannot execve('/vendor/bin/hw/vendor.zsui.hardware.example@1.0-service'): Permission denied
02-26 10:45:58.440 2978 2978 W init : type=1400 audit(0.0:127): avc: denied { execute } for name="vendor.zsui.hardware.example@1.0-service"
dev="mmcblk0p48" ino=515 scontext=u:r:init:s0 tcontext=u:object_r:vendor_file:s0 tclass=file permissive=0
01-29 19:27:59.828 0 0 I init : Service 'example-hal-1-0' (pid 2978) exited with status 127
01-29 19:27:59.828 0 0 I init : Sending signal 9 to service 'example-hal-1-0' (pid 2978) process group...
显而易见的selinux权限问题,这里就直接提供全套了:
file_contexts:
/(system\/vendor|vendor)/bin/hw/vendor\.zsui\.hardware\.example@1\.0-service u:object_r:zsui_hal_exec:s0
hwservice_contexts:
vendor.zsui.hardware.example::IExample u:object_r:zsui_hal_hwservice:s0
hwservice.te
type zsui_hal_hwservice, hwservice_manager_type;
zsui_hal.te
type zsui_hal, domain;
type zsui_hal_exec, exec_type, file_type, vendor_file_type;
add_hwservice(zsui_hal, zsui_hal_hwservice)
init_daemon_domain(zsui_hal)
hwbinder_use(zsui_hal);
allow zsui_hal hwservicemanager_prop:file { read open getattr };
注:名字对应关系请自行修改;
编译刷机后如果不想回复出厂设置,但是始终无法识别新增的上下文标签,可以尝试使用强制刷新label:(需要remount)
adb shell restorecon -R /vendor/bin/hw/vendor.zsui.hardware.example@1.0-service
weixin_38603704
- 粉丝: 7
- 资源: 971
上传资源 快速赚钱
- 我的内容管理 收起
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
会员权益专享
最新资源
- c++校园超市商品信息管理系统课程设计说明书(含源代码) (2).pdf
- 建筑供配电系统相关课件.pptx
- 企业管理规章制度及管理模式.doc
- vb打开摄像头.doc
- 云计算-可信计算中认证协议改进方案.pdf
- [详细完整版]单片机编程4.ppt
- c语言常用算法.pdf
- c++经典程序代码大全.pdf
- 单片机数字时钟资料.doc
- 11项目管理前沿1.0.pptx
- 基于ssm的“魅力”繁峙宣传网站的设计与实现论文.doc
- 智慧交通综合解决方案.pptx
- 建筑防潮设计-PowerPointPresentati.pptx
- SPC统计过程控制程序.pptx
- SPC统计方法基础知识.pptx
- MW全能培训汽轮机调节保安系统PPT教学课件.pptx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0