init.rc 8.14 KB
import /vendor/etc/init/hw/init.${ro.hardware}.usb.rc
import /vendor/etc/init/hw/init.${ro.hardware}.${ro.boot.soc_type}.rc
import /vendor/etc/init/hw/init.${ro.hardware}.additional.rc

on early-init
    # mount the debugfs
    mount debugfs none /sys/kernel/debug/ mode=0755

on early-init
    start early_init_sh

    # Due keymaster start very early so set prop here
    # Also gatekeeper share same role for keymaster
    setprop ro.hardware.keystore ${ro.boot.keystore}
    setprop ro.hardware.gatekeeper ${ro.boot.keystore}
    setprop vendor.storageproxyd ${ro.boot.keystore}

on init
    start watchdogd

    # Support legacy paths
    symlink /sdcard /mnt/sdcard
    symlink /sdcard /storage/sdcard0

    # setup the global environment
    export CORE_REGISTER_FILE /vendor/etc/core_register
    export COMPONENT_REGISTER_FILE /vendor/etc/component_register
    export CONTENTPIPE_REGISTER_FILE /vendor/etc/contentpipe_register

    # disable cursor blink for fbcon, if no splash screen support
    write /sys/class/graphics/fbcon/cursor_blink 0

    # deattch the fbcon as hdmi hotplug conflict with fbcon
    write /sys/class/vtconsole/vtcon1/bind 0

    chown system system /dev/stune/top-app/schedtune.boost
    chmod 664 /dev/stune/top-app/schedtune.boost
    chown system system /dev/stune/top-app/schedtune.prefer_idle
    chmod 664 /dev/stune/top-app/schedtune.prefer_idle
    chown system system /dev/stune/foreground/schedtune.boost
    chmod 664 /dev/stune/foreground/schedtune.boost
    chown system system /dev/stune/foreground/schedtune.prefer_idle
    chmod 664 /dev/stune/foreground/schedtune.prefer_idle
    chown system system /dev/stune/schedtune.boost
    chmod 664 /dev/stune/schedtune.boost

    # set default schedTune value for foreground/top-app (only affects EAS)
    write /dev/stune/foreground/schedtune.boost 10
    write /dev/stune/foreground/schedtune.prefer_idle 1
    write /dev/stune/top-app/schedtune.boost 40
    write /dev/stune/top-app/schedtune.prefer_idle 1
    write /dev/stune/rt/schedtune.boost 50
    write /dev/stune/rt/schedtune.prefer_idle 1

on late-fs
    # Start keymaster service
    start vendor.keymaster-3-0-${ro.boot.keystore}
    setprop vendor.powerhal.init 1

on late-fs && property:vendor.storageproxyd=trusty
    start vendor.oemlock-1-0

on early-boot
    # For smarc_mx8mm, when swap used about 400M, upgrade the level.
    setprop ro.lmk.upgrade_pressure 80
    setprop ro.lmk.downgrade_pressure 95
    setprop ro.lmk.critical_upgrade true

    # Set the host name which used in console
    export HOSTNAME smarc_mx8mm

    # Set permission for IIM node
    symlink /dev/mxs_viim /dev/mxc_mem

    # Enable Tethering in the Settings
    setprop ro.tether.denied false

    setprop hwc.stretch.filter  1

    # Default g2d [dpu|pxp|viv] lib to be used
    setprop vendor.imx.default-g2d viv

    # fsl omx graphic manager media framework property
    setprop rw.VIDEO_RENDER_NAME video_render.surface
    setprop media.fsl_codec.flag 7
    setprop debug.stagefright.ccodec 0

    setprop camera.disable_zsl_mode 1

    #Enable GPU 2D do CSC on imx8mm platform
    setprop vendor.camera.2d.enable true

   # Tweak the mmc device read ahead buffer size
    write /sys/block/mmcblk1/queue/read_ahead_kb 2048
    write /sys/block/mmcblk2/queue/read_ahead_kb 2048

    # Set period_us for usb audio
    setprop ro.audio.usb.period_us 20000

    # Prepare for bluetooth
    chmod 665 /sys/class/rfkill/rfkill0/state
    chown bluetooth bluetooth /sys/class/rfkill/rfkill0/state
    write /sys/class/rfkill/rfkill0/state 0

    setprop persist.service.bdroid.bdaddr 22:22:67:C6:69:73

    # Use ro.boot.lcd_density to override ro.sf.lcd_density
    setprop ro.sf.lcd_density ${ro.boot.lcd_density}

    # prepare for ril
    setprop ro.ril.wake_lock_timeout 300

    # Set tracefs permission to 755
    chmod 0755 /sys/kernel/debug/tracing

    # Set sw_sync group to graphics and set permission to 664
    chown root graphics /sys/kernel/debug/sync/sw_sync
    chmod 0664 /sys/kernel/debug/sync/sw_sync

    # Default backlight device
    setprop hw.backlight.dev "32e10000.mipi_dsi.0"
    # Chmod/chown FSL specific sys entry
    chown system system /sys/class/backlight/32e10000.mipi_dsi.0/brightness
    chmod 0660 /sys/class/backlight/32e10000.mipi_dsi.0/brightness

    # Set light sensor sysfs path and light sensor threshold lux value
    setprop ro.hardware.lightsensor "/sys/class/i2c-dev/i2c-0/device/0-0044/"
    setprop ro.lightsensor.threshold  20

    # Dectect DSF streams when scanning media
    setprop ro.FSL_DSF_PARSER 1

    # Allow DSD file(duration larger than 10s) can play
    setprop audio.offload.min.duration.secs 10

    # Enlarge limition of audio buffer allocation
    setprop ro.af.client_heap_size_kbyte 32768

    # enlarge media max memory size to 3G.
    setprop ro.media.maxmem 3221225471

    start vendor.wifi_hal_legacy

