Android 添加啓動腳本

一般androi系統啓動時 我們想讓它啓動我們自己的腳本 那麼應該怎麼去添加以及啓動呢
首先在init.rc 添加我們的啓動服務
service test /system/bin/test.sh
user root
group root
disabled
oneshot

on property:sys.boot_completed=1
start test
相關的含義自己去百度了

以及更改腳本權限
chmod 0777 /system/bin/test.sh

這裏的腳本爲 test.sh 然後放到我們的system/bin目錄下

接着我們要在file_contexts 添加
/system/bin/test.sh u:object_r:test_exec:s0

test.te 內容如下

type test, domain;
type test_exec, exec_type, file_type;
init_daemon_domain(test)

allow test device:lnk_file { create };
allow test device:dir { write };
allow test device:dir { add_name };
allow test toolbox_exec:file { read open execute_no_trans getattr execute};
allow test system_data_file:file { getattr };
allow test shell_exec:file { getattr };
allow test shell_exec:file { read };

rockchip相關的描述文檔下載

https://pan.baidu.com/s/1v341eCdeZH4SmKiOtrWopg

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章