• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#
2# Copyright (C) 2016 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}.power.rc
18import /vendor/etc/init/hw/init.${ro.boot.hardware.platform}.usb.rc
19import /vendor/etc/init/hw/init.${ro.boot.hardware.platform}.diag.rc
20import /vendor/etc/init/hw/init.${ro.boot.hardware.platform}.logging.rc
21import /vendor/etc/init/hw/init.${ro.boot.hardware.platform}.mpssrfs.rc
22
23
24on property:init.svc.vendor.charger=running
25    # keep one LITTLE and one big
26    write /sys/devices/system/cpu/cpu1/online 0
27    write /sys/devices/system/cpu/cpu2/online 0
28    write /sys/devices/system/cpu/cpu3/online 0
29    write /sys/devices/system/cpu/cpu5/online 0
30    write /sys/devices/system/cpu/cpu6/online 0
31    write /sys/devices/system/cpu/cpu7/online 0
32    # Enable UFS powersaving
33    write /sys/devices/platform/soc/${ro.boot.bootdevice}/clkgate_enable 1
34    write /sys/devices/platform/soc/${ro.boot.bootdevice}/hibern8_on_idle_enable 1
35    write /sys/class/typec/port0/port_type sink
36    write /sys/module/lpm_levels/parameters/sleep_disabled 0
37    # Disable sched_boost
38    write /proc/sys/kernel/sched_boost 0
39    # Enable thermal mitigation
40    write /sys/devices/virtual/thermal/tz-by-name/backup-charge/mode enabled
41    # Ensure 100% reporting is sticky
42    write /sys/class/power_supply/maxfg/offmode_charger 1
43
44service vendor.charger /system/bin/charger
45    class charger
46    seclabel u:r:charger:s0
47    user system
48    group system wakelock input
49    capabilities SYS_BOOT
50    file /dev/kmsg w
51    file /sys/fs/pstore/console-ramoops-0 r
52    file /sys/fs/pstore/console-ramoops r
53    file /proc/last_kmsg r
54
55on early-init
56    mount debugfs debugfs /sys/kernel/debug
57    chmod 0755 /sys/kernel/debug
58    # Enable sched_boost
59    write /proc/sys/kernel/sched_boost 1
60    mount_all /vendor/etc/fstab.persist --early
61
62# Skip init trigger for charger mode
63on early-init && property:ro.boot.mode=charger
64    setprop vendor.skip.init 1
65
66# We need vold early for metadata encryption
67on early-fs
68    start vold
69
70on init && property:vendor.skip.init=0
71    start logd
72
73    # QSEE rpmb listener need symlink for bootdevice
74    wait /dev/block/platform/soc/${ro.boot.bootdevice}
75    symlink /dev/block/platform/soc/${ro.boot.bootdevice} /dev/block/bootdevice
76
77    # start qseecomd early as we mount system/ vendor/ early
78    # vold needs keymaster that needs qseecomd
79    start vendor.qseecomd
80    start keymaster-4-0
81
82    # start Citadel keymaster (StrongBox) early
83    start vendor.citadeld
84    start vendor.keymaster-4-1-citadel
85
86    # Boot time fs tune
87    write /sys/block/sda/queue/iostats 0
88    write /sys/block/sda/queue/scheduler cfq
89    write /sys/block/sda/queue/iosched/slice_idle 0
90    write /sys/block/sda/queue/nr_requests 256
91    write /sys/block/sdf/queue/iostats 0
92    write /sys/block/sdf/queue/scheduler cfq
93    write /sys/block/sdf/queue/iosched/slice_idle 0
94    write /sys/block/sdf/queue/nr_requests 256
95
96    # Disable UFS powersaving
97    write /sys/devices/platform/soc/${ro.boot.bootdevice}/clkgate_enable 0
98    write /sys/devices/platform/soc/${ro.boot.bootdevice}/hibern8_on_idle_enable 0
99
100    # Loading kernel modules in background
101    start insmod_sh
102
103    # Support legacy paths
104    symlink /sdcard /mnt/sdcard
105    symlink /sdcard /storage/sdcard0
106
107    # bring back all cores
108    write /sys/devices/system/cpu/cpu0/online 1
109    write /sys/devices/system/cpu/cpu1/online 1
110    write /sys/devices/system/cpu/cpu2/online 1
111    write /sys/devices/system/cpu/cpu3/online 1
112    write /sys/devices/system/cpu/cpu4/online 1
113    write /sys/devices/system/cpu/cpu5/online 1
114    write /sys/devices/system/cpu/cpu6/online 1
115    write /sys/devices/system/cpu/cpu7/online 1
116
117    # configure governor settings for little cluster
118    write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor schedutil
119    write /sys/devices/system/cpu/cpu0/cpufreq/schedutil/up_rate_limit_us 500
120    write /sys/devices/system/cpu/cpu0/cpufreq/schedutil/down_rate_limit_us 20000
121
122    # configure governor settings for big cluster
123    write /sys/devices/system/cpu/cpu4/cpufreq/scaling_governor schedutil
124    write /sys/devices/system/cpu/cpu4/cpufreq/schedutil/up_rate_limit_us 500
125    write /sys/devices/system/cpu/cpu4/cpufreq/schedutil/down_rate_limit_us 20000
126
127    # set default schedTune value for foreground/top-app
128    write /dev/stune/foreground/schedtune.prefer_idle 1
129    write /dev/stune/top-app/schedtune.boost 10
130    write /dev/stune/top-app/schedtune.prefer_idle 1
131
132    # set default schedTune value for camera-daemon
133    write /dev/stune/camera-daemon/schedtune.prefer_idle 1
134    write /dev/stune/camera-daemon/schedtune.boost 0
135
136    # b/37682684 Enable suspend clock reporting
137    write /sys/kernel/debug/clk/debug_suspend 1
138
139    # ZRAM setup
140    write /sys/block/zram0/comp_algorithm lz4
141    write /proc/sys/vm/page-cluster 0
142
143    # Some user code relies on ro.boot.hardware.revision
144    setprop ro.boot.hardware.revision ${ro.revision}
145
146    # Allow PAI targeting per hardware SKU
147    setprop ro.oem.key1 ${ro.boot.hardware.sku}
148
149    # Property used by vintf for sku specific manifests
150    setprop ro.boot.product.hardware.sku ${ro.boot.hardware.sku}
151
152    # Property used by pointing to thermal-engine config file
153    setprop vendor.thermal.vr_mode -novr
154    setprop vendor.thermal.hw_mode -prod
155
156    # Battery Defender
157    chown system system /sys/devices/platform/soc/soc:google,charger/charge_stop_level
158    chown system system /sys/devices/platform/soc/soc:google,charger/charge_start_level
159    chown system system /sys/devices/platform/soc/soc:google,charger/bd_drainto_soc
160    chown system system /sys/devices/platform/soc/soc:google,charger/bd_recharge_soc
161    chown system system /sys/devices/platform/soc/soc:google,charger/bd_recharge_voltage
162    chown system system /sys/devices/platform/soc/soc:google,charger/bd_resume_abs_temp
163    chown system system /sys/devices/platform/soc/soc:google,charger/bd_resume_soc
164    chown system system /sys/devices/platform/soc/soc:google,charger/bd_resume_temp
165    chown system system /sys/devices/platform/soc/soc:google,charger/bd_resume_time
166    chown system system /sys/devices/platform/soc/soc:google,charger/bd_trigger_temp
167    chown system system /sys/devices/platform/soc/soc:google,charger/bd_trigger_time
168    chown system system /sys/devices/platform/soc/soc:google,charger/bd_trigger_voltage
169    chown system system /sys/devices/platform/soc/soc:google,charger/bd_temp_enable
170    chown system system /sys/devices/platform/soc/soc:google,charger/bd_clear
171    chown system system /sys/class/power_supply/wireless/device/mitigate_threshold
172
173on late-init
174    write /sys/devices/virtual/thermal/tz-by-name/quiet-therm-adc/mode enabled
175    chown system system /sys/devices/virtual/thermal/tz-by-name/quiet-therm-monitor/trip_point_0_temp
176    chown system system /sys/devices/virtual/thermal/tz-by-name/quiet-therm-monitor/trip_point_0_hyst
177    write /sys/devices/virtual/thermal/tz-by-name/fps-therm-adc/mode enabled
178    chown system system /sys/devices/virtual/thermal/tz-by-name/fps-therm-monitor/trip_point_0_temp
179    chown system system /sys/devices/virtual/thermal/tz-by-name/fps-therm-monitor/trip_point_0_hyst
180    chown system system /sys/devices/virtual/thermal/tz-by-name/usbc-therm-monitor/trip_point_0_temp
181    chown system system /sys/devices/virtual/thermal/tz-by-name/usbc-therm-monitor/trip_point_0_hyst
182    chown system system /sys/devices/virtual/thermal/tz-by-name/soc/mode
183
184on fs
185    mount_all /vendor/etc/fstab.${ro.boot.hardware.platform} --early
186
187    mkdir /persist/data 0700 system system
188    mkdir /persist/display 0770 system graphics
189    mkdir /persist/rfs 0770 root system
190    mkdir /persist/hlos_rfs 0770 root system
191    chmod 0770 /persist/rfs
192    chmod 0770 /persist/rfs/shared
193    chmod 0770 /persist/rfs/msm
194    chmod 0770 /persist/rfs/msm/adsp
195    chmod 0770 /persist/rfs/msm/mpss
196    chmod 0770 /persist/rfs/msm/slpi
197    chmod 0770 /persist/rfs/mdm
198    chmod 0770 /persist/rfs/mdm/adsp
199    chmod 0770 /persist/rfs/mdm/mpss
200    chmod 0770 /persist/rfs/mdm/slpi
201    chmod 0770 /persist/rfs/mdm/tn
202    chmod 0770 /persist/rfs/apq
203    chmod 0770 /persist/rfs/apq/gnss
204    chmod 0770 /persist/hlos_rfs
205    # for cycle count backup
206    mkdir /persist/battery 0700 system system
207    restorecon_recursive /mnt/vendor/persist
208
209on late-fs
210    start devstart_sh
211
212    # Start services for bootanim
213    start vendor.power-hal-1-3
214    start surfaceflinger
215    start bootanim
216    start vendor.hwcomposer-2-3
217    start vendor.configstore-hal
218    start vendor.qti.hardware.display.allocator
219    start vendor.light-1-0
220
221    # Wait for hwservicemanager ready since fsck might be triggered in mount_all --late
222    # In such case, init won't responce the property_set from hwservicemanager and then
223    # cause services for bootanim not running.
224    wait_for_prop hwservicemanager.ready true
225
226    # Wait for keymaster HALs (TEE and StrongBox)
227    exec_start wait_for_strongbox
228
229    # Mount RW partitions which need run fsck
230    mount_all /vendor/etc/fstab.${ro.boot.hardware.platform} --late
231
232    # Required for time_daemon
233    mkdir /persist/time 0770 system system
234
235    # Start time daemon early so that the system time can be set early
236    start time_daemon
237
238    # Write build info to kdebuginfo.
239    write /sys/module/kdebuginfo/parameters/build_info "${ro.product.name}-${ro.build.type} ${ro.build.version.incremental}"
240
241on post-fs
242    # Disable sched autogroup
243    write /proc/sys/kernel/sched_autogroup_enabled 0
244
245    # set RLIMIT_MEMLOCK to 64MB
246    setrlimit 8 67108864 67108864
247
248    chmod 0664 /sys/devices/virtual/graphics/fb0/idle_time
249    chown system graphics /sys/devices/virtual/graphics/fb0/idle_time
250    write /sys/devices/virtual/graphics/fb0/idle_time 100
251
252    # turn off vblank irq immediately after turning off
253    write /sys/module/drm/parameters/vblankoffdelay -1
254
255on post-fs-data
256    # We can start netd here before in is launched in common init.rc on zygote-start
257    start netd
258
259    # b/38048356 Setup debug folders for camera
260    mkdir /data/vendor/camera 0770 camera camera
261
262    # b/38496103 Setup debug folders for display
263    mkdir /data/vendor/display 0770 system graphics
264
265    # Setup folder for modem fdr
266    mkdir /data/vendor/modem_fdr 0700 root system
267
268    # Resume-on-Reboot after we have the data dir and keymaster
269    mkdir /data/vendor/rebootescrow 0770 hsm hsm
270    start vendor.rebootescrow-citadel
271
272    # keep that at the end of on post-fs-data
273    # Set indication (checked by vold) that we have finished this action
274    setprop vold.post_fs_data_done 1
275
276    # Wait until the system time is set
277    wait_for_prop vendor.qcom.time.set true
278
279    # Wait qseecomd started
280    wait_for_prop vendor.sys.listeners.registered true
281
282    # load IPA FWs
283    # This must be started when vendor.sys.listeners.registered is true
284    start ipastart_sh
285
286    mkdir /data/vendor/nnhal 0700 system system
287
288# zygote need to be started after otapreopt which will be done on post-fs-data
289on zygote-start
290    # zygote is started in common init.rc
291    # and now we can continue initialize /data/
292    mkdir /data/vendor/ipa 0770 radio radio
293    chown radio radio /data/vendor/ipa
294
295    # Create the directories used by the Wireless subsystem
296    mkdir /data/vendor/wifi 0771 wifi wifi
297    mkdir /data/vendor/wifi/wpa 0770 wifi wifi
298    mkdir /data/vendor/wifi/wpa/sockets 0770 wifi wifi
299
300    chown system system /persist/WCNSS_qcom_wlan_nv.bin
301
302    # Trigger WLAN driver load
303    write /sys/kernel/boot_wlan/boot_wlan 1
304
305    #create netmgr log dir
306    mkdir /data/vendor/netmgr 0771 radio radio
307    chmod 0771 /data/vendor/netmgr
308
309    # Create netmgr recovery folder
310    mkdir /data/vendor/netmgr/recovery 0700 radio radio
311    chmod 0770 /data/vendor/netmgr/recovery
312    write /data/vendor/netmgr/recovery/recovery_info ""
313    chown radio radio /data/vendor/netmgr/recovery/recovery_info
314
315    # Create directory used by audio subsystem
316    mkdir /data/vendor/audio 0770 audio audio
317
318    # Create directory for audio delta files
319    mkdir /data/vendor/audio/acdbdata 0770 media audio
320    mkdir /data/vendor/audio/acdbdata/delta 0770 media audio
321
322    # Create directory for radio
323    mkdir /data/vendor/radio 0773 system radio
324    mkdir /data/vendor/modem_stat 0771 system radio
325    write /data/vendor/modem_stat/debug.txt ""
326    chown system radio /data/vendor/modem_stat/debug.txt
327    chmod 0664 /data/vendor/modem_stat/debug.txt
328
329    # Set up sensors-related directories and permissions
330    chmod 775 /persist/sensors
331    chmod 664 /persist/sensors/sensors_settings
332    chown root system /persist/sensors/registry
333    chmod 775 /persist/sensors/registry
334    chown root system /persist/sensors/registry/registry
335    chmod 775 /persist/sensors/registry/registry
336
337    chown system root /persist/sensors/sensors_settings
338    chown root root /persist/sensors/registry/registry/sensors_settings
339
340    mkdir /data/vendor/sensors 0770
341    chown system system /data/vendor/sensors
342    mkdir /data/vendor/sensors/log 0770
343    chown system system /data/vendor/sensors/log
344
345    # Restore SeLinux Context for preventing temp.json with
346    # incorrect security context
347    restorecon /mnt/vendor/persist/sensors/registry/temp.json
348
349    chmod 770 /persist/audio
350    chmod 660 /persist/audio/audio.cal
351    chown media audio /persist/audio
352    chown audioserver audio /persist/audio/audio.cal
353
354    chmod 770 /persist/haptics
355    chmod 440 /persist/haptics/cs40l20.cal
356    chown system system /persist/haptics
357    chown system system /persist/haptics/cs40l20.cal
358
359    # Mark the copy complete flag to not completed
360    write /data/vendor/radio/copy_complete 0
361    chown radio radio /data/vendor/radio/copy_complete
362    chmod 0660 /data/vendor/radio/copy_complete
363
364    # File flags for prebuilt ril db file
365    write /data/vendor/radio/prebuilt_db_support 1
366    chown radio radio /data/vendor/radio/prebuilt_db_support
367    chmod 0400 /data/vendor/radio/prebuilt_db_support
368    write /data/vendor/radio/db_check_done 0
369    chown radio radio /data/vendor/radio/db_check_done
370    chmod 0660 /data/vendor/radio/db_check_done
371
372    # Create directories for Location services
373    mkdir /data/vendor/location 0770 gps gps
374    mkdir /data/vendor/location/mq 0770 gps gps
375    mkdir /data/vendor/location/xtwifi 0770 gps gps
376    mkdir /dev/socket/location 0770 gps gps
377    mkdir /dev/socket/location/mq 0770 gps gps
378    mkdir /dev/socket/location/xtra 0770 gps gps
379
380    # NFC local data and nfcee xml storage
381    mkdir /data/vendor/nfc 0770 nfc nfc
382
383    # Secure Element directory for loader service functionality
384    mkdir /data/vendor/secure_element 0770 secure_element secure_element
385
386on early-boot
387    # wait for devices
388    wait_for_prop vendor.qcom.devup 1
389
390    # wait for insmod_sh to finish all modules
391    wait_for_prop vendor.all.modules.ready 1
392
393    write /sys/kernel/boot_adsp/boot 1
394    write /sys/kernel/boot_cdsp/boot 1
395
396    # Update dm-verity state and set partition.*.verified properties
397    verity_update_state
398
399    # Permission for rainbow sensor
400    chown cameraserver camera /sys/devices/platform/soc/ac4a000.qcom,cci/ac4a000.qcom,cci:qcom,rainbow@20/rainbow_enable
401    chmod 0660 /sys/devices/platform/soc/ac4a000.qcom,cci/ac4a000.qcom,cci:qcom,rainbow@20/rainbow_enable
402    chown cameraserver camera /sys/devices/platform/soc/ac4a000.qcom,cci/ac4a000.qcom,cci:qcom,rainbow@20/rainbow_read_byte
403    chmod 0660 /sys/devices/platform/soc/ac4a000.qcom,cci/ac4a000.qcom,cci:qcom,rainbow@20/rainbow_read_byte
404    chown cameraserver camera /sys/devices/platform/soc/ac4a000.qcom,cci/ac4a000.qcom,cci:qcom,rainbow@20/rainbow_write_byte
405    chmod 0660 /sys/devices/platform/soc/ac4a000.qcom,cci/ac4a000.qcom,cci:qcom,rainbow@20/rainbow_write_byte
406    chown cameraserver camera /dev/vd6281
407    chmod 0660 /dev/vd6281
408
409    # Permission for Vibrator
410    chown system system /sys/class/leds/vibrator/device/comp_enable
411    chown system system /sys/class/leds/vibrator/device/cp_dig_scale
412    chown system system /sys/class/leds/vibrator/device/cp_trigger_index
413    chown system system /sys/class/leds/vibrator/device/cp_trigger_queue
414    chown system system /sys/class/leds/vibrator/device/dig_scale
415    chown system system /sys/class/leds/vibrator/device/f0_stored
416    chown system system /sys/class/leds/vibrator/device/heartbeat
417    chown system system /sys/class/leds/vibrator/device/num_waves
418    chown system system /sys/class/leds/vibrator/device/redc_stored
419    chown system system /sys/class/leds/vibrator/device/standby_timeout
420
421    # Permission for LED driver
422    chown system system /sys/class/leds/red/on_off_ms
423    chown system system /sys/class/leds/green/on_off_ms
424    chown system system /sys/class/leds/blue/on_off_ms
425    chown system system /sys/class/leds/red/rgb_start
426    chown system system /sys/class/leds/green/rgb_start
427    chown system system /sys/class/leds/blue/rgb_start
428    chown system system /sys/class/backlight/panel0-backlight/brightness
429    chown system system /sys/class/backlight/panel0-backlight/vr_mode
430    chown system system /sys/class/backlight/panel0-backlight/hbm_mode
431
432    # Permission for Wireless charger
433    chown system system /sys/devices/platform/soc/a88000.i2c/i2c-0/0-0061/rxdata
434    chown system system /sys/devices/platform/soc/a88000.i2c/i2c-0/0-0061/txdata
435    chown system system /sys/devices/platform/soc/a88000.i2c/i2c-0/0-0061/txlen
436    chown system system /sys/devices/platform/soc/a88000.i2c/i2c-0/0-0061/ccreset
437    chown system system /sys/devices/platform/soc/a88000.i2c/i2c-0/0-0061/status
438    chown system system /sys/devices/platform/soc/a88000.i2c/i2c-0/0-0061/version
439    chown system system /sys/class/power_supply/wireless/capacity
440
441    # FG cycle counts read from dumpstate + backup restore from health HAL
442    chown system system /sys/devices/platform/soc/c440000.qcom,spmi/spmi-0/spmi0-02/c440000.qcom,spmi:qcom,pmi8998@2:qpnp,fg/cycle_counts_bins
443    chown system system /sys/devices/platform/soc/a90000.i2c/i2c-4/4-0036/power_supply/maxfg/cycle_counts_bins
444
445    # HardwareInfo needs to be able to read CC bins
446    chmod 644 /sys/devices/platform/soc/c440000.qcom,spmi/spmi-0/spmi0-02/c440000.qcom,spmi:qcom,pmi8998@2:qpnp,fg/cycle_counts_bins
447    chmod 644 /sys/devices/platform/soc/a90000.i2c/i2c-4/4-0036/power_supply/maxfg/cycle_counts_bins
448
449    # Permission for Pixelstats
450    chown system system /sys/class/misc/msm_cirrus_playback/resistance_left_right
451    chown system system /sys/devices/platform/soc/1d84000.ufshc/slowio_read_cnt
452    chown system system /sys/devices/platform/soc/1d84000.ufshc/slowio_write_cnt
453    chown system system /sys/devices/platform/soc/1d84000.ufshc/slowio_unmap_cnt
454    chown system system /sys/devices/platform/soc/1d84000.ufshc/slowio_sync_cnt
455    chown system system /sys/devices/platform/soc/soc:qcom,wcd-dsp-mgr/wdsp_stat
456
457
458    # Permission for Health Storage HAL
459    chown system system /sys/devices/platform/soc/1d84000.ufshc/manual_gc
460
461on boot
462    mkdir /dev/socket/qmux_radio 0770 radio radio
463    chmod 2770 /dev/socket/qmux_radio
464    mkdir /dev/socket/qmux_audio 0770 media audio
465    chmod 2770 /dev/socket/qmux_audio
466    mkdir /dev/socket/qmux_bluetooth 0770 bluetooth bluetooth
467    chmod 2770 /dev/socket/qmux_bluetooth
468    mkdir /dev/socket/qmux_gps 0770 gps gps
469    chmod 2770 /dev/socket/qmux_gps
470
471    # Create NETMGR daemon socket area
472    mkdir /dev/socket/netmgr 0750 radio radio
473
474    setprop wifi.interface wlan0
475
476    # Assign TCP buffer thresholds to be ceiling value of technology maximums
477    # Increased technology maximums should be reflected here.
478    write /proc/sys/net/core/rmem_max  8388608
479    write /proc/sys/net/core/wmem_max  8388608
480
481    # Bluetooth
482    chown bluetooth net_bt /sys/class/rfkill/rfkill0/type
483    chown bluetooth net_bt /sys/class/rfkill/rfkill0/state
484    chmod 0660 /sys/class/rfkill/rfkill0/state
485    chown bluetooth net_bt /sys/class/rfkill/rfkill0/device/extldo
486    chmod 0660 /sys/class/rfkill/rfkill0/device/extldo
487
488    # Wifi firmware reload path
489    chown wifi wifi /sys/module/wlan/parameters/fwpath
490
491    # default country code
492    setprop ro.boot.wificountrycode 00
493
494    # WLAN debug access
495    chown system system /d/icnss/stats
496
497    # Default enable uicc_se
498    setprop persist.vendor.radio.uicc_se_enabled true
499
500service init-radio-sh /vendor/bin/init.radio.sh
501    class late_start
502    user radio
503    group root radio
504    oneshot
505
506# reset thermal-engine when changed profile
507on property:vendor.thermal.vr_mode=*
508    restart vendor.thermal-engine
509
510service vendor.thermal-engine /vendor/bin/thermal-engine -c /vendor/etc/thermal-engine-${ro.hardware}${vendor.thermal.vr_mode}${vendor.thermal.hw_mode}.conf
511   class main
512   user root
513   group root system
514   socket thermal-send-client stream 0666 system system
515   socket thermal-recv-client stream 0660 system system
516   socket thermal-recv-passive-client stream 0666 system system
517
518on property:persist.vendor.sys.ssr.restart_level=*
519    start vendor.ssr_setup
520
521service vendor.ssr_setup /vendor/bin/ssr_setup
522    oneshot
523    disabled
524
525service vendor.ssr_diag /vendor/bin/ssr_diag
526    class late_start
527    user system
528    group system
529    disabled
530
531service vendor.per_mgr /vendor/bin/pm-service
532    class core
533    user system
534    group system
535    ioprio rt 4
536
537service per_proxy /vendor/bin/pm-proxy
538    class core
539    user system
540    group system
541    disabled
542
543on property:sys.boot_completed=1
544    # Set the default IRQ affinity to the silver cluster.
545    write /proc/irq/default_smp_affinity f
546
547    # Enable UFS powersaving
548    write /sys/devices/platform/soc/${ro.boot.bootdevice}/clkgate_enable 1
549    write /sys/devices/platform/soc/${ro.boot.bootdevice}/hibern8_on_idle_enable 1
550
551    # Limit 4KB discards to 2GB of space
552    write /dev/sys/fs/by-name/userdata/max_small_discards 5120
553
554    # Enable ZRAM on boot_complete
555    rm /data/unencrypted/zram_swap
556    swapon_all /vendor/etc/fstab.${ro.boot.hardware.platform}
557    write /proc/sys/vm/swappiness 100
558
559    # Setup final blkio
560    # value for group_idle is us
561    write /dev/blkio/blkio.weight 1000
562    write /dev/blkio/background/blkio.weight 200
563    write /dev/blkio/blkio.group_idle 2000
564    write /dev/blkio/background/blkio.group_idle 0
565
566    # Setup final cpuset
567    write /dev/cpuset/top-app/cpus 0-7
568    write /dev/cpuset/foreground/boost/cpus 0-3,6-7
569    write /dev/cpuset/foreground/cpus 0-3,6-7
570    write /dev/cpuset/background/cpus 0-1
571    write /dev/cpuset/system-background/cpus 0-3
572    write /dev/cpuset/restricted/cpus 0-3
573
574    # Runtime fs tuning: as we have init boottime setting and kernel patch setting
575    # We should adjust the setting upon boot_complete
576    # for runtime performance
577    write /sys/block/sda/queue/nr_requests 128
578    write /sys/block/sda/queue/iostats 1
579    write /sys/block/sdf/queue/nr_requests 128
580    write /sys/block/sdf/queue/iostats 1
581
582    # Block layer tuning: discard chunk size up to 128MB
583    # Otherwise, contiguous discards can be merged
584    write /sys/block/sda/queue/discard_max_bytes 134217728
585
586    # QCOM FG SRAM dump for dumpstate
587    chown system system /d/fg/sram/data
588    chown system system /d/fg/sram/count
589    chown system system /d/fg/sram/address
590
591    # Maxim FG dump for dumpstate
592    chown system system /d/regmap/4-0036/registers
593    chown system system /d/regmap/4-000b/registers
594
595    # UFS health
596    chmod 755 /sys/kernel/debug/ufshcd0
597    chmod 644 /sys/kernel/debug/ufshcd0/show_hba
598    chmod 644 /sys/kernel/debug/ufshcd0/stats/err_stats
599    chmod 644 /sys/kernel/debug/ufshcd0/stats/io_stats
600    chmod 644 /sys/kernel/debug/ufshcd0/stats/req_stats
601
602    # Disable sched_boost
603    write /proc/sys/kernel/sched_boost 0
604
605    # Enable PowerHAL hint processing
606    setprop vendor.powerhal.init 1
607
608    start per_proxy
609
610on property:sys.shutdown.requested=*
611    stop per_proxy
612
613service vendor.qseecomd /vendor/bin/qseecomd
614   class core
615   user root
616   group root
617
618service ss_ramdump /vendor/bin/subsystem_ramdump
619    class main
620    user root
621    group system
622    disabled
623
624on property:persist.vendor.sys.ssr.enable_ramdumps=1
625    write /sys/module/subsystem_restart/parameters/enable_ramdumps 1
626    mkdir /data/vendor/wifidump 771 root system
627    mkdir /data/vendor/ramdump 771 root system
628    mkdir /data/vendor/ssrdump 771 root system
629    mkdir /data/vendor/ssrlog  775 root system
630    start ss_ramdump
631
632on property:persist.vendor.sys.ssr.enable_ramdumps=0
633    write /sys/module/subsystem_restart/parameters/enable_ramdumps 0
634
635service adsprpcd /vendor/bin/adsprpcd
636   class main
637   user media
638   group media
639
640service cdsprpcd /vendor/bin/cdsprpcd
641   class main
642   user system
643   group system
644
645service irsc_util /vendor/bin/irsc_util "/vendor/etc/sec_config"
646    class core
647    user root
648    oneshot
649
650service rmt_storage /vendor/bin/rmt_storage
651    class core
652    user root
653    ioprio rt 0
654    shutdown critical
655
656service tftp_server /vendor/bin/tftp_server
657   class core
658   user root
659   group root system
660
661service modem_svc /vendor/bin/modem_svc -q
662   class core
663   user root
664   group system
665   capabilities NET_BIND_SERVICE
666
667service cnss-daemon /vendor/bin/cnss-daemon -n -l
668   class late_start
669   user system
670   group system inet wifi
671
672service imsqmidaemon /vendor/bin/imsqmidaemon
673   class main
674   user system
675   socket ims_qmid stream 0660 system radio
676   group radio log diag
677
678service imsdatadaemon /vendor/bin/imsdatadaemon
679   class main
680   user system
681   socket ims_datad stream 0660 system radio
682   group system wifi radio inet log
683   disabled
684
685on property:vendor.ims.QMI_DAEMON_STATUS=1
686   start imsdatadaemon
687
688service ims_rtp_daemon /vendor/bin/ims_rtp_daemon
689   class main
690   user system
691   group radio diag inet log
692   disabled
693
694service imsrcsservice /vendor/bin/imsrcsd
695   class main
696   user system
697   group radio diag inet log
698   disabled
699
700on property:vendor.ims.DATA_DAEMON_STATUS=1
701   start ims_rtp_daemon
702   start imsrcsservice
703
704service cnd /vendor/bin/cnd
705   class main
706   user radio
707   group system wifi inet radio wakelock
708
709service netmgrd /vendor/bin/netmgrd
710    class main
711    user root
712    group root wifi wakelock radio inet
713
714service port-bridge /vendor/bin/port-bridge
715    class main
716    user radio
717    group radio system inet
718    oneshot
719
720service ipacm /vendor/bin/ipacm
721    class main
722    user radio
723    group radio inet
724
725service loc_launcher /vendor/bin/loc_launcher
726    class late_start
727    group gps inet diag wifi
728
729service pd_mapper /vendor/bin/pd-mapper
730     class core
731
732# bugreport is triggered by holding down volume down, volume up and power
733service bugreport /system/bin/dumpstate -d -p -z
734    class main
735    disabled
736    oneshot
737    keycodes 114 115 116
738
739service devstart_sh /vendor/bin/init.qcom.devstart.sh
740    class main
741    user root
742    group root system
743    disabled
744    oneshot
745
746service ipastart_sh /vendor/bin/init.qcom.ipastart.sh
747    class main
748    user system
749    group net_admin
750    disabled
751    oneshot
752
753service insmod_sh /vendor/bin/init.insmod.sh
754    class main
755    user root
756    group root system
757    disabled
758    oneshot
759
760service msm_irqbalance /vendor/bin/msm_irqbalance -f /vendor/etc/msm_irqbalance.conf
761    socket msm_irqbalance seqpacket 660 root system
762    class core
763    user root
764    group root
765    writepid /dev/cpuset/system-background/tasks
766
767service ppd /vendor/bin/mm-pp-dpps
768    class late_start
769    user graphics
770    group graphics
771    socket pps stream 0660 system system
772    disabled
773
774service wait_for_strongbox /vendor/bin/hw/wait_for_strongbox
775    user root
776    group root system
777    priority -20
778    ioprio rt 0
779
780on property:init.svc.vendor.hwcomposer-2-3=stopped
781    stop ppd
782
783on property:init.svc.vendor.hwcomposer-2-3=running
784    start ppd
785
786on property:ro.boot.mode=sota
787    setprop ro.boot.sota enabled
788
789on property:ro.boot.hardware.sku=G013B
790    start vendor.secure_element_hal_service_1_1
791on property:ro.boot.hardware.sku=G013D
792    start vendor.secure_element_hal_service_1_1
793
794# charger driver exposes now finer grain control, map demo mode to those properties
795# demo mode can only be exit wipping data which will also reset the persist properties
796on property:sys.retaildemo.enabled=1
797    setprop persist.vendor.charge.stop.level 35
798    setprop persist.vendor.charge.start.level 30
799
800# For Japan radio builds, always enforce camera shutter sound
801# Since this property is read by the audio server in system service,
802# it should be written by the system init.
803on property:ro.boot.hardware.radio.subtype=1
804    setprop audio.camerasound.force true
805
806on property:sys.boot_completed=1 && property:ro.boot.mode=firstboot
807    start init-firstboot-sh
808
809service init-firstboot-sh /vendor/bin/init.firstboot.sh
810    user nobody
811    disabled
812    oneshot
813
814# init-fingerprint-sh is for stopping fps_hal after init retry fail serval times
815# It keeps running until max init retry or fps_hal running successfully
816# vendor.fps_hal restarts until max init retry times
817#
818# /vendor/bin/init.fingerprint.sh [max_init_retry_times]
819service init-fingerprint-sh /vendor/bin/init.fingerprint.sh 10
820    group root
821    user root
822    disabled
823    oneshot
824
825on property:sys.boot_completed=1
826    start init-fingerprint-sh
827
828on property:vendor.fps.init.succeed=true && property:init.svc.vendor.fps_hal=stopped
829    start init-fingerprint-sh
830
831on boot && property:persist.radio.multisim.config=dsds && property:persist.vendor.radio.multisim_switch_support=true
832    start vendor.qcrild2
833
834# Disable DSDS if multisim_switch_support is not enabled
835on boot && property:persist.radio.multisim.config=dsds && property:persist.vendor.radio.multisim_switch_support=false
836    setprop persist.radio.multisim.config ""
837    stop vendor.qcrild2
838
839# Write the dark theme magic to /misc partition.
840service vendor.theme_set /vendor/bin/misc_writer --set-dark-theme
841    disabled
842    oneshot
843
844# Set dark boot flag when the device is provisioned.
845on property:persist.sys.device_provisioned=1
846    start vendor.theme_set
847
848on init && property:ro.boot.slot_successful=no
849    write /sys/module/msm_poweroff/parameters/warm_reset 1
850
851# Set or clear the warm reset flag upon the change of system property. The flag itself is set
852# by writing a sysfs file; and the file will be read by kernel.
853on property:ota.warm_reset=1
854    write /sys/module/msm_poweroff/parameters/warm_reset 1
855
856on property:ota.warm_reset=0
857    write /sys/module/msm_poweroff/parameters/warm_reset 0
858