2020-09-11

很久之前一直差不多搞清楚来触发顺序,不过后来又忘了。先来看下我自己开发板的init.rc的内容吧

Copyright © 2012 The Android Open Source Project

IMPORTANT: Do not create world writable files or directories.

This is a common source of Android security bugs.

import /init.environ.rc
import /init.usb.rc
import /init. r o . h a r d w a r e . r c i m p o r t / i n i t . {ro.hardware}.rc import /init. ro.hardware.rcimport/init.{ro.zygote}.rc
import /init.trace.rc

on early-init

on init

on property:sys.boot_from_charger_mode=1
class_stop charger
trigger late-init

on late-init
trigger early-fs
trigger fs
trigger post-fs
trigger post-fs-data
trigger load_all_props_action
trigger firmware_mounts_complete
trigger early-boot
trigger boot

on post-fs

on post-fs-data

on boot

on property:vold.decrypt=trigger_post_fs_data
trigger post-fs-data

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
大部分内容被我精简了。可以肯定的先触发early-init 依次 init 然后由于sys.boot_from_charger_mode属性值被改变,就被会触发,然后late-init 在late-init中依次触发early-fs fs post-fs post-fs-data load_all_props_action(猜测应该是读取prop.build这些文件将所以系统属性加载) firmware_mounts_complete(这个不太清楚) early-boot boot 。所以boot应该是最后被触发的。所以如果你干什么可以根据触发顺序来搞。比如如果你开机后执行一个脚本可以这样在init.rc中添加

service service_demo /system/bin/demo.sh
disabled
oneshot
1
2
3
然后 在某个地方添加start service_demo,因为没有添加 class main(core)等所以默认class default.因为添加了disabled所以必须通过start service_demo来触发。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值