--- a/conf/init.rc
+++ b/conf/init.rc
@@ -6,6 +6,8 @@ on early-init
on init
+ start watchdogd
+
# See storage config details at http://source.android.com/tech/storage/
mkdir /storage/sdcard 0000 root root
mkdir /storage/usb1 0000 root root
@@ -584,6 +586,10 @@ on property:meizu.wifi.test=stop
stop wifi_test_mode
####wifi test end
+# Set watchdog timer to 30 seconds and pet it every 10 seconds to get a 20 second margin
+service watchdogd /sbin/watchdogd 10 20
+ class core
+
# on userdebug and eng builds, enable kgdb on the serial console
on property:ro.debuggable=1
write /sys/module/kgdboc/parameters/kgdboc ttyFIQ1
需要为新增的进程增加域、执行权限
type watchdogd, domain;
typewatchdogd_exec, exec_type, file_type;
然后启用这个域
init_daemon_domain(watchdogd)
1
2
3
4
5
验证,原则上修改 SELinux的 问题需要全编译。
发现还是不行。需要加上:
seclabel u:r:watchdogd:s0
# Set watchdog timer to 30 seconds and pet it every 10 seconds to get a 20 second margin
service watchdogd /sbin/watchdogd 10 20
class core
seclabel u:r:watchdogd:s0