forked from BenzoRom/device_google_marlin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.common.rc
970 lines (791 loc) · 35.1 KB
/
init.common.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
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
on charger
write /sys/devices/system/cpu/cpu2/online 0
write /sys/devices/system/cpu/cpu3/online 0
write /sys/module/lpm_levels/parameters/sleep_disabled 0
wait /dev/block/platform/soc/624000.ufshc
# Enable UFS powersaving
write /sys/devices/soc/624000.ufshc/clkscale_enable 1
write /sys/devices/soc/624000.ufshc/clkgate_enable 1
write /sys/devices/soc/624000.ufshc/624000.ufshc:ufs_variant/pm_qos_enable 1
write /sys/module/lpm_levels/parameters/sleep_disabled N
service vendor.charger /charger
class charger
seclabel u:r:charger:s0
on early-init
mount debugfs debugfs /sys/kernel/debug
chmod 0755 /sys/kernel/debug
on init
# Disable UFS powersaving
write /sys/devices/soc/624000.ufshc/clkscale_enable 0
write /sys/devices/soc/624000.ufshc/clkgate_enable 0
write /sys/devices/soc/624000.ufshc/624000.ufshc:ufs_variant/pm_qos_enable 0
write /sys/module/lpm_levels/parameters/sleep_disabled Y
# 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
# We have vendor/ as early mount so we can start qseecomd earlier
# early mount partions e.g. vendor/ will be mounted in init first stage
# see b/27805372
start vendor.qseecomd
# Support legacy paths
symlink /sdcard /mnt/sdcard
symlink /sdcard /storage/sdcard0
# Setup cpusets used by the VR services.
mkdir /dev/cpuset/kernel 0750 root system
write /dev/cpuset/kernel/cpus 0
write /dev/cpuset/kernel/mems 0
chown system system /dev/cpuset/kernel/tasks
chmod 0660 /dev/cpuset/kernel/tasks
mkdir /dev/cpuset/system 0750 root system
write /dev/cpuset/system/cpus 0
write /dev/cpuset/system/mems 0
chown system system /dev/cpuset/system/tasks
chmod 0660 /dev/cpuset/system/tasks
mkdir /dev/cpuset/system/performance 0750 root system
write /dev/cpuset/system/performance/cpus 0
write /dev/cpuset/system/performance/mems 0
chown system system /dev/cpuset/system/performance/tasks
chmod 0660 /dev/cpuset/system/performance/tasks
mkdir /dev/cpuset/system/background 0750 root system
write /dev/cpuset/system/background/cpus 0
write /dev/cpuset/system/background/mems 0
chown system system /dev/cpuset/system/background/tasks
chmod 0660 /dev/cpuset/system/background/tasks
mkdir /dev/cpuset/application 0750 root system
write /dev/cpuset/application/cpus 0
write /dev/cpuset/application/mems 0
chown system system /dev/cpuset/application/tasks
chmod 0660 /dev/cpuset/application/tasks
mkdir /dev/cpuset/application/performance 0750 root system
write /dev/cpuset/application/performance/cpus 0
write /dev/cpuset/application/performance/mems 0
chown system system /dev/cpuset/application/performance/tasks
chmod 0660 /dev/cpuset/application/performance/tasks
mkdir /dev/cpuset/application/background 0750 root system
write /dev/cpuset/application/background/cpus 0
write /dev/cpuset/application/background/mems 0
chown system system /dev/cpuset/application/background/tasks
chmod 0660 /dev/cpuset/application/background/tasks
# set default schedTune value for foreground/top-app
write /dev/stune/foreground/schedtune.prefer_idle 1
write /dev/stune/top-app/schedtune.boost 10
write /dev/stune/top-app/schedtune.prefer_idle 1
write /dev/stune/rt/schedtune.boost 30
write /dev/stune/rt/schedtune.prefer_idle 1
# Create UDS structure for base VR services.
mkdir /dev/socket/pdx 0775 system system
mkdir /dev/socket/pdx/system 0775 system system
mkdir /dev/socket/pdx/system/buffer_hub 0775 system system
mkdir /dev/socket/pdx/system/performance 0775 system system
mkdir /dev/socket/pdx/system/vr 0775 system system
mkdir /dev/socket/pdx/system/vr/display 0775 system system
mkdir /dev/socket/pdx/system/vr/pose 0775 system system
mkdir /dev/socket/pdx/system/vr/sensors 0775 system system
# ZRAM setup
write /sys/block/zram0/comp_algorithm lz4
write /proc/sys/vm/page-cluster 0
on fs
# Start HW service manager early
start hwservicemanager
mount_all /vendor/etc/fstab.${ro.hardware} --early
# Keeping following partitions outside fstab file. As user may not have
# these partition flashed on the device. Failure to mount any partition in fstab file
# results in failure to launch late-start class.
wait /dev/block/platform/soc/624000.ufshc/sda18
mount ext4 /dev/block/platform/soc/624000.ufshc/by-name/cache /cache nosuid nodev noatime barrier=1
restorecon_recursive /persist
mkdir /persist/data 0700 system system
# for [email protected] cycle count backup
mkdir /persist/battery 0700 system system
on post-fs
symlink /dev/block/platform/soc.0/f9824900.sdhci /dev/block/bootdevice
# Wait qseecomd started
wait_for_prop sys.listeners.registered true
on late-fs
# Start devices by sysfs trigger
start vendor.devstart_sh
# Start services for bootanim
start surfaceflinger
start bootanim
start vendor.hwcomposer-2-1
start vendor.configstore-hal
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.${ro.hardware} --late
# boot time fs tune
write /sys/block/sda/queue/iostats 0
write /sys/block/sda/queue/scheduler fiops
write /sys/block/sda/queue/iosched/slice_idle 0
write /sys/block/sda/queue/read_ahead_kb 2048
write /sys/block/sda/queue/nr_requests 256
write /sys/block/sda/queue/add_random 1
write /sys/block/dm-0/queue/read_ahead_kb 2048
write /sys/block/dm-1/queue/read_ahead_kb 2048
# Start time daemon early so that the system time can be set early
start vendor.time_daemon
on post-fs-data
# We can start netd here before in is launched in common init.rc on zygote-start
start netd
# Set sku property
start vendor.mid_sh
# Wait until the system time is set
wait_for_prop sys.time.set true
# b/36601397 Setup debug folders for camera
mkdir /data/vendor/camera 0770 camera camera
# zygote need to be started after otapreopt which will be done on post-fs-data
on zygote-start
# zygote is started in common init.rc
# and now we can continue initialize /data/
mkdir /data/tombstones 0771 system system
mkdir /tombstones/modem 0771 system system
mkdir /tombstones/lpass 0771 system system
mkdir /tombstones/wcnss 0771 system system
mkdir /tombstones/dsps 0771 system system
mkdir /persist/data/sfs 0700 system system
mkdir /persist/data/tz 0700 system system
mkdir /data/misc/dts 0770 media audio
mkdir /data/misc/tloc/ 0700 system drmrpc
mkdir /data/misc/qvop 0660 system system
mkdir /data/misc/audio_pp 0771 media audio
mkdir /data/preloads 0775 system system
mkdir /data/preloads/media 0775 system system
mkdir /data/preloads/demo 0775 system system
mkdir /data/misc/netmgr 0770 system radio
# Disable verbosity for sensorhub
write /d/sps/debug_level_option 4
write /d/sps/log_level_sel 4
# Write to the base address of BAM pipe
write /d/sps/bam_addr 122961920
# Create directory for TZ Apps
mkdir /data/misc/qsee 0770 system system
mkdir /data/media 0770 media_rw media_rw
chown media_rw media_rw /data/media
mkdir /data/misc/ipa 0700 net_admin net_admin
# Create the directories used by the Wireless subsystem
mkdir /data/misc/wifi 0770 wifi wifi
mkdir /data/misc/wifi/wpa_supplicant 0770 wifi wifi
mkdir /data/vendor/wifi 0771 wifi wifi
mkdir /data/vendor/wifi/wpa 0770 wifi wifi
mkdir /data/vendor/wifi/wpa/sockets 0770 wifi wifi
mkdir /data/misc/dhcp 0770 dhcp dhcp
chown dhcp dhcp /data/misc/dhcp
# Create port-bridge log dir
mkdir /data/misc/port_bridge 0770 radio radio
chmod 0770 /data/misc/port_bridge
# Create the directories used by CnE subsystem
mkdir /data/connectivity 0771 system system
chown system system /data/connectivity
# Create the directories used by DPM subsystem
mkdir /data/dpm 0771 system system
chown system system /data/dpm
mkdir /data/dpm/nsrm 0771 system system
chown system system /data/dpm/nsrm
# Create directory used by audio subsystem
mkdir /data/vendor/audio 0770 audio audio
# Create directory for audio delta files
mkdir /data/vendor/audio/acdbdata 0770 media audio
mkdir /data/vendor/audio/acdbdata/delta 0770 media audio
# Create directory used by the DASH client
mkdir /data/misc/dash 0770 media audio
# Create directory used by display clients
mkdir /data/misc/display 0770 system graphics
mkdir /persist/display 0770 system graphics
# Mounting of persist is moved to 'on emmc-fs' and 'on fs' sections
# We chown/chmod /persist again so because mount is run as root + defaults
chown system system /persist
chmod 0771 /persist
chmod 0664 /sys/devices/platform/msm_sdcc.1/polling
chmod 0664 /sys/devices/platform/msm_sdcc.2/polling
chmod 0664 /sys/devices/platform/msm_sdcc.3/polling
chmod 0664 /sys/devices/platform/msm_sdcc.4/polling
# Chown polling nodes as needed from UI running on system server
chown system system /sys/devices/platform/msm_sdcc.1/polling
chown system system /sys/devices/platform/msm_sdcc.2/polling
chown system system /sys/devices/platform/msm_sdcc.3/polling
chown system system /sys/devices/platform/msm_sdcc.4/polling
# Create the symlink to qcn wpa_supplicant folder for ar6000 wpa_supplicant
mkdir /data/system 0775 system system
# Create directories for Location services
mkdir /data/misc/location 0770 gps gps
mkdir /data/misc/location/mq 0770 gps gps
mkdir /data/misc/location/xtwifi 0770 gps gps
mkdir /data/misc/location/gpsone_d 0770 system gps
mkdir /data/misc/location/quipc 0770 gps system
mkdir /data/misc/location/gsiff 0770 gps gps
# migrating the GNSS hal to vendor requires this to be relabeled; the
# directory itself is created by /vendor/bin/xtra-daemon
chown gps gps /data/misc/location/xtra
chmod 0750 /data/misc/location/xtra
chown gps gps /data/misc/location/xtra/socket_hal_xtra
chmod 0660 /data/misc/location/xtra/socket_hal_xtra
chown gps gps /data/misc/location/xtra/xtra.sqlite
# Create directory from IMS services
mkdir /data/shared 0755
chown system system /data/shared
# Create directory for FOTA
mkdir /data/fota 0771
chown system system /data/fota
# Create /data/time folder for time-services
mkdir /data/time/ 0700 system system
mkdir /data/audio/ 0770 media audio
# Create a folder for audio delta files
mkdir /data/audio/acdbdata 0770 media audio
mkdir /data/audio/acdbdata/delta 0770 media audio
setprop vold.post_fs_data_done 1
# Create FM dir for patchdownloader
mkdir /data/misc/fm 0770 system system
chmod 0770 /data/misc/fm
# RIDL data
mkdir /data/misc/SelfHost/ 0710 system shell
mkdir /data/misc/SelfHost/QCLogs/ 2750 system shell
mkdir /data/misc/SelfHost/QCLogs/temp/ 0700 system shell
mkdir /data/misc/SelfHost/storage/ 0700 system shell
mkdir /data/misc/SelfHost/Running/ 2750 system shell
mkdir /data/misc/SelfHost/socket/ 2770 system system
# Create PERFD deamon related dirs
setprop ro.min_freq_0 384000
mkdir /data/misc/perfd 0755 root system
chmod 2755 /data/misc/perfd
mkdir /data/system/perfd 0770 root system
rm /data/system/perfd/default_values
chmod 2770 /data/system/perfd
# NFC local data and nfcee xml storage
mkdir /data/vendor/nfc 0770 nfc nfc
# Create IOP deamon related dirs
mkdir /data/misc/iop 0770 root system
# Mark the copy complete flag to not completed
write /data/misc/radio/copy_complete 0
chown radio radio /data/misc/radio/copy_complete
chmod 0660 /data/misc/radio/copy_complete
# File flags for prebuilt ril db file
write /data/misc/radio/prebuilt_db_support 1
chown radio radio /data/misc/radio/prebuilt_db_support
chmod 0400 /data/misc/radio/prebuilt_db_support
write /data/misc/radio/db_check_done 0
chown radio radio /data/misc/radio/db_check_done
chmod 0660 /data/misc/radio/db_check_done
chown system system /sys/class/kgsl/kgsl-3d0/devfreq/max_freq
chmod 0660 /sys/class/kgsl/kgsl-3d0/devfreq/max_freq
chown system system /sys/class/kgsl/kgsl-3d0/devfreq/min_freq
chmod 0660 /sys/class/kgsl/kgsl-3d0/devfreq/min_freq
chown system system /sys/class/devfreq/soc:qcom,gpubw/min_freq
chmod 0660 /sys/class/devfreq/soc:qcom,gpubw/min_freq
chown system system /sys/class/timed_output/vibrator/voltage_level
chmod 0664 /sys/class/timed_output/vibrator/voltage_level
chown system system /sys/module/msm_thermal/parameters/enabled
chmod 0664 /sys/module/msm_thermal/parameters/enabled
# Set schedutil permissions
write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor "schedutil"
write /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor "schedutil"
write /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor "schedutil"
write /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor "schedutil"
chown system system /sys/devices/system/cpu/cpu0/cpufreq/schedutil/up_rate_limit_us
chown system system /sys/devices/system/cpu/cpu1/cpufreq/schedutil/up_rate_limit_us
chown system system /sys/devices/system/cpu/cpu2/cpufreq/schedutil/up_rate_limit_us
chown system system /sys/devices/system/cpu/cpu3/cpufreq/schedutil/up_rate_limit_us
chown system system /sys/devices/system/cpu/cpu0/cpufreq/schedutil/down_rate_limit_us
chown system system /sys/devices/system/cpu/cpu1/cpufreq/schedutil/down_rate_limit_us
chown system system /sys/devices/system/cpu/cpu2/cpufreq/schedutil/down_rate_limit_us
chown system system /sys/devices/system/cpu/cpu3/cpufreq/schedutil/down_rate_limit_us
chown system system /sys/devices/system/cpu/cpu0/cpufreq/schedutil/iowait_boost_enable
chown system system /sys/devices/system/cpu/cpu1/cpufreq/schedutil/iowait_boost_enable
chown system system /sys/devices/system/cpu/cpu2/cpufreq/schedutil/iowait_boost_enable
chown system system /sys/devices/system/cpu/cpu3/cpufreq/schedutil/iowait_boost_enable
chmod 0664 /sys/devices/system/cpu/cpu0/cpufreq/schedutil/up_rate_limit_us
chmod 0664 /sys/devices/system/cpu/cpu1/cpufreq/schedutil/up_rate_limit_us
chmod 0664 /sys/devices/system/cpu/cpu2/cpufreq/schedutil/up_rate_limit_us
chmod 0664 /sys/devices/system/cpu/cpu3/cpufreq/schedutil/up_rate_limit_us
chmod 0664 /sys/devices/system/cpu/cpu0/cpufreq/schedutil/down_rate_limit_us
chmod 0664 /sys/devices/system/cpu/cpu1/cpufreq/schedutil/down_rate_limit_us
chmod 0664 /sys/devices/system/cpu/cpu2/cpufreq/schedutil/down_rate_limit_us
chmod 0664 /sys/devices/system/cpu/cpu3/cpufreq/schedutil/down_rate_limit_us
chmod 0664 /sys/devices/system/cpu/cpu0/cpufreq/schedutil/iowait_boost_enable
chmod 0664 /sys/devices/system/cpu/cpu1/cpufreq/schedutil/iowait_boost_enable
chmod 0664 /sys/devices/system/cpu/cpu2/cpufreq/schedutil/iowait_boost_enable
chmod 0664 /sys/devices/system/cpu/cpu3/cpufreq/schedutil/iowait_boost_enable
on early-boot
# set RLIMIT_MEMLOCK to 64MB
setrlimit 8 67108864 67108864
# Allow subsystem (modem etc) debugging
write /sys/module/subsystem_restart/parameters/enable_debug ${persist.sys.ssr.enable_debug}
write /sys/module/pil_msa/parameters/pbl_mba_boot_timeout_ms ${persist.sys.mba_boot_timeout}
write /sys/module/pil_msa/parameters/modem_auth_timeout_ms ${persist.sys.modem_auth_timeout}
write /sys/module/peripheral_loader/parameters/proxy_timeout_ms ${persist.sys.pil_proxy_timeout}
# access permission for secure touch
chmod 0660 /sys/devices/soc/75ba000.i2c/i2c-12/12-004a/secure_touch_enable
chmod 0440 /sys/devices/soc/75ba000.i2c/i2c-12/12-004a/secure_touch
chmod 0664 /sys/devices/virtual/graphics/fb0/msm_cmd_autorefresh_en
chown system graphics /sys/devices/virtual/graphics/fb0/msm_cmd_autorefresh_en
chown system drmrpc /sys/devices/soc/75ba000.i2c/i2c-12/12-004a/secure_touch_enable
chown system drmrpc /sys/devices/soc/75ba000.i2c/i2c-12/12-004a/secure_touch
# Permission for laser sensor driver
chown camera camera /sys/class/htc_laser/laser/enable_ps_sensor
# Permission for LED driver
chown system system /sys/class/leds/red/on_off_ms
chown system system /sys/class/leds/green/on_off_ms
chown system system /sys/class/leds/blue/on_off_ms
chown system system /sys/class/leds/red/rgb_start
chown system system /sys/class/leds/green/rgb_start
chown system system /sys/class/leds/blue/rgb_start
chown system system /sys/class/leds/lcd-backlight/low_persistence
# Permission for vibrator amplitude
chown system system /sys/class/timed_output/vibrator/voltage_level
# wait for devices
wait_for_prop sys.qcom.devup 1
# vendor.health-hal needs to be able to RW
chown system system /sys/devices/soc/qpnp-fg-17/cycle_counts_bins
# HardwareInfo needs to be able to read CC bins
chmod 644 /sys/devices/soc/qpnp-fg-17/cycle_counts_bins
# dumpstate needs to read, vendor.health-hal needs to be able to RW
chown system system /sys/devices/soc/qpnp-fg-17/power_supply/bms/charge_full
# HardwareInfo needs to be able to read charge_full
chmod 644 /sys/devices/soc/qpnp-fg-17/power_supply/bms/charge_full
on boot
# Set swappiness and cache pressure
write /proc/sys/vm/swappiness 5
write /proc/sys/vm/vfs_cache_pressure 10
# bring back main cores CPU 0,2
write /sys/devices/system/cpu/cpu0/online 1
write /sys/devices/system/cpu/cpu2/online 1
# setting the min/max frequency of silver cores
write /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq 307200
write /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq 1593600
# setting the min/max frequency of gold cores
write /sys/devices/system/cpu/cpu2/cpufreq/scaling_min_freq 307200
write /sys/devices/system/cpu/cpu2/cpufreq/scaling_max_freq 2150400
# configure governor settings for silver cluster
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 500
write /sys/devices/system/cpu/cpu0/cpufreq/schedutil/iowait_boost_enable 1
# configure governor settings for gold cluster
write /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor "schedutil"
write /sys/devices/system/cpu/cpu2/cpufreq/schedutil/up_rate_limit_us 500
write /sys/devices/system/cpu/cpu2/cpufreq/schedutil/down_rate_limit_us 500
write /sys/devices/system/cpu/cpu2/cpufreq/schedutil/iowait_boost_enable 1
# msm_thermal
write /sys/module/msm_thermal/parameters/enabled 0
# Setting b.L scheduler parameters
write /proc/sys/kernel/sched_migration_fixup 1
write /proc/sys/kernel/sched_upmigrate 95
write /proc/sys/kernel/sched_downmigrate 90
write /proc/sys/kernel/sched_freq_inc_notify 400000
write /proc/sys/kernel/sched_freq_dec_notify 400000
write /proc/sys/kernel/sched_spill_nr_run 3
write /proc/sys/kernel/sched_init_task_load 100
# WALT default
write /proc/sys/kernel/sched_use_walt_cpu_util 1
write /proc/sys/kernel/sched_use_walt_task_util 1
# CDG congestion control
write /proc/sys/net/ipv4/tcp_congestion_control cdg
# Exec init.foreground.sh in background
start vendor.foreground_sh
# add a cpuset for the camera daemon
# we want all cores for camera
mkdir /dev/cpuset/camera-daemon
write /dev/cpuset/camera-daemon/cpus 0-3
write /dev/cpuset/camera-daemon/mems 0
chown system system /dev/cpuset/camera-daemon
chown system system /dev/cpuset/camera-daemon/tasks
chmod 0664 /dev/cpuset/camera-daemon/tasks
# Update DVR cpusets to boot-time values.
write /dev/cpuset/kernel/cpus 0-3
write /dev/cpuset/system/cpus 0-3
write /dev/cpuset/system/performance/cpus 0-3
write /dev/cpuset/system/background/cpus 0-3
write /dev/cpuset/system/cpus 0-3
write /dev/cpuset/application/cpus 0-3
write /dev/cpuset/application/performance/cpus 0-3
write /dev/cpuset/application/background/cpus 0-3
write /dev/cpuset/application/cpus 0-3
# Bluetooth
chown bluetooth bluetooth /sys/module/bluetooth_power/parameters/power
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 bluetooth bluetooth /sys/module/hci_uart/parameters/ath_lpm
chown bluetooth bluetooth /sys/module/hci_uart/parameters/ath_btwrite
chown system system /sys/module/sco/parameters/disable_esco
chown bluetooth bluetooth /sys/module/hci_smd/parameters/hcismd_set
chown system system /sys/module/radio_iris_transport/parameters/fmsmd_set
chmod 0660 /sys/module/bluetooth_power/parameters/power
chmod 0660 /sys/module/hci_smd/parameters/hcismd_set
chmod 0660 /sys/module/radio_iris_transport/parameters/fmsmd_set
chmod 0660 /sys/class/rfkill/rfkill0/state
chmod 0660 /proc/bluetooth/sleep/proto
chown bluetooth net_bt /dev/ttyHS0
chmod 0660 /sys/module/hci_uart/parameters/ath_lpm
chmod 0660 /sys/module/hci_uart/parameters/ath_btwrite
chmod 0660 /dev/ttyHS0
chown bluetooth bluetooth /sys/devices/platform/msm_serial_hs.0/clock
chmod 0660 /sys/devices/platform/msm_serial_hs.0/clock
chmod 0660 /dev/ttyHS2
chown bluetooth bluetooth /dev/ttyHS2
chown bluetooth net_bt /sys/class/rfkill/rfkill0/device/extldo
chmod 0660 /sys/class/rfkill/rfkill0/device/extldo
# Create QMUX deamon socket area
mkdir /dev/socket/qmux_radio 0770 radio radio
chmod 2770 /dev/socket/qmux_radio
mkdir /dev/socket/qmux_audio 0770 media audio
chmod 2770 /dev/socket/qmux_audio
mkdir /dev/socket/qmux_bluetooth 0770 bluetooth bluetooth
chmod 2770 /dev/socket/qmux_bluetooth
mkdir /dev/socket/qmux_gps 0770 gps gps
chmod 2770 /dev/socket/qmux_gps
mkdir /persist/drm 0770 system system
# Create NETMGR daemon socket area
mkdir /dev/socket/netmgr 0750 radio radio
setprop wifi.interface wlan0
setprop ro.telephony.call_ring.multiple false
# Remove SUID bit for iproute2 ip tool
chmod 0755 /system/bin/ip
chmod 0444 /sys/devices/platform/msm_hsusb/gadget/usb_state
# For bridgemgr daemon to inform the USB driver of the correct transport
chown radio radio /sys/class/android_usb/f_rmnet_smd_sdio/transport
# For port-bridge daemon
chown radio radio /dev/at_mdm0
chown radio radio /dev/at_usb0
setprop net.tcp.2g_init_rwnd 10
# Assign TCP buffer thresholds to be ceiling value of technology maximums
# Increased technology maximums should be reflected here.
write /proc/sys/net/core/rmem_max 8388608
write /proc/sys/net/core/wmem_max 8388608
# To prevent out of order acknowledgements from making
# connection tracking to treat them as not belonging to
# the connection they belong to.
# Otherwise, a weird issue happens in which some long
# connections on high-throughput links get dropped when
# an ack packet comes out of order
write /proc/sys/net/netfilter/nf_conntrack_tcp_be_liberal 1
# Allow access for CCID command/response timeout configuration
chown system system /sys/module/ccid_bridge/parameters/bulk_msg_timeout
# bond0 used by FST Manager
chown wifi wifi /sys/class/net/bond0/bonding/queue_id
write /proc/sys/net/ipv6/conf/default/accept_ra_defrtr 1
# bluetooth init
setprop ro.qualcomm.bluetooth.opp true
setprop ro.qualcomm.bluetooth.hfp true
setprop ro.qualcomm.bluetooth.hsp true
setprop ro.qualcomm.bluetooth.pbap true
setprop ro.qualcomm.bluetooth.ftp true
setprop ro.qualcomm.bluetooth.nap true
setprop ro.bluetooth.sap true
setprop ro.bluetooth.dun true
setprop ro.qualcomm.bluetooth.map true
setprop ro.bluetooth.hfp.ver 1.6
# Wifi firmware reload path
chown wifi wifi /sys/module/wlan/parameters/fwpath
# QCOM FG SRAM dump for dumpstate
chown system system /d/fg_memif/data
chown system system /d/fg_memif/count
chown system system /d/fg_memif/address
# Set vibrate
write /sys/class/timed_output/vibrator/voltage_level 3199
# Power efficient workqueue
chmod 0644 /sys/module/workqueue/parameters/power_efficient
write /sys/module/workqueue/parameters/power_efficient Y
# Hi-perf audio
write /sys/module/snd_soc_wcd9330/parameters/high_perf_mode 1
# Backlight dimmer
write /sys/module/mdss_fb/parameters/backlight_dimmer 1
# Dynamic stune boost
write /sys/module/cpu_boost/parameters/dynamic_stune_boost 1
write /sys/module/cpu_boost/parameters/input_boost_freq "0:537600 1:0 2:537600 3:0"
write /sys/module/cpu_boost/parameters/input_boost_ms 80
on property:wc_transport.start_hci=true
start vendor.start_hci_filter
on property:wc_transport.start_hci=false
stop vendor.start_hci_filter
service vendor.start_hci_filter /vendor/bin/wcnss_filter
class late_start
user bluetooth
group bluetooth diag
disabled
on property:wc_transport.start_root=true
start vendor.hci_filter_root
on property:wc_transport.start_root=false
stop vendor.hci_filter_root
service vendor.hci_filter_root /vendor/bin/wcnss_filter
class late_start
user bluetooth
group bluetooth diag system
disabled
service vendor.per_mgr /vendor/bin/pm-service
class core
user system
group system
ioprio rt 4
service vendor.per_proxy /vendor/bin/pm-proxy
class core
user system
group system
disabled
on property:ro.build.type=userdebug
write /sys/class/uio/uio1/device/rtel/rtel 1
on property:init.svc.vendor.per_mgr=running
start vendor.per_proxy
on property:sys.uidcpupower=*
write /proc/uid_cpupower/enable 1
on property:sys.uidcpupower=0
write /proc/uid_cpupower/enable 0
on property:sys.shutdown.requested=*
stop vendor.per_proxy
# Disable subsystem restart
write /sys/module/subsystem_restart/parameters/disable_restart_work 0x9889deed
service vendor.qseecomd /vendor/bin/qseecomd
class core
user root
group root
service vendor.thermal-engine /vendor/bin/thermal-engine -c ${sys.qcom.thermalcfg:-/vendor/etc/thermal-engine.conf}
class hal
user root
group root system diag
socket thermal-send-client stream 0666 system system
socket thermal-recv-client stream 0660 system system
socket thermal-recv-passive-client stream 0666 system system
service vendor.time_daemon /vendor/bin/time_daemon
class core
user root
group root
service vendor.adsprpcd /vendor/bin/adsprpcd
class main
user media
group media
service vendor.imsqmidaemon /vendor/bin/imsqmidaemon
class main
user system
socket ims_qmid stream 0660 system radio
group radio log diag
service vendor.imsdatadaemon /vendor/bin/imsdatadaemon
class main
user system
socket ims_datad stream 0660 system radio
group system wifi radio inet log diag
disabled
on property:sys.ims.QMI_DAEMON_STATUS=1
start vendor.imsdatadaemon
service vendor.ims_rtp_daemon /vendor/bin/ims_rtp_daemon
class main
user system
socket ims_rtpd stream 0660 system radio
group radio diag inet log
disabled
on property:sys.ims.DATA_DAEMON_STATUS=1
start vendor.ims_rtp_daemon
service vendor.ssr_setup /vendor/bin/ssr_setup
class main
user root
group root system
oneshot
service vendor.ss_ramdump /vendor/bin/subsystem_ramdump
class main
user root
group root system
disabled
on property:persist.sys.ssr.enable_ramdumps=1
write /sys/module/subsystem_restart/parameters/enable_ramdumps 1
mkdir /data/vendor/ramdump 761 root system
mkdir /data/vendor/ssrdump 771 root system
start vendor.ss_ramdump
on property:persist.sys.ssr.enable_ramdumps=0
write /sys/module/subsystem_restart/parameters/enable_ramdumps 0
service iop /system/bin/iop
class main
user root
group root
disabled
service vendor.cnd /vendor/bin/cnd
user root
group root inet wakelock
class late_start
socket cnd stream 660 root inet
service vendor.irsc_util /vendor/bin/irsc_util "/vendor/etc/sec_config"
class core
user root
oneshot
service vendor.rmt_storage /vendor/bin/rmt_storage
class core
user root
group root system wakelock
ioprio rt 0
shutdown critical
service vendor.port-bridge /vendor/bin/port-bridge
class main
user radio
group radio system inet
oneshot
service vendor.qmiproxy /vendor/bin/qmiproxy
class main
user radio
group radio diag
disabled
service vendor.netmgrd /vendor/bin/netmgrd
class main
user root
group root wifi wakelock radio inet
service wpa_supplicant /vendor/bin/hw/wpa_supplicant \
-O/data/vendor/wifi/wpa/sockets -puse_p2p_group_interface=1 \
-g@android:wpa_wlan0
# we will start as root and wpa_supplicant will switch to user wifi
# after setting up the capabilities required for WEXT
# user wifi
# group wifi inet keystore
interface [email protected]::ISupplicant default
interface [email protected]::ISupplicant default
class main
socket wpa_wlan0 dgram 660 wifi wifi
disabled
oneshot
service vendor.cnss-daemon /vendor/bin/cnss-daemon -n -l
class late_start
user system
group system inet wifi
service vendor.loc_launcher /vendor/bin/loc_launcher
#loc_launcher will start as root and set its uid to gps
class late_start
group gps inet diag wifi
service vendor.init-radio-sh /vendor/bin/init.radio.sh
class late_start
user radio
group root radio
oneshot
service vendor.msm_irqbalance /vendor/bin/msm_irqbalance -f /vendor/etc/msm_irqbalance.conf
socket msm_irqbalance seqpacket 660 root system
class core
user root
group root
writepid /dev/cpuset/system-background/tasks
service vendor.atfwd /vendor/bin/ATFWD-daemon
class late_start
user system
group system radio
disabled
service vendor.ssr_diag /vendor/bin/ssr_diag
class late_start
user system
group system
disabled
service vendor.diag_mdlog_start /vendor/bin/diag_mdlog
class late_start
user shell
group system diag sdcard_rw sdcard_r media_rw
disabled
oneshot
service vendor.diag_mdlog_stop /vendor/bin/diag_mdlog -k
class late_start
user shell
group system diag sdcard_rw sdcard_r media_rw
disabled
oneshot
service vendor.perfd /vendor/bin/perfd
class main
user root
group root system
writepid /dev/cpuset/system-background/tasks
disabled
# bugreport is triggered by holding down volume down, volume up and power
service bugreport /system/bin/dumpstate -d -p -B -z \
-o /data/user_de/0/com.android.shell/files/bugreports/bugreport
class main
disabled
oneshot
on property:sys.post_boot.parsed=1
start vendor.perfd
on property:sys.boot_completed=1
start vendor.power_sh
# Enable UFS powersaving
write /sys/devices/soc/624000.ufshc/clkscale_enable 1
write /sys/devices/soc/624000.ufshc/clkgate_enable 1
write /sys/devices/soc/624000.ufshc/624000.ufshc:ufs_variant/pm_qos_enable 1
write /sys/module/lpm_levels/parameters/sleep_disabled N
# update cpusets now that boot is complete and we want better load balancing
write /dev/cpuset/top-app/cpus 0-3
write /dev/cpuset/foreground/cpus 0-2
write /dev/cpuset/background/cpus 0
write /dev/cpuset/system-background/cpus 0-2
write /dev/cpuset/restricted/cpus 0-1
# Update DVR cpusets to runtime values.
write /dev/cpuset/kernel/cpus 0,1
write /dev/cpuset/system/performance/cpus 2
write /dev/cpuset/system/background/cpus 0
write /dev/cpuset/system/cpus 0,2
write /dev/cpuset/application/performance/cpus 3
write /dev/cpuset/application/background/cpus 1
write /dev/cpuset/application/cpus 1,3
# UFS health
chmod 755 /sys/kernel/debug/ufshcd0
chmod 644 /sys/kernel/debug/ufshcd0/err_state
chmod 644 /sys/kernel/debug/ufshcd0/power_mode
chmod 644 /sys/kernel/debug/ufshcd0/host_regs
chmod 644 /sys/kernel/debug/ufshcd0/show_hba
chmod 644 /sys/kernel/debug/ufshcd0/dump_device_desc
chmod 755 /sys/kernel/debug/ufshcd0/stats
chmod 644 /sys/kernel/debug/ufshcd0/stats/req_stats
chmod 644 /sys/kernel/debug/ufshcd0/stats/query_stats
chmod 644 /sys/kernel/debug/ufshcd0/stats/err_stats
# Used immediately below
trigger sys-boot-completed-set
# We want one opportunity per boot to enable zram, so we
# use a trigger we fire from the above stanza. If
# persist.sys.zram_enabled becomes true after boot,
# we don't want to run swapon_all at that time.
on sys-boot-completed-set && property:persist.sys.zram_enabled=1
swapon_all /vendor/etc/fstab.${ro.hardware}
on property:sys.boot_completed=1 && property:ro.build.type=user
write /proc/sys/kernel/modules_disabled 1
## charger driver exposes now finer grain control, map demo mode to those properties
# demo mode can only be exit wipping data which will also reset the persist properties
on property:sys.retaildemo.enabled=1
setprop persist.vendor.charge.stop.level 35
setprop persist.vendor.charge.start.level 30
# system will not set the sys.retaildemo.enabled to 0 but this is used to set back to default charging
on property:sys.retaildemo.enabled=0
setprop persist.vendor.charge.stop.level 100
setprop persist.vendor.charge.start.level 0
on property:persist.vendor.charge.stop.level=*
write /sys/module/htc_battery/parameters/charge_stop_level ${persist.vendor.charge.stop.level}
on property:persist.vendor.charge.start.level=*
write /sys/module/htc_battery/parameters/charge_start_level ${persist.vendor.charge.start.level}
service vendor.devstart_sh /vendor/bin/init.qcom.devstart.sh
class main
user root
group root system
disabled
oneshot
service vendor.foreground_sh /vendor/bin/init.foreground.sh
class main
user root
group root system readproc
disabled
oneshot
service vendor.power_sh /vendor/bin/init.power.sh
class main
user root
group root system
disabled
oneshot
service vendor.mid_sh /vendor/bin/init.mid.sh
class main
user root
group root system
disabled
oneshot
# reset thermal-engine when framework dies in VR mode
on property:init.svc.zygote=restarting && property:sys.qcom.thermalcfg=/vendor/etc/thermal-engine-vr.conf
setprop sys.qcom.thermalcfg "/vendor/etc/thermal-engine.conf"
restart vendor.thermal-engine
# b/70518189 vDSO experiments
on property:sys.vdso=*
write /sys/module/vdso/parameters/enable_32 1
write /sys/module/vdso/parameters/enable_64 1
on property:sys.vdso=false
write /sys/module/vdso/parameters/enable_32 0
write /sys/module/vdso/parameters/enable_64 0
on property:sys.vdso=64
write /sys/module/vdso/parameters/enable_32 0
on property:sys.vdso=32
write /sys/module/vdso/parameters/enable_64 0