-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathinit.qcom.rc
561 lines (454 loc) · 18.8 KB
/
init.qcom.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
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
# Copyright (c) 2009-2012, 2014-2021, The Linux Foundation. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of The Linux Foundation nor
# the names of its contributors may be used to endorse or promote
# products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
import /vendor/etc/init/hw/init.qcom.power.rc
import /vendor/etc/init/hw/init.qcom.usb.rc
import /vendor/etc/init/hw/init.device.rc
import /vendor/etc/init/hw/init.logcat.rc
on init
# Setup permission for Power HAL
chown system system /dev/stune/top-app/schedtune.boost
chmod 0664 /dev/stune/top-app/schedtune.boost
# Disable powersaving
write /sys/module/lpm_levels/parameters/sleep_disabled 1
# QSEE rpmb listener need symlink for bootdevice
wait /dev/block/platform/soc/${ro.boot.bootdevice}
symlink /dev/block/platform/soc/${ro.boot.bootdevice} /dev/block/bootdevice
# start qseecomd early as we mount system/ vendor/ early
# vold needs keymaster that needs qseecomd
start vendor.qseecomd
start vendor.keymaster-3-0
# bring back all cores
write /sys/devices/system/cpu/cpu0/online 1
write /sys/devices/system/cpu/cpu1/online 1
write /sys/devices/system/cpu/cpu2/online 1
write /sys/devices/system/cpu/cpu3/online 1
write /sys/devices/system/cpu/cpu4/online 1
write /sys/devices/system/cpu/cpu5/online 1
write /sys/devices/system/cpu/cpu6/online 1
write /sys/devices/system/cpu/cpu7/online 1
insmod /vendor/lib/modules/wlan.ko
on fs
mount_all /vendor/etc/fstab.qcom --early
chown root system /mnt/vendor/persist
chmod 0771 /mnt/vendor/persist
mkdir /mnt/vendor/persist/data 0700 system system
mkdir /mnt/vendor/persist/bms 0700 root system
mkdir /mnt/vendor/persist/display 0770 system graphics
mkdir /mnt/vendor/persist/hvdcp_opti 0770 root system
restorecon_recursive /mnt/vendor/persist
on late-fs
# Start services for bootanim
start surfaceflinger
start bootanim
start vendor.hwcomposer-2-1
start vendor.gralloc-2-0
# Wait for hwservicemanager ready since fsck might be triggered in mount_all --late
# In such case, init won't responce the property_set from hwservicemanager and then
# cause services for bootanim not running.
wait_for_prop hwservicemanager.ready true
# Mount RW partitions which need run fsck
mount_all /vendor/etc/fstab.qcom --late
on post-fs
# set RLIMIT_MEMLOCK to 64MB
setrlimit 8 67108864 67108864
# Wait qseecomd started
wait_for_prop vendor.sys.listeners.registered true
# load IPA FWs
# This must be started when vendor.sys.listeners.registered is true
write /dev/ipa 1
# msm specific files that need to be created on /data
on post-fs-data
#Create directory for tftp
mkdir /data/vendor/tombstones 0771 system system
mkdir /data/vendor/tombstones/rfs 0771 system system
mkdir /data/vendor/tombstones/modem 0771 system system
mkdir /data/vendor/tombstones/lpass 0771 system system
mkdir /data/vendor/tombstones/wcnss 0771 system system
mkdir /data/vendor/tombstones/dsps 0771 system system
mkdir /data/vendor/camera 0770 system system
mkdir /data/vendor/time/ 0700 system system
mkdir /data/vendor/ssrdump 0771 system system
on zygote-start
# zygote is started in common init.rc
# and now we can continue initialize /data/
mkdir /data/vendor/ipa 0770 radio radio
chown radio radio /data/vendor/ipa
# Create the directories used by the Wireless subsystem
mkdir /data/vendor/wifi 0771 wifi wifi
mkdir /data/vendor/wifi/wpa 0770 wifi wifi
mkdir /data/vendor/wifi/wpa/sockets 0770 wifi wifi
# Create the directories for bluetooth
mkdir /data/vendor/bluetooth 0770 bluetooth bluetooth
# Create the directories used by CnE subsystem
mkdir /data/vendor/connectivity 0771 radio radio
chown radio radio /data/vendor/connectivity
# Create directory for radio
mkdir /data/vendor/radio 0773 system radio
# Mark the copy complete flag to not completed
write /data/vendor/radio/copy_complete 0
chown radio radio /data/vendor/radio/copy_complete
chmod 0660 /data/vendor/radio/copy_complete
# File flags for prebuilt ril db file
write /data/vendor/radio/prebuilt_db_support 1
chown radio radio /data/vendor/radio/prebuilt_db_support
chmod 0400 /data/vendor/radio/prebuilt_db_support
write /data/vendor/radio/db_check_done 0
chown radio radio /data/vendor/radio/db_check_done
chmod 0660 /data/vendor/radio/db_check_done
# Create directories for Location services
mkdir /data/vendor/location 0770 gps gps
mkdir /data/vendor/location/mq 0770 gps gps
mkdir /data/vendor/location/xtwifi 0770 gps gps
mkdir /dev/socket/location 0770 gps gps
mkdir /dev/socket/location/mq 0770 gps gps
mkdir /dev/socket/location/xtra 0770 gps gps
# Create directories for wifihal services
mkdir /dev/socket/wifihal 0770 wifi wifi
chmod 2770 /dev/socket/wifihal
on early-boot
# Allow subsystem (modem etc) debugging
write /sys/kernel/boot_adsp/boot 1
chown system system /mnt/vendor/persist/sensors
chown system system /mnt/vendor/persist/sensors/sns.reg
chown system system /mnt/vendor/persist/sensors/sensors_settings
chmod 0664 /mnt/vendor/persist/sensors/sensors_settings
on boot
start vendor.rmt_storage
chown bluetooth net_bt /sys/class/rfkill/rfkill0/type
chown bluetooth net_bt /sys/class/rfkill/rfkill0/state
chown bluetooth bluetooth /proc/bluetooth/sleep/proto
chown system system /sys/kernel/boot_slpi/ssr
chmod 0660 /sys/class/rfkill/rfkill0/state
chmod 0660 /proc/bluetooth/sleep/proto
chown bluetooth net_bt /dev/ttyHS0
chmod 0660 /dev/ttyHS0
chown bluetooth net_bt /sys/class/rfkill/rfkill0/device/extldo
chmod 0660 /sys/class/rfkill/rfkill0/device/extldo
# This location is used by QCRIL to host UNIX domain
# socket files used for internal IPC within QCRIL
# modules
mkdir /dev/socket/qmux_radio 0770 radio radio
chmod 2770 /dev/socket/qmux_radio
mkdir /mnt/vendor/persist/drm 0770 system system
mkdir /mnt/vendor/persist/bluetooth 0770 bluetooth bluetooth
mkdir /mnt/vendor/persist/misc 0770 system system
mkdir /mnt/vendor/persist/alarm 0770 system system
mkdir /mnt/vendor/persist/time 0770 system system
mkdir /mnt/vendor/persist/secnvm 0770 system system
mkdir /mnt/vendor/persist/iar_db 0770 system system
mkdir /mnt/vendor/spunvm 0770 system system
setprop wifi.interface wlan0
setprop wifi.aware.interface wifi-aware0
# USB controller configuration
setprop vendor.usb.rndis.func.name "rndis_bam"
setprop vendor.usb.rmnet.func.name "rmnet_bam"
setprop vendor.usb.rmnet.inst.name "rmnet"
setprop vendor.usb.dpl.inst.name "dpl"
setprop vendor.usb.qdss.inst.name "qdss"
setprop vendor.usb.controller a800000.dwc3
setprop sys.usb.configfs 1
write /sys/module/usb_f_qcrndis/parameters/rndis_dl_max_xfer_size 15916
# Start RIL services
start vendor.qcrild
start vendor.qcrild2
start vendor.dataqti
start vendor.dataadpl
on boot && property:persist.vendor.usb.controller.default=*
setprop vendor.usb.controller ${persist.vendor.usb.controller.default}
on property:vendor.usb.controller=*
setprop sys.usb.controller ${vendor.usb.controller}
write /sys/module/usb_f_qcrndis/parameters/rndis_dl_max_xfer_size 15916
# Touchpanel
chown system system /sys/touchpanel/capacitive_keys
chown system system /sys/touchpanel/reversed_keys
chmod 0664 /sys/touchpanel/capacitive_keys
chmod 0664 /sys/touchpanel/double_tap
chmod 0664 /sys/touchpanel/reversed_keys
on property:sys.boot_completed=1
# configure governor settings
write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor schedutil
write /sys/devices/system/cpu/cpu0/cpufreq/schedutil/up_rate_limit_us 500
write /sys/devices/system/cpu/cpu0/cpufreq/schedutil/down_rate_limit_us 20000
# configure governor settings for big cluster
write /sys/devices/system/cpu/cpu4/cpufreq/scaling_governor schedutil
write /sys/devices/system/cpu/cpu4/cpufreq/schedutil/up_rate_limit_us 500
write /sys/devices/system/cpu/cpu4/cpufreq/schedutil/down_rate_limit_us 20000
# Start init.power.rc
setprop vendor.setup.power 1
# Set the default IRQ affinity to the silver cluster.
write /proc/irq/default_smp_affinity f
# Runtime fs tuning
write /sys/block/mmcblk0/queue/nr_requests 64
write /sys/block/mmcblk0/queue/iostats 1
write /sys/block/mmcblk0/queue/scheduler bfq
# Block layer tuning: discard chunk size up to 128MB
# Otherwise, contiguous discards can be merged
write /sys/block/mmcblk0/queue/discard_max_bytes 134217728
# Enable ZRAM on boot_complete
write /sys/block/zram0/comp_algorithm lz4
write /sys/block/zram0/max_comp_streams 8
write /proc/sys/vm/page-cluster 0
swapon_all /vendor/etc/fstab.qcom
write /proc/sys/vm/swappiness 100
# Setup runtime schedTune
write /dev/stune/foreground/schedtune.prefer_idle 1
write /dev/stune/foreground/schedtune.prefer_high_cap 0
write /dev/stune/foreground/schedtune.boost 0
write /dev/stune/nnapi-hal/schedtune.prefer_idle 0
write /dev/stune/schedtune.prefer_idle 0
write /dev/stune/schedtune.prefer_high_cap 0
write /dev/stune/schedtune.boost 0
write /dev/stune/top-app/schedtune.prefer_idle 1
write /dev/stune/top-app/schedtune.prefer_high_cap 0
write /dev/stune/top-app/schedtune.boost 10
# set default schedTune value for camera-daemon
write /dev/stune/camera-daemon/schedtune.prefer_idle 1
write /dev/stune/camera-daemon/schedtune.boost 0
# Set cpuset parameters
write /dev/cpuset/top-app/cpus 0-7
write /dev/cpuset/foreground/cpus 0-3,6-7
write /dev/cpuset/background/cpus 0-1
write /dev/cpuset/system-background/cpus 0-3
write /dev/cpuset/restricted/cpus 0-3
# Report max frequency to unity tasks
write /proc/sys/kernel/sched_lib_name "UnityMain,libunity.so,com.miHoYo,libUE4.so"
write /proc/sys/kernel/sched_lib_mask_force 255
# Start irqbalance
start vendor.msm_irqbalance
# Post-setup services
setprop vendor.post_boot.parsed 1
service qcomsysd /system/vendor/bin/qcom-system-daemon
class main
user root
group root diag oem_2901
disabled
on property:persist.vendor.qcomsysd.enabled=1
enable qcomsysd
on property:persist.vendor.qcomsysd.enabled=0
stop qcomsysd
on property:persist.sys.mba_boot_timeout=*
write /sys/module/pil_msa/parameters/pbl_mba_boot_timeout_ms ${persist.sys.mba_boot_timeout}
on property:persist.sys.modem_auth_timeout=*
write /sys/module/pil_msa/parameters/modem_auth_timeout_ms ${persist.sys.modem_auth_timeout}
on property:persist.sys.pil_proxy_timeout=*
write /sys/module/peripheral_loader/parameters/proxy_timeout_ms ${persist.sys.pil_proxy_timeout}
service vendor.ss_ramdump /vendor/bin/subsystem_ramdump
class main
user root
group system
disabled
service vendor.ssr_setup /vendor/bin/ssr_setup
oneshot
disabled
on property:persist.vendor.ssr.restart_level=*
start vendor.ssr_setup
on post-fs-data && property:persist.vendor.ssr.enable_ramdumps=1
write /sys/module/subsystem_restart/parameters/enable_ramdumps 1
mkdir /data/vendor/wifidump 771 root system
mkdir /data/vendor/ramdump 771 root system
mkdir /data/vendor/ramdump/bluetooth 0770 bluetooth bluetooth
mkdir /data/vendor/ssrdump 771 root system
mkdir /data/vendor/ssrlog 775 root system
start vendor.ss_ramdump
on property:persist.vendor.ssr.enable_ramdumps=0
write /sys/module/subsystem_restart/parameters/enable_ramdumps 0
# corefile limit
on property:persist.debug.trace=1
mkdir /data/core 0777 root root
write /proc/sys/kernel/core_pattern "/data/core/%E.%p.%e"
on property:vendor.media.target.version=*
setprop vendor.sys.media.target.version ${vendor.media.target.version}
on property:vendor.netflix.bsp_rev=*
setprop ro.netflix.bsp_rev ${vendor.netflix.bsp_rev}
on property:vendor.media.target_variant=*
setprop ro.media.xml_variant.codecs ${vendor.media.target_variant}
setprop ro.media.xml_variant.codecs_performance ${vendor.media.target_variant}
#Peripheral manager
service vendor.per_mgr /system/vendor/bin/pm-service
class core
user system
group system
ioprio rt 4
service vendor.per_proxy /system/vendor/bin/pm-proxy
class core
user system
group system
disabled
on property:init.svc.vendor.per_mgr=running
start vendor.per_proxy
on property:sys.shutdown.requested=*
stop vendor.per_proxy
service vendor.qseecomd /vendor/bin/qseecomd
class core
user root
group root
service vendor.sensors.qti /vendor/bin/sensors.qti
class core
user system
group system
service vendor.pd_mapper /system/vendor/bin/pd-mapper
class core
service ppd /system/vendor/bin/mm-pp-dpps
class late_start
user system
group system graphics
socket pps stream 0660 system system
disabled
on property:init.svc.surfaceflinger=stopped
stop ppd
on property:init.svc.surfaceflinger=running
start ppd
on property:init.svc.surfaceflinger=restarting
stop ppd
on property:init.svc.zygote=stopped
stop ppd
on property:init.svc.zygote=running
start ppd
on property:init.svc.zygote=restarting
stop ppd
service vendor.qrtr-ns /vendor/bin/qrtr-ns -f
class core
user vendor_qrtr
group vendor_qrtr
capabilities NET_BIND_SERVICE
# Data Migration
service cnss-daemon /system/vendor/bin/cnss-daemon -n -l
class late_start
user system
group system inet net_admin wifi
capabilities NET_ADMIN
on property:sys.shutdown.requested=*
write /sys/kernel/shutdown_wlan/shutdown 1
stop cnss-daemon
service loc_launcher /system/vendor/bin/loc_launcher
class late_start
user gps
group gps
service radio-sh /vendor/bin/init.radio.sh
class late_start
user root
group root system radio
oneshot
service hostapd_fst /vendor/bin/hw/hostapd -dd -g /data/vendor/wifi/hostapd/global
class main
capabilities NET_ADMIN NET_RAW
user wifi
group wifi
disabled
oneshot
service diag_mdlog_start /system/vendor/bin/diag_mdlog
class late_start
user shell
group system oem_2901 sdcard_rw sdcard_r media_rw
disabled
oneshot
service diag_mdlog_stop /system/vendor/bin/diag_mdlog -k
class late_start
user shell
group system oem_2901 sdcard_rw sdcard_r media_rw
disabled
oneshot
# Set vendor-ril lib path based on Meta version
on property:vendor.rild.libpath=*
setprop rild.libpath ${vendor.rild.libpath}
on property:ro.vendor.radio.noril=*
setprop ro.radio.noril ${ro.vendor.radio.noril}
service bugreport /system/bin/dumpstate -d -p -B -z -o /data/user_de/0/com.android.shell/files/bugreports/bugreport
class main
disabled
oneshot
keycodes 114 115 116
#Set GPU Opengles version
on property:vendor.opengles.version=*
setprop ro.opengles.version ${vendor.opengles.version}
service vendor.audio-hal /vendor/bin/hw/android.hardware.audio.service
override
class hal
user audioserver
# media gid needed for /dev/fm (radio) and for /data/misc/media (tee)
group audio camera drmrpc inet media mediadrm net_bt net_bt_admin net_bw_acct oem_2901 wakelock
capabilities BLOCK_SUSPEND
ioprio rt 4
writepid /dev/cpuset/foreground/tasks /dev/stune/foreground/tasks
onrestart restart audioserver
service vendor.charger /system/bin/chargeonlymode
class charger
user system
group system graphics input
capabilities SYS_BOOT
seclabel u:r:charger:s0
on property:init.svc.vendor.charger=running
stop vendor.qseecomd
stop vendor.keymaster-3-0
setprop vendor.setup.power 1
# Lock to lowest freqency on charger mode
write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor powersave
write /sys/devices/system/cpu/cpu4/cpufreq/scaling_governor powersave
# Keep one LITTLE and one big
write /sys/devices/system/cpu/cpu1/online 0
write /sys/devices/system/cpu/cpu2/online 0
write /sys/devices/system/cpu/cpu3/online 0
write /sys/devices/system/cpu/cpu4/online 0
write /sys/devices/system/cpu/cpu5/online 0
write /sys/devices/system/cpu/cpu7/online 0
start vendor.power_off_alarm
service vendor.power_off_alarm /vendor/bin/power_off_alarm
class core
group system
disabled
oneshot
service vendor.hvdcp_opti /vendor/bin/hvdcp_opti
class main
user system
group system wakelock
capabilities BLOCK_SUSPEND WAKE_ALARM
service vendor.msm_irqbalance /vendor/bin/msm_irqbalance -f /system/vendor/etc/msm_irqbalance.conf
class core
user root
group root
disabled
on property:persist.sys.device_provisioned=1
setprop dalvik.vm.dex2oat-cpu-set 0,1,2,3,4,5
setprop dalvik.vm.dex2oat-threads 4
# Write the dark theme magic to /misc partition.
service vendor.theme_set /vendor/bin/misc_writer --set-dark-theme
disabled
oneshot
# Set dark boot flag when the device is provisioned.
on property:persist.sys.device_provisioned=1
start vendor.theme_set
service vendor.thermal-engine /vendor/bin/thermal-engine -c /vendor/etc/thermal-engine.conf
class main
user root
group root
socket thermal-send-client stream 0660 system oem_2907
socket thermal-recv-client stream 0660 system oem_2907
socket thermal-recv-passive-client stream 0660 system oem_2907
socket thermal-send-rule stream 0660 system oem_2907
writepid /dev/cpuset/system-background/tasks
on property:sys.boot_completed=1
restart vendor.thermal-engine