-
Notifications
You must be signed in to change notification settings - Fork 2
/
init.miui.rc
336 lines (291 loc) · 10.9 KB
/
init.miui.rc
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
# miui init rc
import /init.miui8.rc
import /init.miui.google_revenue_share.rc
import /init.miui.google_revenue_share_v2.rc
import /init.miui.google_revenue_share_vdf.rc
import /init.miui.google_revenue_share_lm_cr.rc
import /init.miui.cust.rc
import /init.miui.nativedebug.rc
import /init.miui.qadaemon.rc
on init
# Create cgroup mount point for memory and freezer
mount tmpfs none /sys/fs/cgroup mode=0750,uid=0,gid=1000
mkdir /sys/fs/cgroup/memory 0750 root system
mount cgroup none /sys/fs/cgroup/memory memory
mkdir /sys/fs/cgroup/freezer 0750 root system
mount cgroup none /sys/fs/cgroup/freezer freezer
# set log buffersize
setprop persist.logd.size.radio "4M"
setprop persist.logd.size.system "4M"
setprop persist.logd.size.crash "1M"
# Xiaomi: Create cgroup in freezer
mkdir /sys/fs/cgroup/freezer/perf 0750 root system
mkdir /sys/fs/cgroup/freezer/perf/frozen 0750 root system
write /sys/fs/cgroup/freezer/perf/frozen/freezer.state FROZEN
chown root system /sys/fs/cgroup/freezer/perf/frozen/cgroup.procs
chmod 0660 /sys/fs/cgroup/freezer/perf/frozen/cgroup.procs
chown root system /sys/fs/cgroup/freezer/perf/frozen/tasks
chmod 0660 /sys/fs/cgroup/freezer/perf/frozen/tasks
mkdir /sys/fs/cgroup/freezer/perf/thawed 0750 root system
chown root system /sys/fs/cgroup/freezer/perf/thawed/cgroup.procs
chmod 0660 /sys/fs/cgroup/freezer/perf/thawed/cgroup.procs
chown root system /sys/fs/cgroup/freezer/perf/thawed/tasks
chmod 0660 /sys/fs/cgroup/freezer/perf/thawed/tasks
on late-init
# set vr related cpuset
mkdir /dev/cpuset/vr
write /dev/cpuset/vr/mems 0
# change permissions for vr cpusets as we'll touch at runtime
chown system system /dev/cpuset/foreground/boost/cpus
chmod 0664 /dev/cpuset/foreground/cpus
chown root system /dev/cpuset/foreground/cpus
chown system system /dev/cpuset/vr
chown system system /dev/cpuset/vr/cpu_exclusive
chown system system /dev/cpuset/vr/cpus
chown system system /dev/cpuset/vr/tasks
chmod 0664 /dev/cpuset/top-app/cpus
chown root system /dev/cpuset/top-app/cpus
chown system system /dev/cpuset/top-app/boost
chown system system /dev/cpuset/top-app/boost/tasks
chown system system /dev/cpuset/top-app/boost/cpus
chmod 0664 /dev/cpuset/vr/cpu_exclusive
chmod 0664 /dev/cpuset/vr/cpus
chmod 0664 /dev/cpuset/vr/tasks
chmod 0664 /dev/cpuset/top-app/boost/tasks
on late-init
# put some heavy-load thread into this cpuset for performance
mkdir /dev/cpuset/game
write /dev/cpuset/game/mems 0
chown system system /dev/cpuset/game
chown system system /dev/cpuset/game/tasks
chown system system /dev/cpuset/game/cgroup.procs
chmod 0660 /dev/cpuset/game/tasks
chmod 0660 /dev/cpuset/game/cgroup.procs
# put some light-load thread into this cpuset for battery life
mkdir /dev/cpuset/gamelite
write /dev/cpuset/gamelite/mems 0
chown system system /dev/cpuset/gamelite
chown system system /dev/cpuset/gamelite/tasks
chown system system /dev/cpuset/gamelite/cgroup.procs
chmod 0660 /dev/cpuset/gamelite/tasks
chmod 0660 /dev/cpuset/gamelite/cgroup.procs
on fs
start mqsasd
on post-fs-data
mkdir /data/system 0775 system system
mkdir /data/system/mcd 0755 system system
mkdir /data/system/whetstone 0770 system system
mkdir /data/system/migt 0777 system system
restorecon_recursive /data/system/mcd
restorecon_recursive /data/system/whetstone
restorecon_recursive /data/system/migt
restorecon /sys/kernel/debug/system_stats
restorecon /sys/kernel/debug/msm_subsys/modem
chmod 0777 /data/system/migt
chmod 0777 /data/system/migt/migt
on post-fs-data
chown system system /sys/hwconf
chown system system /sys/hwconf/hw_info
chown system system /sys/hwconf/hw_mon
restorecon_recursive /sys/hwconf
on post-fs-data
restorecon_recursive /sys/kernel/debug/rtmm
restorecon_recursive /sys/kernel/debug/ktrace
restorecon_recursive /sys/kernel/debug/kperfevents
restorecon /sys/kernel/debug/extfrag/extfrag_index
# secureboot
service setlockstate /sbin/setlockstate
class core
oneshot
seclabel u:r:vold:s0
#mdbd
service mdbd /sbin/mdbd
class core
socket mdbd stream 660 system system
disabled
seclabel u:r:mdbd:s0
service shelld /system/xbin/shelld
user system
group system
class main
#service for su
service su_daemon /system/xbin/su --daemon
class main
# service for mcd init
service mcd_init /system/bin/mcd init
user root
group system
class main
disabled
oneshot
on property:init.svc.zygote=running
setprop mcd.extra.params "4"
start mcd_init
#service for mcd main service
service mcd_service /system/bin/mcd
class main
disabled
on property:sys.boot_completed=1
start mcd_service
start miui-post-boot
service mdb_svc /system/xbin/mdb_svc
class late_start
disabled
service otad /bin/otad
class main
socket otad stream 0660 updater updater
seclabel u:r:otad:s0
# will delete this service, /system may be invalidate yet when post-fs-data triggered
service checkpath /system/xbin/miuioneshots check-sdk-path
class main
user root
group system
disabled
oneshot
on post-fs-data
start checkpath
service checksdkpath /system/xbin/miuioneshots check-sdk-path
class main
user root
group system
disabled
oneshot
on property:init.svc.zygote=running
start checksdkpath
# for NativeDebug
on post-fs-data
mkdir /data/system/nativedebug 0771 system system
chown system system /data/system/nativedebug
chmod 0771 /data/system/nativedebug
restorecon /data/system/nativedebug
# for theme
on post-fs-data
mkdir /data/system/theme 0775 theme theme
chown theme theme /data/system/theme
chmod 0775 /data/system/theme
restorecon /data/system/theme
chown theme theme /data/system/theme/lock_wallpaper
chmod 0775 /data/system/theme/lock_wallpaper
restorecon /data/system/theme/lock_wallpaper
mkdir /data/system/theme_magic 0775 theme theme
chown theme theme /data/system/theme_magic
chmod 0775 /data/system/theme_magic
restorecon /data/system/theme_magic
mkdir /data/system/theme_magic/customized_icons 0775 theme theme
chown theme theme /data/system/theme_magic/customized_icons
chmod 0775 /data/system/theme_magic/customized_icons
restorecon /data/system/theme_magic/customized_icons
mkdir /data/system/theme_magic/ringtones 0775 theme theme
chown theme theme /data/system/theme_magic/ringtones
chmod 0775 /data/system/theme_magic/ringtones
restorecon /data/system/theme_magic/ringtones
service fdpp /system/bin/fdpp daemon
class main
user root
group system
# mqsasd
service mqsasd /system/xbin/mqsasd daemon
user root
group system cache log
socket mqsasd stream 0660 system system
on post-fs-data
mkdir /data/mqsas 0775 system system
mkdir /data/system/miuilog 0775 system system
#adb input
on property:persist.security.adbinput=*
restart adbd
service miui-early-boot /system/bin/sh /init.miui.early_boot.sh
class main
user root
oneshot
seclabel u:r:miui_init_shell:s0
service system_perf_init /system/xbin/system_perf_init
class main
user root
oneshot
service miui-post-boot /system/bin/sh /init.miui.post_boot.sh
class late_start
user root
disabled
oneshot
on boot
# cpu trace
chown root system /d/ktrace/sched/pids
chmod 0660 /d/ktrace/sched/pids
chown system system /d/ktrace/sched/zygote_pid
chmod 0660 /d/ktrace/sched/zygote_pid
chown system system /d/ktrace/sched/zygote64_pid
chmod 0660 /d/ktrace/sched/zygote64_pid
chown system system /d/ktrace/events/mm/slowpath/reset
# kperfevents
chown system system /d/kperfevents/supervision_level
chmod 0660 /d/kperfevents/supervision_level
chown system system /d/kperfevents/lower_threshold_millis
chmod 0660 /d/kperfevents/lower_threshold_millis
chown system system /d/kperfevents/upper_threshold_millis
chmod 0660 /d/kperfevents/upper_threshold_millis
chown system system /d/kperfevents/min_overlap_millis
chmod 0660 /d/kperfevents/min_overlap_millis
chown system system /d/kperfevents/translating_kernel_address_args
chmod 0220 /d/kperfevents/translating_kernel_address_args
chown system system /d/kperfevents/translating_kernel_address_result
chmod 0440 /d/kperfevents/translating_kernel_address_result
chown system system /dev/proc_kperfevents
chmod 0444 /dev/proc_kperfevents
chown system system /dev/device_kperfevents
chmod 0440 /dev/device_kperfevents
# psi
chmod 0660 /proc/pressure/io
chmod 0660 /proc/pressure/memory
chmod 0660 /proc/pressure/cpu
# rtmm
chown system system /d/rtmm/reclaim/auto_reclaim
chmod 0660 /d/rtmm/reclaim/auto_reclaim
chown system system /d/rtmm/reclaim/global_reclaim
chmod 0660 /d/rtmm/reclaim/global_reclaim
chown system system /d/rtmm/reclaim/proc_reclaim
chmod 0660 /d/rtmm/reclaim/proc_reclaim
chown system system /d/rtmm/reclaim/kill
chmod 0660 /d/rtmm/reclaim/kill
chown system system /d/rtmm/compact/compact_memory
chmod 0660 /d/rtmm/compact/compact_memory
mkdir /dev/cpuctl/fg_service
chown system system /dev/cpuctl/fg_service/tasks
chmod 0666 /dev/cpuctl/fg_service/tasks
write /dev/cpuctl/bg_non_interactive/cpu.rt_runtime_us 300000
write /dev/cpuctl/fg_service/cpu.shares 256
write /dev/cpuctl/fg_service/cpu.rt_runtime_us 400000
write /dev/cpuctl/fg_service/cpu.rt_period_us 1000000
mkdir /dev/cpuctl/fg_service/fg_limited
chown system system /dev/cpuctl/fg_service/fg_limited/tasks
chmod 0666 /dev/cpuctl/fg_service/fg_limited/tasks
write /dev/cpuctl/fg_service/fg_limited/cpu.shares 256
write /dev/cpuctl/fg_service/fg_limited/cpu.rt_runtime_us 400000
write /dev/cpuctl/fg_service/fg_limited/cpu.rt_period_us 1000000
on property:persist.sys.miui_bg_binder=true
write /sys/kernel/debug/binder/bg_enable "1"
on property:persist.sys.miui_spo_test=true
write /cache/boot_flag "disable"
on property:sys.boot_completed=1 && property:ro.debuggable=1
# 工厂running测试需求
# gsort路径权限打开
chmod 0777 /dev/block/sda5
# input_suspend节点权限打开
chown system system sys/class/power_supply/battery/input_suspend
chmod 0777 sys/class/power_supply/battery/input_suspend
# /data/local/tmp路径权限打开
mkdir /data/local/tmp
chown system system /data/local/tmp
chmod 0777 /data/local/tmp
# MI ADD
# miui bugreport need to get bugreport
# on property:sys.miui.bugreport_file=*
# on property:sys.miui.dest_path=*
# start copy_bugreport_file
service copy_bugreport_file /system/bin/sh /system/bin/copy_bugreport_file.sh ${sys.miui.bugreport_file} ${sys.miui.dest_path}
user shell
group shell sdcard_rw system net_raw
oneshot
disabled
seclabel u:r:shell:s0
#-MI ADD