Skip to content
Snippets Groups Projects
init.target.rc 7.92 KiB
Newer Older

# Copyright (c) 2019-2020, The Linux Foundation. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#     * Redistributions of source code must retain the above copyright
#       notice, this list of conditions and the following disclaimer.
#     * Redistributions in binary form must reproduce the above
#       copyright notice, this list of conditions and the following
#       disclaimer in the documentation and/or other materials provided
#       with the distribution.
#     * Neither the name of The Linux Foundation nor the names of its
#       contributors may be used to endorse or promote products derived
#       from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
# ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
#

import /vendor/etc/init/hw/init.qti.kernel.rc
import /vendor/etc/init/hw/init.mi_thermald.rc
import /vendor/etc/init/hw/init.batterysecret.rc

    exec u:r:vendor_modprobe:s0 -- /vendor/bin/vendor_modprobe.sh
    wait /sys/devices/soc0/soc_id
    # Scheduler uclamp
    mkdir /dev/cpuctl/foreground
    mkdir /dev/cpuctl/background
    mkdir /dev/cpuctl/top-app
    mkdir /dev/cpuctl/rt
    chown system system /dev/cpuctl
    chown system system /dev/cpuctl/foreground
    chown system system /dev/cpuctl/background
    chown system system /dev/cpuctl/top-app
    chown system system /dev/cpuctl/rt
    chown system system /dev/cpuctl/tasks
    chown system system /dev/cpuctl/foreground/tasks
    chown system system /dev/cpuctl/background/tasks
    chown system system /dev/cpuctl/top-app/tasks
    chown system system /dev/cpuctl/rt/tasks
    chmod 0664 /dev/cpuctl/tasks
    chmod 0664 /dev/cpuctl/foreground/tasks
    chmod 0664 /dev/cpuctl/background/tasks
    chmod 0664 /dev/cpuctl/top-app/tasks
    chmod 0664 /dev/cpuctl/rt/tasks
    write /dev/cpuctl/foreground/cpu.rt_runtime_us 950000
    write /dev/cpuctl/background/cpu.rt_runtime_us 950000
    write /dev/cpuctl/top-app/cpu.rt_runtime_us 950000
    write /dev/cpuctl/rt/cpu.rt_runtime_us 950000

    wait /dev/block/platform/soc/${ro.boot.bootdevice}
    symlink /dev/block/platform/soc/${ro.boot.bootdevice} /dev/block/bootdevice
    chown system system /sys/devices/platform/soc/1d84000.ufshc/auto_hibern8
    chmod 0660 /sys/devices/platform/soc/1d84000.ufshc/auto_hibern8
    exec_background u:r:vendor_modprobe:s0 -- /vendor/bin/modprobe -a -d /vendor/lib/modules/ cnss2

on fs
    start hwservicemanager
    mkdir /mnt/vendor/spunvm 0660 system system
    chown root system /mnt/vendor/persist
    chmod 0771 /mnt/vendor/persist
    restorecon_recursive /mnt/vendor/persist
    mkdir /mnt/vendor/persist/data 0700 system system
    mkdir /mnt/vendor/persist/haptics 0755 system system
    mkdir /mnt/vendor/persist/audio 0755 system system
on fs && property:ro.boot.product.vendor.sku=lahaina
    mkdir /mnt/vendor/spunvm 0660 system system
    wait /dev/block/bootdevice/by-name/spunvm
    mount vfat /dev/block/bootdevice/by-name/spunvm /mnt/vendor/spunvm rw noatime shortname=lower,uid=1000,gid=1000,dmask=007,fmask=007,context=u:object_r:vendor_spunvm_file:s0

    # Set RLIMIT_MEMLOCK to 64MB
    setrlimit 8 67108864 67108864

