在rc增加service

1,在init.qcom.rc中
service jj /system/bin/jj.sh
    class main
    user root
    group root  
    oneshot 

//------------------------一般在device下----------------------------
2,在file_contexts中
/system/bin/jj.sh                               u:object_r:jj_exec:s0    

3,在jj.te中
    type jj, domain;                                          //domain表明是在进程中
    type jj_exec,exec_type, file_type;         //声明类型
    permissive jj;                                          //去掉selinux保护---很重要

    init_daemon_domain(jj)                               //无分号;
    allow jj jj_exec:file {execute read open execute_no_trans};
    allow jj shell_exec:file { read };
    allow jj system_file:file {    execute_no_trans };

PS:补充:

tcontext:system_file

tclass:file

4,在/system/bin/jj.sh

    #!/system/bin/sh
    echo "jj here"    
    echo "just test" >> /data/jjtest
    insmod /system/lib/modules/gpio_keys.ko
    
5,在Sepolicy/Android.mk中    
    增加 jj.te
    
    
    PS:另外可以增加Product.mk中拷贝 PRODUCT_COPY_FILES += \ 变更bin文件路径

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值