service wpa_supplicant /vendor/bin/hw/wpa_supplicant \
    -O/data/vendor/wifi/wpa/sockets -puse_p2p_group_interface=1 \
    -g@android:wpa_wlan0
    interface android.hardware.wifi.supplicant@1.0::ISupplicant default
    interface android.hardware.wifi.supplicant@1.1::ISupplicant default
    interface android.hardware.wifi.supplicant@1.2::ISupplicant default
    class main
    socket wpa_wlan0 dgram 660 wifi wifi
    disabled
    oneshot

service sensor_fusion /vendor/bin/fsl_sensor_fusion
    class late_start
    seclabel u:r:sensors:s0
    user system
    group input
    oneshot

# Set watchdog timer to 30 seconds and pet it every 10 seconds to get a 20 second margin
service watchdogd /sbin/watchdogd 10 20
    class core
    seclabel u:r:watchdogd:s0

service dhcpcd_wlan0 /system/bin/dhcpcd -aABDKL
    class main
    disabled
    oneshot

service dhcpcd_p2p /system/bin/dhcpcd -aABKL
    class main
    disabled
    oneshot

service dhcpcd_eth0 /system/bin/dhcpcd -ABKL eth0
    class main
    disabled
    oneshot

service dhcpcd_bt-pan /system/bin/dhcpcd -ABKL
    class main
    disabled
    oneshot

service iprenew_wlan0 /system/bin/dhcpcd -n
    class main
    disabled
    oneshot

service iprenew_p2p /system/bin/dhcpcd -n
    class main
    disabled
    oneshot

service iprenew_eth0 /system/bin/dhcpcd -n eth0
    class main
    disabled
    oneshot

service iprenew_bt-pan /system/bin/dhcpcd -n
    class main
    disabled
    oneshot

# 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
    keycodes 114 115 116

on boot
    start audioserver
    start mediadrm
    start media
    start drm

on fs
# mount ext4 partitions
    mount_all /vendor/etc/fstab.freescale

    # Adjust parameters for dm-verity device
    write /sys/block/dm-0/queue/read_ahead_kb 4096

    # Update dm-verity state and set partition.*.verified properties
    verity_update_state

on verity-logging
    exec u:r:slideshow:s0 -- /sbin/slideshow warning/verity_red_1 warning/verity_red_2

on post-fs
    # Set netd memlock rlimit to 8MB
    setrlimit 8 8388608 8388608

    # Turn on swap
    swapon_all /vendor/etc/fstab.freescale

    # Swap in only 1 page at a time
    write /proc/sys/vm/page-cluster 0

on post-fs-data
    setprop vold.post_fs_data_done 1
    # create temp node for secure storage proxy
    mkdir /data/vendor/ss 0700 system system

on zygote-start
    # 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

service early_init_sh /vendor/bin/init.insmod.sh /vendor/etc/early.init.cfg sys.all.early_init.ready
    class main
    user root
    group root system
    disabled
    oneshot

on property:sys.boot_completed=1 && property:vendor.storageproxyd=trusty
    start storageproxyd

service storageproxyd /vendor/bin/storageproxyd -p /data/vendor/ss -r /dev/mmcblk2rpmb -d /dev/trusty-ipc-dev0
   group system

on property:ro.boot.vendor.sysrq=1
    write /proc/sys/kernel/sysrq 1