init.cfg 9.5 KB
Newer Older
S
sun_fan 已提交
1 2
{
    "import" : [
Z
zhong_ning 已提交
3 4
            "/etc/init.usb.cfg",
            "/etc/init.usb.configfs.cfg",
5
            "/vendor/etc/init.${ohos.boot.hardware}.cfg"
S
sun_fan 已提交
6 7 8 9 10 11
    ],
    "jobs" : [{
            "name" : "pre-init",
            "cmds" : [
                "write /proc/sys/kernel/sysrq 0",
                "start ueventd",
12
                "start watchdog_service",
X
xionglei6 已提交
13 14
                "mkdir /data",
                "mount_fstab /vendor/etc/fstab.${ohos.boot.hardware}",
R
renwei 已提交
15
                "restorecon /data",
16 17 18 19
                "chown system system /data",
                "chmod 0771 /data",
                "mkdir /data/service 0711 root root",
                "mkdir /data/service/el0 0711 root root",
20 21
                "mkdir /data/service/el0/startup 0755 root root",
                "mkdir /data/service/el0/startup/init 0755 root root",
X
xionglei6 已提交
22
                "mount configfs none /config nodev noexec nosuid",
G
gaochao 已提交
23
                "load_persist_params ",
X
xlei1030 已提交
24
                "bootchart start",
G
gaochao 已提交
25
                "chown access_token access_token /dev/access_token_id",
Z
zhangqilong 已提交
26
                "chmod 0666 /dev/access_token_id"
S
sun_fan 已提交
27 28 29 30
            ]
        }, {
            "name" : "init",
            "cmds" : [
X
xionglei6 已提交
31 32
                "mksandbox system",
                "mksandbox chipset",
S
sun_fan 已提交
33 34 35 36 37 38 39 40 41 42 43 44 45 46
                "copy /proc/cmdline /dev/urandom",
                "copy /system/etc/prop.default /dev/urandom",
                "symlink /proc/self/fd/0 /dev/stdin",
                "symlink /proc/self/fd/1 /dev/stdout",
                "symlink /proc/self/fd/2 /dev/stderr",
                "write /proc/sys/kernel/panic_on_oops 1",
                "write /proc/sys/kernel/hung_task_timeout_secs 0",
                "write /proc/cpu/alignment 4",
                "write /proc/sys/kernel/sched_tunable_scaling 0",
                "write /proc/sys/kernel/sched_latency_ns 10000000",
                "write /proc/sys/kernel/sched_wakeup_granularity_ns 2000000",
                "write /proc/sys/kernel/sched_child_runs_first 0",
                "write /proc/sys/kernel/randomize_va_space 2",
                "write /proc/sys/vm/mmap_min_addr 32768",
S
sun_fan 已提交
47
                "write /proc/sys/net/ipv4/ping_group_range 0 2147483647",
S
sun_fan 已提交
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
                "write /proc/sys/net/unix/max_dgram_qlen 600",
                "write /proc/sys/kernel/sched_rt_runtime_us 950000",
                "write /proc/sys/kernel/sched_rt_period_us 1000000",
                "write /proc/sys/net/core/rmem_max 262144",
                "write /proc/sys/net/core/wmem_max 262144",
                "write /proc/sys/net/ipv4/fwmark_reflect 1",
                "write /proc/sys/net/ipv6/fwmark_reflect 1",
                "write /proc/sys/net/ipv4/tcp_fwmark_accept 1",
                "write /proc/sys/net/ipv4/conf/all/accept_redirects 0",
                "write /proc/sys/net/ipv6/conf/all/accept_redirects 0",
                "chmod 0400 /proc/net/fib_trie",
                "chown system system /proc/pressure/memory",
                "chmod 0664 /proc/pressure/memory",
                "mkdir /dev/fscklogs 0770 root system",
                "write /proc/sys/abi/swp 1",
                "symlink /proc/self/fd /dev/fd",
                "export DOWNLOAD_CACHE /data/cache",
Z
zhong_ning 已提交
65 66
                "setrlimit RLIMIT_NICE 40 40",
                "setrlimit RLIMIT_NOFILE 32768 32768",
Z
zhong_ning 已提交
67
                "write /sys/class/leds/vibrator/trigger transient",
S
sun_fan 已提交
68 69
                "chown system system /sys/power/state",
                "chown system system /sys/power/wakeup_count",
Z
zhong_ning 已提交
70
                "chmod 0660 /sys/power/state",
R
roger 已提交
71 72
                "mount pstore pstore /sys/fs/pstore nodev noexec nosuid",
                "chown system log /sys/fs/pstore",
R
roger 已提交
73
                "chmod 0555 /sys/fs/pstore",
Z
zhong_ning 已提交
74 75 76
                "ifup lo",
                "hostname localhost",
                "domainname localdomain"
S
sun_fan 已提交
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
            ]
        }, {
            "name" : "post-init",
            "cmds" : [
                "trigger early-fs",
                "trigger fs",
                "trigger post-fs",
                "trigger late-fs",
                "trigger post-fs-data",
                "trigger firmware_mounts_complete",
                "trigger early-boot",
                "trigger boot"
            ]
        }, {
            "name" : "post-fs",
            "cmds" : [
                "mount rootfs rootfs / remount bind ro nodev",
                "chown root log /proc/vmallocinfo",
                "chmod 0440 /proc/vmallocinfo",
                "chown root log /proc/slabinfo",
                "chmod 0440 /proc/slabinfo",
                "chown root system /proc/kmsg",
                "chmod 0440 /proc/kmsg",
S
sun_fan 已提交
100
                "chmod 0444 /sys/fs/selinux/policy"
S
sun_fan 已提交
101 102 103 104 105 106 107 108 109
            ]
        }, {
            "name" : "late-fs",
            "cmds" : [
                "chmod 0755 /sys/kernel/debug/tracing"
            ]
        }, {
            "name" : "post-fs-data",
            "cmds" : [
110
                "init_global_key /data",
111 112 113
                "mkdir /data/app 0711 root root",
                "mkdir /data/app/el1 0711 root root",
                "mkdir /data/app/el1/bundle 0711 root root",
114
                "mkdir /data/app/el1/bundle/public 0711 root root",
115 116 117 118 119
                "mkdir /data/app/el2 0711 root root",
                "mkdir /data/app/el3 0711 root root",
                "mkdir /data/app/el4 0711 root root",
                "mkdir /data/service/el1 0711 root root",
                "mkdir /data/service/el1/public 0711 root root",
X
xionglei6 已提交
120
                "mkdir /data/service/el1/public/AbilityManagerService 0711 system system",
121 122 123 124 125
                "mkdir /data/service/el2 0711 root root",
                "mkdir /data/chipset 0711 root root",
                "mkdir /data/chipset/el1 0711 root root",
                "mkdir /data/chipset/el1/public 0711 root root",
                "mkdir /data/chipset/el2 0711 root root",
126
                "init_main_user ",
127 128 129 130 131 132 133 134 135 136 137 138 139
                "mkdir /data/app/el1/0 0711 root root",
                "mkdir /data/app/el1/0/base 0711 root root",
                "mkdir /data/app/el1/0/database 0711 system system",
                "mkdir /data/app/el2/0 0711 root root",
                "mkdir /data/app/el2/0/base 0711 root root",
                "mkdir /data/app/el2/0/database 0711 system system",
                "mkdir /data/app/el3/0 0711 root root",
                "mkdir /data/app/el3/0/base 0711 root root",
                "mkdir /data/app/el4/0 0711 root root",
                "mkdir /data/app/el4/0/base 0711 root root",
                "mkdir /data/service/el2/0 0711 root root",
                "mkdir /data/service/el2/0/hmdfs 0711 system system",
                "mkdir /data/chipset/el2/0 0711 root root",
140
                "mkdir /storage/media 0711 root root",
S
sun_fan 已提交
141 142 143
                "mkdir /data/misc 01771 system misc",
                "mkdir /data/local 0751 root root",
                "mkdir /data/vendor 0771 root root",
D
dujingcheng@huawei.com 已提交
144
                "mkdir /data/local/ark-cache 0711 root root",
S
sun_fan 已提交
145 146 147 148 149 150 151 152
                "mkdir /data/local/tmp 0771 shell shell",
                "mkdir /data/local/traces 0777 shell shell",
                "mkdir /data/data 0771 system system",
                "mkdir /data/app 0771 system system",
                "mkdir /data/nfc 0770 nfc nfc",
                "mkdir /data/nfc/param 0770 nfc nfc",
                "setparam sys.use_memfd false",
                "chown root system /dev/fscklogs/log",
潘钦旭 已提交
153 154
                "chmod 0770 /dev/fscklogs/log",
                "chmod 0660 /dev/fuse"
S
sun_fan 已提交
155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172
            ]
        }, {
            "name" : "boot",
            "cmds" : [
                "write /proc/sys/net/core/xfrm_acq_expires 3600",
                "write /proc/sys/vm/overcommit_memory 1",
                "write /proc/sys/vm/min_free_order_shift 4",
                "chown root system /sys/block/zram0/idle",
                "chmod 0664 /sys/block/zram0/idle",
                "write /proc/sys/vm/dirty_expire_centisecs 200",
                "write /proc/sys/vm/dirty_background_ratio 5",
                "chown system system /sys/class/leds/red/brightness",
                "chown system system /sys/class/leds/green/brightness",
                "chown system system /sys/class/leds/blue/brightness",
                "chown root radio /proc/cmdline",
                "setparam net.tcp.default_init_rwnd 60"
            ]
        }, {
Z
zhong_ning 已提交
173
            "name" : "param:sys.sysctl.extra_free_kbytes=*",
S
sun_fan 已提交
174 175 176 177 178
            "condition" : "sys.sysctl.extra_free_kbytes=*",
            "cmds" : [
                "write /proc/sys/vm/extra_free_kbytes ${sys.sysctl.extra_free_kbytes}"
            ]
        }, {
Z
zhong_ning 已提交
179
            "name" : "param:sys.sysctl.tcp_def_init_rwnd=*",
S
sun_fan 已提交
180 181 182 183 184
            "condition" : "sys.sysctl.tcp_def_init_rwnd=*",
            "cmds" : [
                "write /proc/sys/net/ipv4/tcp_default_init_rwnd ${sys.sysctl.tcp_def_init_rwnd}"
            ]
        }, {
Z
zhong_ning 已提交
185
            "name" : "param:security.perf_harden=0",
S
sun_fan 已提交
186 187 188 189 190 191 192 193
            "condition" : "security.perf_harden=0",
            "cmds" : [
                "write /proc/sys/kernel/perf_event_paranoid 1",
                "write /proc/sys/kernel/perf_event_max_sample_rate ${debug.perf_event_max_sample_rate:-100000}",
                "write /proc/sys/kernel/perf_cpu_time_max_percent ${debug.perf_cpu_time_max_percent:-25}",
                "write /proc/sys/kernel/perf_event_mlock_kb ${debug.perf_event_mlock_kb:-516}"
            ]
        }, {
Z
zhong_ning 已提交
194
            "name" : "param:security.perf_harden=1",
S
sun_fan 已提交
195 196 197 198
            "condition" : "security.perf_harden=1",
            "cmds" : [
                "write /proc/sys/kernel/perf_event_paranoid 3"
            ]
X
xionglei6 已提交
199 200 201 202 203 204
        }, {
            "name" : "services:console",
            "cmds" : [
                "chmod 0773 /data/misc/trace",
                "chmod 0775 /data/misc/wmtrace"
            ]
S
sun_fan 已提交
205 206 207
        }
    ]
}