• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#
2# Copyright (C) 2018 The Android Open-Source Project
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#      http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16
17import /vendor/etc/init/hw/init.${ro.boot.hardware.platform}.usb.rc
18import /vendor/etc/init/hw/init.${ro.boot.hardware.platform}.diag.rc
19import /vendor/etc/init/hw/init.${ro.boot.hardware.platform}.logging.rc
20import /vendor/etc/init/hw/init.${ro.boot.hardware.platform}.mpssrfs.rc
21import /vendor/etc/init/hw/init.${ro.boot.hardware.platform}.power.rc
22
23service vendor.charger /system/bin/charger
24    class charger
25    seclabel u:r:charger:s0
26    user system
27    group system wakelock input
28    capabilities SYS_BOOT
29    file /dev/kmsg w
30    file /sys/fs/pstore/console-ramoops-0 r
31    file /sys/fs/pstore/console-ramoops r
32    file /proc/last_kmsg r
33
34on early-init
35    mount debugfs debugfs /sys/kernel/debug
36    chmod 0755 /sys/kernel/debug
37
38    # configure governor settings
39    write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor schedutil
40    write /sys/devices/system/cpu/cpu0/cpufreq/schedutil/up_rate_limit_us 500
41    write /sys/devices/system/cpu/cpu0/cpufreq/schedutil/down_rate_limit_us 20000
42
43    # configure governor settings for big cluster
44    write /sys/devices/system/cpu/cpu6/cpufreq/scaling_governor schedutil
45    write /sys/devices/system/cpu/cpu6/cpufreq/schedutil/up_rate_limit_us 500
46    write /sys/devices/system/cpu/cpu6/cpufreq/schedutil/down_rate_limit_us 20000
47
48    # configure governor settings for big big CPU
49    write /sys/devices/system/cpu/cpu7/cpufreq/scaling_governor schedutil
50    write /sys/devices/system/cpu/cpu7/cpufreq/schedutil/up_rate_limit_us 500
51    write /sys/devices/system/cpu/cpu7/cpufreq/schedutil/down_rate_limit_us 20000
52
53# Disable VDSO on JAWS boards.
54on early-init && property:ro.revision="DEV1.0"
55    write /sys/module/vdso/parameters/enable_32 0
56
57# Skip init trigger for charger mode
58on early-init && property:ro.boot.mode=charger
59    setprop vendor.skip.init 1
60    # Loading kernel modules in background
61    start charger_insmod_sh
62
63on init && property:vendor.skip.init=0
64    # Boot time cpuset and stune
65    write /dev/cpuset/top-app/cpus 0-7
66    write /dev/cpuset/foreground/cpus 0-7
67    write /dev/cpuset/background/cpus 0-5
68    write /dev/cpuset/system-background/cpus 0-5
69    write /dev/cpuset/restricted/cpus 2-5
70    write /dev/stune/foreground/schedtune.prefer_idle 1
71    write /dev/stune/foreground/schedtune.prefer_high_cap 1
72    write /dev/stune/foreground/schedtune.boost 100
73    write /dev/stune/schedtune.prefer_idle 1
74    write /dev/stune/schedtune.prefer_high_cap 1
75    write /dev/stune/schedtune.boost 100
76    write /dev/stune/top-app/schedtune.prefer_idle 1
77    write /dev/stune/top-app/schedtune.prefer_high_cap 1
78    write /dev/stune/top-app/schedtune.boost 100
79
80    # Boot time fs tuning
81    write /sys/block/sda/queue/iostats 0
82    write /sys/block/sda/queue/scheduler cfq
83    write /sys/block/sda/queue/iosched/slice_idle 0
84    write /sys/block/sda/queue/read_ahead_kb 2048
85    write /sys/block/sda/queue/nr_requests 256
86    write /sys/block/dm-0/queue/read_ahead_kb 2048
87    write /sys/block/dm-1/queue/read_ahead_kb 2048
88    write /sys/block/dm-2/queue/read_ahead_kb 2048
89    write /sys/block/dm-3/queue/read_ahead_kb 2048
90    write /sys/block/dm-4/queue/read_ahead_kb 2048
91    write /sys/block/dm-5/queue/read_ahead_kb 2048
92    write /sys/block/dm-6/queue/read_ahead_kb 2048
93    write /sys/block/dm-7/queue/read_ahead_kb 2048
94    write /sys/block/dm-8/queue/read_ahead_kb 2048
95
96    # Disable UFS powersaving
97    write /sys/devices/platform/soc/${ro.boot.bootdevice}/clkgate_enable 0
98
99    # Disable powersaving
100    write /sys/module/lpm_levels/parameters/sleep_disabled 1
101
102    wait /dev/block/platform/soc/${ro.boot.bootdevice}
103    symlink /dev/block/platform/soc/${ro.boot.bootdevice} /dev/block/bootdevice
104
105    # start qseecomd early as we mount system/ vendor/ early
106    # vold needs keymaster that needs qseecomd
107    start vendor.qseecomd
108    start keymaster-4-0
109
110    start vendor.citadeld
111    start vendor.keymaster-4-1-citadel
112
113    # Loading kernel modules in background
114    start insmod_sh
115
116    # bring back all cores
117    write /sys/devices/system/cpu/cpu0/online 1
118    write /sys/devices/system/cpu/cpu1/online 1
119    write /sys/devices/system/cpu/cpu2/online 1
120    write /sys/devices/system/cpu/cpu3/online 1
121    write /sys/devices/system/cpu/cpu4/online 1
122    write /sys/devices/system/cpu/cpu5/online 1
123    write /sys/devices/system/cpu/cpu6/online 1
124    write /sys/devices/system/cpu/cpu7/online 1
125
126    # ZRAM setup
127    write /sys/block/zram0/comp_algorithm lz4
128    write /proc/sys/vm/page-cluster 0
129
130    # Some user code relies on ro.boot.hardware.revision
131    setprop ro.boot.hardware.revision ${ro.revision}
132
133    mkdir /dev/cpuset/camera-daemon
134    write /dev/cpuset/camera-daemon/cpus 0-7
135    write /dev/cpuset/camera-daemon/mems 0
136    chown system system /dev/cpuset/camera-daemon
137    chown system system /dev/cpuset/camera-daemon/tasks
138    chmod 0664 /dev/cpuset/camera-daemon/tasks
139
140    mkdir /dev/cpuset/camera-daemon-dedicated
141    write /dev/cpuset/camera-daemon-dedicated/cpus 0-7
142    write /dev/cpuset/camera-daemon-dedicated/mems 0
143    chown system system /dev/cpuset/camera-daemon-dedicated
144    chown system system /dev/cpuset/camera-daemon-dedicated/tasks
145    chmod 0664 /dev/cpuset/camera-daemon-dedicated/tasks
146
147    # create an stune group for camera-specific processes
148    mkdir /dev/stune/camera-daemon
149    write /dev/stune/camera-daemon/schedtune.prefer_idle 1
150    write /dev/stune/camera-daemon/schedtune.boost 0
151    chown system system /dev/stune/camera-daemon
152    chown system system /dev/stune/camera-daemon/tasks
153    chmod 0664 /dev/stune/camera-daemon/tasks
154
155    # Allow PAI targeting per hardware SKU
156    setprop ro.oem.key1 ${ro.boot.hardware.sku}
157
158    # Property used by vintf for sku specific manifests
159    # Property used by NFC for sku specific configurations
160    setprop ro.boot.product.hardware.sku ${ro.boot.hardware.sku}
161
162    # Battery Defender
163    chown system system /sys/devices/platform/soc/soc:google,charger/charge_stop_level
164    chown system system /sys/devices/platform/soc/soc:google,charger/charge_start_level
165    chown system system /sys/devices/platform/soc/soc:google,charger/bd_drainto_soc
166    chown system system /sys/devices/platform/soc/soc:google,charger/bd_recharge_soc
167    chown system system /sys/devices/platform/soc/soc:google,charger/bd_recharge_voltage
168    chown system system /sys/devices/platform/soc/soc:google,charger/bd_resume_abs_temp
169    chown system system /sys/devices/platform/soc/soc:google,charger/bd_resume_soc
170    chown system system /sys/devices/platform/soc/soc:google,charger/bd_resume_temp
171    chown system system /sys/devices/platform/soc/soc:google,charger/bd_resume_time
172    chown system system /sys/devices/platform/soc/soc:google,charger/bd_trigger_temp
173    chown system system /sys/devices/platform/soc/soc:google,charger/bd_trigger_time
174    chown system system /sys/devices/platform/soc/soc:google,charger/bd_trigger_voltage
175    chown system system /sys/devices/platform/soc/soc:google,charger/bd_temp_enable
176    chown system system /sys/devices/platform/soc/soc:google,charger/bd_temp_dry_run
177    chown system system /sys/devices/platform/soc/soc:google,battery/power_supply/battery/bd_trickle_enable
178    chown system system /sys/devices/platform/soc/soc:google,battery/power_supply/battery/bd_trickle_recharge_soc
179    chown system system /sys/devices/platform/soc/soc:google,battery/power_supply/battery/bd_trickle_cnt
180    chown system system /sys/devices/platform/soc/soc:google,battery/power_supply/battery/bd_trickle_dry_run
181    chown system system /sys/devices/platform/soc/soc:google,battery/power_supply/battery/bd_trickle_reset_sec
182
183    # report max frequency to unity tasks.
184    write /proc/sys/kernel/sched_lib_name "UnityMain,libunity.so"
185    write /proc/sys/kernel/sched_lib_mask_force 255
186
187    # Charge stats (write 0)
188    chown system system /sys/class/power_supply/battery/charge_stats
189
190    # NFC streset tool name
191    setprop persist.vendor.nfc.streset libstreset
192    setprop persist.vendor.se.streset libstreset
193
194on late-init
195    chown system system /sys/devices/virtual/thermal/tz-by-name/cellular-emergency/trip_point_0_temp
196    chown system system /sys/devices/virtual/thermal/tz-by-name/cellular-emergency/trip_point_0_hyst
197    chown system system /sys/devices/virtual/thermal/tz-by-name/soc/mode
198
199on fs
200    mount_all /vendor/etc/fstab.${ro.boot.hardware.platform} --early
201
202    mkdir /mnt/vendor/persist/audio 0770 media audio
203    mkdir /mnt/vendor/persist/data 0700 system system
204    mkdir /mnt/vendor/persist/display 0770 system graphics
205    mkdir /mnt/vendor/persist/haptics 0770 system system
206    mkdir /mnt/vendor/persist/rfs 0770 root system
207    mkdir /mnt/vendor/persist/hlos_rfs 0770 root system
208    mkdir /mnt/vendor/persist/oslo 0770 system system
209    mkdir /mnt/vendor/persist/touch 0770 system system
210    chmod 0770 /mnt/vendor/persist/rfs
211    chmod 0770 /mnt/vendor/persist/rfs/shared
212    chmod 0770 /mnt/vendor/persist/rfs/msm
213    chmod 0770 /mnt/vendor/persist/rfs/msm/adsp
214    chmod 0770 /mnt/vendor/persist/rfs/msm/mpss
215    chmod 0770 /mnt/vendor/persist/rfs/msm/slpi
216    chmod 0770 /mnt/vendor/persist/rfs/mdm
217    chmod 0770 /mnt/vendor/persist/rfs/mdm/adsp
218    chmod 0770 /mnt/vendor/persist/rfs/mdm/mpss
219    chmod 0770 /mnt/vendor/persist/rfs/mdm/slpi
220    chmod 0770 /mnt/vendor/persist/rfs/mdm/tn
221    chmod 0770 /mnt/vendor/persist/rfs/apq
222    chmod 0770 /mnt/vendor/persist/rfs/apq/gnss
223    chmod 0770 /mnt/vendor/persist/hlos_rfs
224
225    # for cycle count backup
226    mkdir /mnt/vendor/persist/battery 0700 system system
227
228    # Set up sensors-related directories and permissions
229    chmod 775 /mnt/vendor/persist/sensors
230    chmod 664 /mnt/vendor/persist/sensors/sensors_settings
231    chmod 775 /mnt/vendor/persist/sensors/registry
232    chmod 775 /mnt/vendor/persist/sensors/registry/registry
233    chmod 775 /mnt/vendor/persist/sensors/registry/factory_data
234    chmod 664 /mnt/vendor/persist/sensors/registry/factory_data/sns_fac_registry
235    chmod 664 /mnt/vendor/persist/sensors/registry/registry/sensors_registry
236
237    restorecon_recursive /mnt/vendor/persist
238
239    # Set up camera-related directories and permissions
240    # Add restorecon_recursive command to make sure the restorecon label is persist_camera_file.
241    restorecon_recursive /mnt/vendor/persist/camera
242
243on post-fs
244    # set RLIMIT_MEMLOCK to 64MB
245    setrlimit 8 67108864 67108864
246
247    # Wait qseecomd started
248    wait_for_prop vendor.sys.listeners.registered true
249
250    # load IPA FWs
251    # This must be started when vendor.sys.listeners.registered is true
252    write /dev/ipa 1
253
254on late-fs
255    # Start services for bootanim
256    #start color_init
257    #wait_for_prop vendor.display.native_display_primaries_ready 1
258    #setprop ro.surface_flinger.display_primary_red ${vendor.display.primary_red}
259    #setprop ro.surface_flinger.display_primary_green ${vendor.display.primary_green}
260    #setprop ro.surface_flinger.display_primary_blue ${vendor.display.primary_blue}
261    #setprop ro.surface_flinger.display_primary_white ${vendor.display.primary_white}
262    # Permission for hwcomposer
263    chown system system /sys/devices/platform/soc/soc:qcom,dsi-display-primary/gamma
264    start surfaceflinger
265    start bootanim
266    start vendor.qti.hardware.display.composer
267    start vendor.qti.hardware.display.allocator
268
269    # Wait for keymaster HALs (TEE and StrongBox)
270    exec_start wait_for_strongbox
271
272
273    # Mount RW partitions which need run fsck
274    mount_all /vendor/etc/fstab.${ro.boot.hardware.platform} --late
275    # Boot time fs tune
276    write /sys/block/dm-9/queue/read_ahead_kb 2048
277
278    # Required for time_daemon
279    mkdir /mnt/vendor/persist/time 0770 system system
280    chown system system /mnt/vendor/persist/time/ats_1
281    chown system system /mnt/vendor/persist/time/ats_2
282    chown system system /mnt/vendor/persist/time/ats_3
283    chown system system /mnt/vendor/persist/time/ats_4
284    chown system system /mnt/vendor/persist/time/ats_5
285    chown system system /mnt/vendor/persist/time/ats_6
286    chown system system /mnt/vendor/persist/time/ats_7
287    chown system system /mnt/vendor/persist/time/ats_8
288    chown system system /mnt/vendor/persist/time/ats_9
289    chown system system /mnt/vendor/persist/time/ats_10
290    chown system system /mnt/vendor/persist/time/ats_11
291    chown system system /mnt/vendor/persist/time/ats_12
292    chown system system /mnt/vendor/persist/time/ats_13
293    chown system system /mnt/vendor/persist/time/ats_14
294    chown system system /mnt/vendor/persist/time/ats_15
295    chown system system /mnt/vendor/persist/time/ats_16
296
297    # Init sensor specific services
298    start init-sensors-sh
299
300    # Start the twoshay touch service
301    start twoshay
302
303    # turn off vblank irq immediately after turning off
304    write /sys/module/drm/parameters/vblankoffdelay -1
305
306    # Write build info to kdebuginfo.
307    write /sys/module/kdebuginfo/parameters/build_info "${ro.product.name}-${ro.build.type} ${ro.build.version.incremental}"
308
309on post-fs-data
310    mkdir /vendor/data/tombstones 0771 system system
311    mkdir /tombstones/modem 0771 system system
312    mkdir /tombstones/lpass 0771 system system
313    mkdir /tombstones/wcnss 0771 system system
314    mkdir /tombstones/dsps 0771 system system
315    mkdir /data/vendor/hbtp 0750 system system
316    mkdir /data/vendor/tloc 0700 system drmrpc
317    mkdir /data/vendor/nnhal 0700 system system
318    mkdir /data/vendor/time 0770 system system
319    mkdir /data/vendor/modem_fdr 0700 root system
320    mkdir /data/vendor/display 0770 system graphics
321    mkdir /data/vendor/camera 0770 system system
322    mkdir /data/vendor/rebootescrow 0770 hsm hsm
323    start vendor.rebootescrow-citadel
324
325on zygote-start
326    # zygote is started in common init.rc
327    # and now we can continue initialize /data/
328    mkdir /data/vendor/ipa 0770 radio radio
329    chown radio radio /data/vendor/ipa
330
331    # Create the directories used by the Wireless subsystem
332    mkdir /data/vendor/wifi 0771 wifi wifi
333    mkdir /data/vendor/wifi/wpa 0770 wifi wifi
334    mkdir /data/vendor/wifi/wpa/sockets 0770 wifi wifi
335
336    # Create the directories used by CnE subsystem
337    mkdir /data/vendor/connectivity 0771 radio radio
338    chown radio radio /data/vendor/connectivity
339
340    # Create directory for radio
341    mkdir /data/vendor/radio 0773 system radio
342    mkdir /data/vendor/modem_stat 0771 system radio
343    write /data/vendor/modem_stat/debug.txt ""
344    chown system radio /data/vendor/modem_stat/debug.txt
345    chmod 0664 /data/vendor/modem_stat/debug.txt
346
347    # Mark the copy complete flag to not completed
348    write /data/vendor/radio/copy_complete 0
349    chown radio radio /data/vendor/radio/copy_complete
350    chmod 0660 /data/vendor/radio/copy_complete
351
352    # File flags for prebuilt ril db file
353    write /data/vendor/radio/prebuilt_db_support 1
354    chown radio radio /data/vendor/radio/prebuilt_db_support
355    chmod 0400 /data/vendor/radio/prebuilt_db_support
356    write /data/vendor/radio/db_check_done 0
357    chown radio radio /data/vendor/radio/db_check_done
358    chmod 0660 /data/vendor/radio/db_check_done
359
360    # Create directories for Location services
361    mkdir /data/vendor/location 0770 gps gps
362    mkdir /data/vendor/location/mq 0770 gps gps
363    mkdir /data/vendor/location/xtwifi 0770 gps gps
364    mkdir /dev/socket/location 0770 gps gps
365    mkdir /dev/socket/location/mq 0770 gps gps
366    mkdir /dev/socket/location/xtra 0770 gps gps
367
368    #Create directories for wifihal services
369    mkdir /dev/socket/wifihal 0770 wifi wifi
370    chmod 2770 /dev/socket/wifihal
371
372on early-boot
373    # Change owner for sensors-related directories
374    chown root system /mnt/vendor/persist/sensors/registry
375    chown root system /mnt/vendor/persist/sensors/registry/registry
376    chown system root /mnt/vendor/persist/sensors/sensors_settings
377    chown root root /mnt/vendor/persist/sensors/registry/registry/sensors_settings
378
379    # Set up sensors-related data directories and permissions
380    mkdir /data/vendor/sensors 0770
381    chown system system /data/vendor/sensors
382    mkdir /data/vendor/sensors/log 0770
383    chown system system /data/vendor/sensors/log
384
385    # Change owner for sensors factory calibrated registries directory
386    chown system system /mnt/vendor/persist/sensors/registry/factory_data
387    chown system system /mnt/vendor/persist/sensors/registry/factory_data/sns_fac_registry
388    restorecon_recursive /mnt/vendor/persist/sensors/registry/factory_data
389
390    # Restore SeLinux Context for preventing temp.json with
391    # incorrect security context
392    restorecon /mnt/vendor/persist/sensors/registry/temp.json
393
394    chmod 770 /mnt/vendor/persist/audio
395    chmod 660 /mnt/vendor/persist/audio/audio.cal
396    chown media audio /mnt/vendor/persist/audio
397    chown audioserver audio /mnt/vendor/persist/audio/audio.cal
398
399    # Set up haptics-related directories and permissions
400    chmod 770 /mnt/vendor/persist/haptics
401    chmod 440 /mnt/vendor/persist/haptics/drv2624.cal
402    chown system system /mnt/vendor/persist/haptics
403    chown system system /mnt/vendor/persist/haptics/drv2624.cal
404
405    # Set up oslo-related directories and permissions
406    chmod 770 /mnt/vendor/persist/oslo
407    chmod 660 /mnt/vendor/persist/oslo/oslo.cal
408    chown system system /mnt/vendor/persist/oslo
409    chown system system /mnt/vendor/persist/oslo/oslo.cal
410
411    # Set up touch directories and permissions
412    chmod 770 /mnt/vendor/persist/touch
413    chown system system /mnt/vendor/persist/touch
414
415    # Permission for lights driver
416    chown system system /sys/class/backlight/panel0-backlight/brightness
417    chown system system /sys/class/backlight/panel0-backlight/vr_mode
418    chown system system /sys/class/backlight/panel0-backlight/hbm_mode
419    chown system system /sys/class/backlight/panel0-backlight/als_table
420    chown system system /sys/devices/platform/soc/soc:qcom,dsi-display-primary/te2_table
421
422    # Wait for insmod_sh to finish all modules
423    wait_for_prop vendor.all.modules.ready 1
424
425    # Update dm-verity state and set partition.*.verified properties
426    verity_update_state
427
428    # Wait for insmod_sh to finish all boot devices
429    wait_for_prop vendor.all.devices.ready 1
430
431    # Permission for Vibrator
432    chown system system /sys/class/leds/vibrator/device/mode
433    chown system system /sys/class/leds/vibrator/device/od_clamp
434    chown system system /sys/class/leds/vibrator/device/rtp_input
435    chown system system /sys/class/leds/vibrator/device/scale
436    chown system system /sys/class/leds/vibrator/device/set_sequencer
437    chown system system /sys/class/leds/vibrator/device/autocal_result
438    chown system system /sys/class/leds/vibrator/device/ctrl_loop
439    chown system system /sys/class/leds/vibrator/device/ol_lra_period
440    chown system system /sys/class/leds/vibrator/device/autocal
441    chown system system /sys/class/leds/vibrator/device/lp_trigger_effect
442    chown system system /sys/class/leds/vibrator/device/lra_wave_shape
443    write /sys/class/leds/vibrator/trigger transient
444
445    # Permission for rainbow sensor
446    chown system system /sys/devices/platform/soc/994000.i2c/i2c-3/3-0020/rainbow_enable
447    chmod 0660 /sys/devices/platform/soc/994000.i2c/i2c-3/3-0020/rainbow_enable
448    chown system system /sys/devices/platform/soc/994000.i2c/i2c-3/3-0020/rainbow_read_byte
449    chmod 0660 /sys/devices/platform/soc/994000.i2c/i2c-3/3-0020/rainbow_read_byte
450    chown system system /sys/devices/platform/soc/994000.i2c/i2c-3/3-0020/rainbow_write_byte
451    chmod 0660 /sys/devices/platform/soc/994000.i2c/i2c-3/3-0020/rainbow_write_byte
452    chown system system /dev/vd6281
453    chmod 0660 /dev/vd6281
454    chown system system /mnt/vendor/persist/camera/rals_fac_test
455    chmod 0660 /mnt/vendor/persist/camera/rals_fac_test
456
457    # FG cycle count read from dumpstate + backup restore from health HAL (and pixelstats)
458    chown system system /sys/class/power_supply/maxfg/cycle_counts_bins
459
460    # Permission for battery eeprom
461    chown system system /sys/devices/platform/soc/98c000.i2c/i2c-1/1-0050/1-00500/nvmem
462    chmod 0640 /sys/devices/platform/soc/98c000.i2c/i2c-1/1-0050/1-00500/nvmem
463    chown system system /dev/battery_history
464    chmod 0644 /dev/battery_history
465
466    # Permission for Pixelstats
467    chown system system /sys/class/misc/msm_cirrus_playback/resistance_left_right
468    chown system system /sys/devices/platform/soc/${ro.boot.bootdevice}/slowio_read_cnt
469    chown system system /sys/devices/platform/soc/${ro.boot.bootdevice}/slowio_write_cnt
470    chown system system /sys/devices/platform/soc/${ro.boot.bootdevice}/slowio_unmap_cnt
471    chown system system /sys/devices/platform/soc/${ro.boot.bootdevice}/slowio_sync_cnt
472
473    # Permission for Health Storage HAL
474    chown system system /sys/devices/platform/soc/${ro.boot.bootdevice}/manual_gc
475
476    # Permissions for reading display native color gamut
477    chown system graphics /mnt/vendor/persist/display/native_gamut.csv
478
479on boot
480    # This location is used by QCRIL to host UNIX domain
481    # socket files used for internal IPC within QCRIL
482    # modules
483    mkdir /dev/socket/qmux_radio 0770 radio radio
484    chmod 2770 /dev/socket/qmux_radio
485
486    setprop wifi.interface wlan0
487    setprop wifi.aware.interface wifi-aware0
488
489    chown system system /sys/kernel/hbtp/display_pwr
490
491    start init-modem-sh
492
493    start rfs_access
494
495    # default country code
496    setprop ro.boot.wificountrycode 00
497
498    # WLAN debug access
499    chown system system /d/icnss/stats
500
501service init-radio-sh /vendor/bin/init.radio.sh
502    class late_start
503    user radio
504    group root radio
505    oneshot
506
507service init-modem-sh /vendor/bin/init.modem.sh
508    class core
509    user radio
510    group root radio
511    oneshot
512
513on property:init.svc.vendor.charger=running
514    stop vendor.qseecomd
515    stop keymaster-4-0
516
517    setprop sys.usb.configfs 1
518    setprop vendor.setup.power 1
519
520    # keep one little and one big without big+
521    write /sys/devices/system/cpu/cpu1/online 0
522    write /sys/devices/system/cpu/cpu2/online 0
523    write /sys/devices/system/cpu/cpu3/online 0
524    write /sys/devices/system/cpu/cpu4/online 0
525    write /sys/devices/system/cpu/cpu5/online 0
526    write /sys/devices/system/cpu/cpu7/online 0
527
528on property:sys.boot_completed=1
529    setprop vendor.setup.power 1
530
531    # Runtime fs tuning
532    write /sys/block/sda/queue/read_ahead_kb 128
533    write /sys/block/sda/queue/nr_requests 128
534    write /sys/block/sda/queue/iostats 1
535    write /sys/block/dm-0/queue/read_ahead_kb 128
536    write /sys/block/dm-1/queue/read_ahead_kb 128
537    write /sys/block/dm-2/queue/read_ahead_kb 128
538    write /sys/block/dm-3/queue/read_ahead_kb 128
539    write /sys/block/dm-4/queue/read_ahead_kb 128
540    write /sys/block/dm-5/queue/read_ahead_kb 128
541    write /sys/block/dm-6/queue/read_ahead_kb 128
542    write /sys/block/dm-7/queue/read_ahead_kb 128
543    write /sys/block/dm-8/queue/read_ahead_kb 128
544    write /sys/block/dm-9/queue/read_ahead_kb 128
545
546    # Block layer tuning: discard chunk size up to 128MB
547    # Otherwise, contiguous discards can be merged
548    write /sys/block/sda/queue/discard_max_bytes 134217728
549
550    # Back to default VM settings
551    write /proc/sys/vm/dirty_expire_centisecs 3000
552    write /proc/sys/vm/dirty_background_ratio 10
553
554    # Enable ZRAM on boot_complete
555    swapon_all /vendor/etc/fstab.${ro.boot.hardware.platform}
556    write /proc/sys/vm/swappiness 100
557
558    # Setup runtime cpusets
559    write /dev/cpuset/top-app/cpus 0-7
560    write /dev/cpuset/foreground/cpus 0-5,7
561    write /dev/cpuset/background/cpus 4-5
562    write /dev/cpuset/system-background/cpus 2-5
563    write /dev/cpuset/restricted/cpus 2-5
564
565    # Setup runtime schedTune
566    write /dev/stune/foreground/schedtune.prefer_idle 1
567    write /dev/stune/foreground/schedtune.prefer_high_cap 0
568    write /dev/stune/foreground/schedtune.boost 0
569    write /dev/stune/schedtune.prefer_idle 0
570    write /dev/stune/schedtune.prefer_high_cap 0
571    write /dev/stune/schedtune.boost 0
572    write /dev/stune/top-app/schedtune.prefer_idle 1
573    write /dev/stune/top-app/schedtune.prefer_high_cap 0
574    write /dev/stune/top-app/schedtune.boost 10
575
576    # Setup runtime blkio
577    # value for group_idle is us
578    write /dev/blkio/blkio.weight 1000
579    write /dev/blkio/background/blkio.weight 200
580    write /dev/blkio/blkio.group_idle 2000
581    write /dev/blkio/background/blkio.group_idle 0
582
583    # HardwareInfo needs to be able to read display info
584    chmod 444 /sys/devices/platform/soc/soc:qcom,dsi-display-primary/panel_info/panel0/serial_number
585    chmod 444 /sys/devices/platform/soc/soc:qcom,dsi-display-primary/panel_info/panel0/panel_vendor_name
586    chmod 444 /sys/devices/platform/soc/soc:qcom,dsi-display-primary/panel_info/panel0/panel_extinfo
587
588    # Maxim FG dump for dumpstate
589    chown system system /sys/kernel/debug/regmap/1-0036/registers
590    chown system system /sys/kernel/debug/regmap/1-000b/registers
591    chown system system /sys/kernel/debug/google_battery/cycle_count_bins
592    chown system system /sys/kernel/debug/google_battery/ssoc_gdf
593    chown system system /sys/kernel/debug/google_battery/ssoc_rls
594    chown system system /sys/kernel/debug/google_battery/ssoc_uic
595    chown system system /sys/kernel/debug/google_battery/ssoc_uicurve
596    chown system system /sys/kernel/debug/google_charger/pps_op_ua
597    chown system system /sys/kernel/debug/google_charger/pps_out_uv
598
599    # Permission for wireless charging
600    chown system system /sys/class/power_supply/wireless/capacity
601    chmod 0660 /sys/class/power_supply/wireless/capacity
602    chown system system /sys/devices/platform/soc/98c000.i2c/i2c-1/1-003b/rtx
603    chmod 0660 /sys/devices/platform/soc/98c000.i2c/i2c-1/1-003b/rtx
604
605    chown system system /sys/devices/platform/soc/98c000.i2c/i2c-1/1-003b/rxdata
606    chown system system /sys/devices/platform/soc/98c000.i2c/i2c-1/1-003b/txdata
607    chown system system /sys/devices/platform/soc/98c000.i2c/i2c-1/1-003b/rxlen
608    chown system system /sys/devices/platform/soc/98c000.i2c/i2c-1/1-003b/txlen
609    chown system system /sys/devices/platform/soc/98c000.i2c/i2c-1/1-003b/ccreset
610    chown system system /sys/devices/platform/soc/98c000.i2c/i2c-1/1-003b/status
611    chown system system /sys/devices/platform/soc/98c000.i2c/i2c-1/1-003b/version
612
613    # Permission for bootloader logs
614    chown root log /proc/bldrlog
615    chmod 0444 /proc/bldrlog
616
617on property:persist.vendor.hvdcp_opti.start=1
618    chown root system /sys/class/power_supply/bms/soh
619    chown root system /sys/class/power_supply/bms/esr_actual
620    chown root system /sys/class/power_supply/bms/esr_nominal
621
622service vendor.per_mgr /vendor/bin/pm-service
623    user system
624    group system
625    ioprio rt 4
626
627service per_proxy /vendor/bin/pm-proxy
628    class core
629    user system
630    group system
631    disabled
632
633on property:init.svc.vendor.per_mgr=running
634    start per_proxy
635
636# Start per_mgr daemon to boot modem as esim reset is done or not needed
637on property:persist.vendor.modem.esim.reset=done
638    start vendor.per_mgr
639
640on property:persist.vendor.modem.esim.reset=noneed
641    start vendor.per_mgr
642
643# Force to start per_mgr daemon as boot completed
644on property:sys.boot_completed=1
645    start vendor.per_mgr
646
647on property:sys.shutdown.requested=*
648    stop per_proxy
649
650service vendor.qseecomd /vendor/bin/qseecomd
651    class core
652    user root
653    group root
654
655service init-sensors-sh /vendor/bin/init.sensors.sh
656    class main
657    user root
658    group root system
659    disabled
660    oneshot
661
662service vendor.adsprpcd /vendor/bin/adsprpcd
663   class main
664   user system
665   group media
666
667service vendor.adsprpcd_audiopd /vendor/bin/adsprpcd audiopd
668   class main
669   user media
670   group media
671
672service vendor.cdsprpcd /vendor/bin/cdsprpcd
673   class main
674   user system
675   group system
676
677service wait_for_strongbox /vendor/bin/hw/wait_for_strongbox
678    user root
679    group root system
680    priority -20
681    ioprio rt 0
682
683service vendor.qrtr-ns /vendor/bin/qrtr-ns -f
684   class core
685   user vendor_qrtr
686   group vendor_qrtr
687   capabilities NET_BIND_SERVICE
688
689service irsc_util /vendor/bin/irsc_util "/vendor/etc/sec_config"
690   class core
691   user root
692   oneshot
693
694service modem_svc /vendor/bin/modem_svc -q
695   class core
696   user root
697   group system
698   capabilities NET_BIND_SERVICE
699
700service vendor.ss_ramdump /vendor/bin/subsystem_ramdump
701    class main
702    user root
703    group system
704    disabled
705
706service vendor.ssr_setup /vendor/bin/ssr_setup
707    oneshot
708    disabled
709
710on property:persist.vendor.sys.ssr.restart_level=*
711    start vendor.ssr_setup
712
713on post-fs-data && property:persist.vendor.sys.ssr.enable_ramdumps=1 && property:vendor.skip.init=0
714    write /sys/module/subsystem_restart/parameters/enable_ramdumps 1
715    mkdir /data/vendor/wifidump 771 root system
716    mkdir /data/vendor/ramdump 771 root system
717    mkdir /data/vendor/ssrdump 771 root system
718    mkdir /data/vendor/ssrlog  771 root system
719    start vendor.ss_ramdump
720
721on property:persist.vendor.sys.ssr.enable_ramdumps=0
722    write /sys/module/subsystem_restart/parameters/enable_ramdumps 0
723
724on property:init.svc.vendor.qti.hardware.display.composer=stopped
725    stop ppd
726
727on property:init.svc.vendor.qti.hardware.display.composer=running
728    start ppd
729
730# Start daemon after boot completed
731on property:sys.boot_completed=1
732    start vendor.ssgtzd
733
734# Used 'disabled' flag, so daemon won't be started until explicit start
735service vendor.ssgtzd /vendor/bin/ssgtzd
736    class late_start
737    user system
738    group system
739    disabled
740    socket ssgtzd stream 0660 system inet
741
742# charger driver exposes now finer grain control, map demo mode to those properties
743# NOTE: demo mode can only be exit wiping data (which reset the persist properties)
744on property:sys.retaildemo.enabled=1
745    setprop persist.vendor.charge.stop.level 35
746    setprop persist.vendor.charge.start.level 30
747
748service insmod_sh /vendor/bin/init.insmod.sh /vendor/etc/init.insmod.${ro.hardware}.cfg
749    class main
750    user root
751    group root system
752    disabled
753    oneshot
754
755service charger_insmod_sh /vendor/bin/init.insmod.sh /vendor/etc/init.insmod.charger.cfg
756    class main
757    user root
758    group root system
759    disabled
760    oneshot
761
762service vendor.msm_irqbalance /vendor/bin/msm_irqbalance -f /vendor/etc/msm_irqbalance.conf
763    socket msm_irqbalance seqpacket 660 root system
764    class core
765    user root
766    group root
767    writepid /dev/cpuset/system-background/tasks
768
769service pd_mapper /vendor/bin/pd-mapper
770     class core
771     user system
772     group system
773     capabilities NET_BIND_SERVICE
774
775service cnss-daemon /vendor/bin/cnss-daemon -n -l
776   class late_start
777   user system
778   group system inet wifi
779
780service loc_launcher /vendor/bin/loc_launcher
781    class late_start
782    user gps
783    group gps
784
785# Allow access to touch
786on property:vendor.all.modules.ready=1
787    chown system input /dev/touch_offload
788    chmod 660 /dev/touch_offload
789
790# Conditionally enable the twoshay touch service
791on property:persist.vendor.enable_twoshay=1
792    enable twoshay
793
794# bugreport is triggered by holding down volume down, volume up and power
795service bugreport /system/bin/dumpstate -d -p -z
796    class main
797    disabled
798    oneshot
799    keycodes 114 115 116
800
801# DSDS feature
802# Set to Dual-sim mode based on CDT setting
803on property:ro.boot.hardware.dsds=1
804    setprop persist.radio.multisim.config dsds
805
806# Restart 1st qcrild after SIM config changed
807on property:vendor.radio.sim_num.switch=1to2 && property:persist.radio.multisim.config=dsds
808    restart vendor.qcrild
809
810on property:vendor.radio.sim_num.switch=2to1 && property:persist.radio.multisim.config=
811    restart vendor.qcrild
812
813# Enable 2nd qcrild when the property set to dsds
814on property:persist.radio.multisim.config=dsds
815    start vendor.qcrild2
816
817# Stop 2nd qcrild when the property set to empty string
818on property:persist.radio.multisim.config=
819    stop vendor.qcrild2
820
821# For Japan radio builds, always enforce camera shutter sound
822# Since this property is read by the audio server in system service,
823# it should be written by the system init.
824on property:ro.boot.hardware.radio.subtype=1
825    setprop audio.camerasound.force true
826# BUG FIX: b/163674593
827on property:ro.boot.hardware.sku=G5NZ6
828    setprop audio.camerasound.force true
829
830on property:persist.sys.device_provisioned=1
831    setprop dalvik.vm.dex2oat-cpu-set 0,1,2,3,4,5,7
832    setprop dalvik.vm.dex2oat-threads 6
833