on late-fs
    wait_for_prop hwservicemanager.ready true
    mkdir /vendor/data/tombstones 0771 system system
    chmod 0644 /dev/elliptic0
    chmod 0644 /dev/elliptic1
    chmod 0660 /dev/ir_spi
    chown system system /dev/ir_spi
    mkdir /data/vendor/thermal 0771 root system
    mkdir /data/vendor/thermal/config 0771 root system
    mkdir /data/vendor/wlan_logs 0777 root shell
    mkdir /data/vendor/nfc 0777 nfc nfc

    # Create fingerprint related directory
    mkdir /data/vendor/fpc 0770 system system
    mkdir /mnt/vendor/persist/fpc 0770 system system
    mkdir /data/vendor/goodix 0770 system system
    mkdir /mnt/vendor/persist/goodix 0770 system system
    mkdir /data/vendor/fpdump 0770 system system
on early-boot
    # Enable WLAN cold boot calibration
    write /sys/devices/platform/soc/b0000000.qcom,cnss-qca6490/fs_ready 1

    start vendor.sensors
    chown system system /sys/class/thermal/thermal_message/sconfig
    chown system system /sys/class/thermal/thermal_message/balance_mode
    chown system system /sys/class/thermal/thermal_message/charger_temp
    chown system system /sys/devices/virtual/touch/tp_dev/double_tap
    chown cameraserver cameraserver /sys/class/thermal/thermal_message/flash_state
    # Set xiaomi touch permissions
    chown system system /dev/xiaomi-touch
    chmod 0660 /dev/xiaomi-touch

    write /dev/cpuset/audio-app/cpus 1-2
    # init the  cpuset value for the camera background,don't change the oder
    write /dev/cpuset/camera-background/background/cpus 0-2
    write /dev/cpuset/camera-background/cpus 0-3
    chown system /sys/devices/system/cpu/hyp_core_ctl/enable
    chown system /sys/devices/system/cpu/hyp_core_ctl/hcc_min_freq

    write /sys/block/sda/queue/wbt_lat_usec 75000

    # Set fingerprint related permissions
    chown system system /sys/devices/platform/soc/soc:qcom,dsi-display-primary/fod_hbm
    chown system system /sys/devices/platform/soc/soc:qcom,dsi-display-primary/fod_ui
    chown system system /sys/devices/virtual/touch/tp_dev/fod_status
    chown system system /sys/bus/platform/devices/soc:fingerprint_fpc/irq
    chown system system /sys/bus/platform/devices/soc:fingerprint_fpc/irq_enable
    chown system system /sys/bus/platform/devices/soc:fingerprint_fpc/wakeup_enable
    chown system system /sys/bus/platform/devices/soc:fingerprint_fpc/hw_reset
    chown system system /sys/bus/platform/devices/soc:fingerprint_fpc/device_prepare
    chown system system /sys/bus/platform/devices/soc:fingerprint_fpc/fingerdown_wait
    chown system system /sys/bus/platform/devices/soc:fingerprint_fpc/vendor
    chown system system /sys/bus/platform/devices/soc:fingerprint_fpc/request_vreg
    chown system system /sys/bus/platform/devices/soc:fingerprint_fpc/simulate_irq
    chown system system /sys/bus/platform/devices/soc:fingerprint_fpc/finger_irq
    chown system system /sys/bus/platform/devices/soc:fingerprint_fpc/power_cfg

on init && property:ro.boot.mode=charger
    mount_all /vendor/etc/charger_fstab.qcom --early
    write /sys/kernel/boot_adsp/boot 1
    wait /sys/class/power_supply/battery

    start vendor.power_off_alarm
    setprop sys.usb.controller a600000.dwc3
    setprop sys.usb.configfs 1
    write /sys/module/lpm_levels/parameters/sleep_disabled N

service vendor.lowi /vendor/bin/lowirpcd
   class core
   user system
   group system wakelock
   capabilities BLOCK_SUSPEND
service vendor.pd_mapper /vendor/bin/pd-mapper
    class core
    user system
    group system

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:init.svc.vendor.per_mgr=running
    start vendor.per_proxy
on property:sys.shutdown.requested=*
    stop vendor.per_proxy
service vendor.nv_mac /vendor/bin/nv_mac
    class late_start
    user system
    group system inet net_admin wifi net_raw