1# 2# Copyright 2015 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 init.angler.usb.rc 18import init.angler.diag.rc 19import init.angler.sensorhub.rc 20 21on early-init 22 mount debugfs debugfs /sys/kernel/debug 23 chown system system /sys/kernel/debug/kgsl/proc 24 25on init 26 # Load persistent dm-verity state 27 verity_load_state 28 29 # Set permissions for persist partition 30 mkdir /persist 0771 system system 31 mkdir /firmware 0771 system system 32 33 symlink /sdcard /storage/sdcard0 34 35 # Setup zram options 36 write /sys/block/zram0/comp_algorithm lz4 37 write /sys/block/zram0/max_comp_streams 4 38 39 write /proc/sys/vm/page-cluster 0 40 41on fs 42 mount_all ./fstab.angler 43 swapon_all ./fstab.angler 44 45 restorecon_recursive /persist 46 mkdir /persist/data/sfs 0700 system system 47 mkdir /persist/data/tz 0700 system system 48 49 # Enable rmnet data and aggregation 50 setprop persist.rmnet.mux enabled 51 setprop persist.rmnet.data.enable true 52 setprop persist.data.wda.enable true 53 setprop persist.data.df.agg.dl_pkt 10 54 setprop persist.data.df.agg.dl_size 4096 55 56on early-boot 57 # set RLIMIT_MEMLOCK to 64MB 58 setrlimit 8 67108864 67108864 59 60 # Update dm-verity state and set partition.*.verified properties 61 verity_update_state 62 63on boot 64 # execute script to set initial CPU settings 65 # don't run as a service to avoid race conditions 66 exec - root system -- /system/bin/init.angler.power.sh 67 68 # Enable DEBUG_SUSPEND, DEBUG_EXIT_SUSPEND, and DEBUG_WAKEUP 69 write /sys/module/wakelock/parameters/debug_mask 7 70 71 # add a cpuset for the camera daemon 72 # we want all the little cores for camera 73 mkdir /dev/cpuset/camera-daemon 74 write /dev/cpuset/camera-daemon/cpus 0 75 write /dev/cpuset/camera-daemon/mems 0 76 chown system system /dev/cpuset/camera-daemon 77 chown system system /dev/cpuset/camera-daemon/tasks 78 chmod 0664 /dev/cpuset/camera-daemon/tasks 79 80 # update foreground cpuset now that processors are up 81 # reserve CPU 3 for the top app and camera daemon 82 write /dev/cpuset/foreground/cpus 0-2,4-7 83 write /dev/cpuset/foreground/boost/cpus 4-7 84 write /dev/cpuset/background/cpus 0 85 write /dev/cpuset/system-background/cpus 0-2 86 write /dev/cpuset/top-app/cpus 0-7 87 write /dev/cpuset/camera-daemon/cpus 0-3 88 89 # setup permissions for fb0 related nodes 90 chown radio radio /sys/class/graphics/fb0/dynamic_dsitiming 91 92 # create symlink for fb1 as HDMI 93 symlink /dev/graphics/fb1 /dev/graphics/hdmi 94 95 # setup permissions for fb1 related nodes 96 chown system graphics /sys/class/graphics/fb1/hpd 97 chown system graphics /sys/class/graphics/fb1/vendor_name 98 chown system graphics /sys/class/graphics/fb1/product_description 99 chmod 0664 /sys/devices/virtual/graphics/fb1/hpd 100 chmod 0664 /sys/devices/virtual/graphics/fb1/vendor_name 101 chmod 0664 /sys/devices/virtual/graphics/fb1/product_description 102 103 #Create QMUX deamon socket 104 mkdir /dev/socket/qmux_radio 0770 radio radio 105 chmod 2770 /dev/socket/qmux_radio 106 mkdir /dev/socket/qmux_audio 0770 media audio 107 chmod 2770 /dev/socket/qmux_audio 108 mkdir /dev/socket/qmux_gps 0770 gps gps 109 chmod 2770 /dev/socket/qmux_gps 110 111 setprop wifi.interface wlan0 112 113 #wifi sar 114 chown radio radio /sys/module/wifi_sar/parameters/wifi_tx_power_limit 115 116 #compass compensation 117 chown root system /sys/class/power_supply/battery/compass_compensation 118 119 write /sys/bus/platform/drivers/xhci_msm_hsic/unbind msm_hsic_host 120 write /sys/module/rmnet_usb/parameters/mux_enabled 1 121 write /sys/module/rmnet_usb/parameters/no_fwd_rmnet_links 8 122 write /sys/module/rmnet_usb/parameters/no_rmnet_insts_per_dev 17 123 write /sys/module/rmnet_usb/parameters/rmnet_data_init 1 124 chown radio radio /sys/devices/virtual/hsicctl/hsicctl0/modem_wait 125 126 # Assign TCP buffer thresholds to be ceiling value of technology maximums 127 # Increased technology maximums should be reflected here. 128 write /proc/sys/net/core/rmem_max 8388608 129 write /proc/sys/net/core/wmem_max 8388608 130 131 # Leds 132 chown system system /sys/class/leds/red/on_off_ms 133 chown system system /sys/class/leds/green/on_off_ms 134 chown system system /sys/class/leds/blue/on_off_ms 135 chown system system /sys/class/leds/red/rgb_start 136 137 # GPU Tuning 138 chown root system /sys/class/kgsl/kgsl-3d0/dispatch/inflight 139 chmod 0660 /sys/class/kgsl/kgsl-3d0/dispatch/inflight 140 chown root system /sys/class/kgsl/kgsl-3d0/dispatch/inflight_low_latency 141 chmod 0660 /sys/class/kgsl/kgsl-3d0/dispatch/inflight_low_latency 142 143 write /sys/block/mmcblk0/queue/rq_affinity 0 144 write /sys/block/mmcblk0/queue/scheduler noop 145 146on property:init.svc.per_mgr=running 147 start per_proxy 148 149on property:sys.shutdown.requested=* 150 stop per_proxy 151 152on post-fs 153 symlink /dev/block/platform/soc.0/f9824900.sdhci /dev/block/bootdevice 154 155 start qseecomd 156 exec - root root system -- /system/bin/init.angler.qseecomd.sh 157 158on post-fs-data 159 write /sys/kernel/boot_adsp/boot 1 160 161 # Ecc_Handler qcril.db 162 mkdir /data/misc/radio 0770 system radio 163 164 setprop vold.post_fs_data_done 1 165 166 mkdir /data/misc/qsee 0770 system system 167 mkdir /data/fpc 0700 system system 168 169 #Create folder for mm-qcamera-daemon 170 mkdir /data/misc/camera 0770 camera camera 171 172 #Create folder for display calibration data 173 mkdir /data/misc/display 0770 system graphics 174 175 # Create /data/time folder for time-services 176 mkdir /data/time/ 0700 system system 177 mkdir /data/audio/ 0770 media audio 178 179 # Create folder for perf daemon 180 mkdir /data/misc/perfd 0755 root system 181 chmod 2755 /data/misc/perfd 182 mkdir /data/system/perfd 0770 root system 183 rm /data/system/perfd/default_values 184 chmod 2770 /data/system/perfd 185 setprop ro.min_freq_0 384000 186 setprop ro.min_freq_4 384000 187 188 # Create the directories used by CnE subsystem 189 mkdir /data/connectivity 0771 system system 190 chown system system /data/connectivity 191 192 #Create directory from IMS services 193 mkdir /data/shared 0755 194 chown system system /data/shared 195 196 # Mark the copy complete flag to not completed 197 write /data/misc/radio/copy_complete 0 198 chown radio radio /data/misc/radio/copy_complete 199 chmod 0660 /data/misc/radio/copy_complete 200 201 # Configure bluetooth 202 chmod 0660 /proc/bluetooth/sleep/lpm 203 chmod 0660 /proc/bluetooth/sleep/btwrite 204 chmod 0660 /sys/class/rfkill/rfkill0/state 205 chmod 0660 /dev/ttyHS0 206 chown bluetooth net_bt_stack /proc/bluetooth/sleep/lpm 207 chown bluetooth net_bt_stack /proc/bluetooth/sleep/btwrite 208 chown bluetooth net_bt_stack /sys/class/rfkill/rfkill0/state 209 chown bluetooth net_bt_stack /dev/ttyHS0 210 211 # Create nfc local data 212 mkdir /data/nfc 0770 nfc nfc 213 214 #modify access for speaker calibdata 215 chown system system /persist/audio/speaker_calibdata.bin 216 chmod 0444 /persist/audio/speaker_calibdata.bin 217 218 #modify access for laser calibration data 219 chmod 0710 /persist/data 220 chmod 0440 /persist/data/st_offset 221 chmod 0440 /persist/data/st_xtalk 222 223 chown system system /sys/class/kgsl/kgsl-3d0/devfreq/max_freq 224 chmod 0660 /sys/class/kgsl/kgsl-3d0/devfreq/max_freq 225 chown system system /sys/class/kgsl/kgsl-3d0/devfreq/min_freq 226 chmod 0660 /sys/class/kgsl/kgsl-3d0/devfreq/min_freq 227 chown system system /sys/class/devfreq/qcom,gpubw.70/min_freq 228 chmod 0660 /sys/class/devfreq/qcom,gpubw.70/min_freq 229 chown system system /sys/devices/system/cpu/cpu4/online 230 chmod 0660 /sys/devices/system/cpu/cpu4/online 231 chown system system /sys/devices/system/cpu/cpu5/online 232 chmod 0660 /sys/devices/system/cpu/cpu5/online 233 chown system system /sys/devices/system/cpu/cpu6/online 234 chmod 0660 /sys/devices/system/cpu/cpu6/online 235 chown system system /sys/devices/system/cpu/cpu7/online 236 chmod 0660 /sys/devices/system/cpu/cpu7/online 237on charger 238 #set cpu4,5 online first, or they can't get into low power consumption mode 239 write /sys/devices/system/cpu/cpu4/online 1 240 write /sys/devices/system/cpu/cpu5/online 1 241 #low power governing 242 write /sys/devices/soc.0/qcom,bcl.60/mode disable 243 write /sys/devices/soc.0/qcom,bcl.60/hotplug_mask 0 244 write /sys/devices/soc.0/qcom,bcl.60/hotplug_soc_mask 0 245 write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor interactive 246 write /sys/devices/system/cpu/cpu1/online 0 247 write /sys/devices/system/cpu/cpu2/online 0 248 write /sys/devices/system/cpu/cpu3/online 0 249 write /sys/devices/system/cpu/cpu4/online 0 250 write /sys/devices/system/cpu/cpu5/online 0 251 write /sys/devices/system/cpu/cpu6/online 0 252 write /sys/devices/system/cpu/cpu7/online 0 253 254on property:sys.boot_completed=1 255 #allow CPUs to go in deeper idle state than C0 256 write /sys/module/lpm_levels/parameters/sleep_disabled 0 257 258# Search the laser device under /dev/input, then create symlink 259service InputEventFind /vendor/bin/InputEventFind 260 class main 261 oneshot 262 263service ssr_setup /system/bin/ssr_setup 264 oneshot 265 disabled 266 267service ss_ramdump /system/bin/subsystem_ramdump 268 class main 269 user system 270 group system 271 disabled 272 273on property:persist.sys.ssr.restart_level=* 274 start ssr_setup 275 276on property:persist.sys.ssr.enable_ramdumps=1 277 write /sys/module/subsystem_restart/parameters/enable_ramdumps 1 278 start ss_ramdump 279 280on property:persist.sys.ssr.enable_ramdumps=0 281 write /sys/module/subsystem_restart/parameters/enable_ramdumps 0 282 283service charger /sbin/healthd -c 284 class charger 285 group log 286 seclabel u:r:healthd:s0 287 writepid /dev/cpuset/system-background/tasks 288 289service per_mgr /vendor/bin/pm-service 290 class core 291 user root 292 group system net_raw 293 writepid /dev/cpuset/system-background/tasks 294 295service per_proxy /vendor/bin/pm-proxy 296 class core 297 user root 298 group system net_raw 299 writepid /dev/cpuset/system-background/tasks 300 disabled 301 302service rmt_storage /vendor/bin/rmt_storage 303 class core 304 user root 305 group system wakelock 306 writepid /dev/cpuset/system-background/tasks 307 308service qseecomd /vendor/bin/qseecomd 309 class core 310 user root 311 group root 312 writepid /dev/cpuset/system-background/tasks 313 314service irsc_util /vendor/bin/irsc_util "/vendor/etc/sec_config" 315 class main 316 user root 317 oneshot 318 319service thermal-engine /vendor/bin/thermal-engine 320 class main 321 user root 322 socket thermal-send-client stream 0660 system system 323 socket thermal-recv-client stream 0660 system system 324 socket thermal-recv-passive-client stream 0660 system system 325 group root radio system 326 writepid /dev/cpuset/system-background/tasks 327 328# QMUX must be in multiple groups to support external process connections 329service qmuxd /vendor/bin/qmuxd 330 class main 331 user radio 332 group radio audio bluetooth wakelock gps 333 writepid /dev/cpuset/system-background/tasks 334 335service perfd /vendor/bin/perfd 336 class main 337 user root 338 group system 339 writepid /dev/cpuset/system-background/tasks 340 341service netmgrd /vendor/bin/netmgrd 342 class main 343 group radio system wakelock 344 writepid /dev/cpuset/system-background/tasks 345 346service qti /vendor/bin/qti 347 class main 348 user radio 349 group radio net_raw usb net_admin 350 writepid /dev/cpuset/system-background/tasks 351 352service time_daemon /vendor/bin/time_daemon 353 class late_start 354 user root 355 group root 356 writepid /dev/cpuset/system-background/tasks 357 358service loc_launcher /vendor/bin/loc_launcher 359 class late_start 360 group gps inet net_raw net_admin wifi 361 writepid /dev/cpuset/system-background/tasks 362 363# bugreport is triggered by holding down volume down, volume up and power 364service bugreport /system/bin/dumpstate -d -p -B -z \ 365 -o /data/user_de/0/com.android.shell/files/bugreports/bugreport 366 class main 367 disabled 368 oneshot 369 keycodes 114 115 116 370 371# start camera server as daemon 372service qcamerasvr /vendor/bin/mm-qcamera-daemon 373 class late_start 374 user camera 375 group camera system inet input graphics 376 writepid /dev/cpuset/camera-daemon/tasks 377 378service fingerprintd /system/bin/fingerprintd 379 class late_start 380 user system 381 group input 382 writepid /dev/cpuset/system-background/tasks 383 384service p2p_supplicant /system/bin/wpa_supplicant \ 385 -iwlan0 -Dnl80211 -c/data/misc/wifi/wpa_supplicant.conf \ 386 -I/system/etc/wifi/p2p_supplicant_overlay.conf \ 387 -O/data/misc/wifi/sockets \ 388 -m/data/misc/wifi/p2p_supplicant.conf \ 389 -puse_p2p_group_interface=1p2p_device=1 \ 390 -e/data/misc/wifi/entropy.bin -g@android:wpa_wlan0 391 class main 392 socket wpa_wlan0 dgram 660 wifi wifi 393 disabled 394 oneshot 395 396service wpa_supplicant /system/bin/wpa_supplicant \ 397 -iwlan0 -Dnl80211 -c/data/misc/wifi/wpa_supplicant.conf \ 398 -I/system/etc/wifi/wpa_supplicant_overlay.conf \ 399 -e/data/misc/wifi/entropy.bin -g@android:wpa_wlan0 400 class main 401 socket wpa_wlan0 dgram 660 wifi wifi 402 disabled 403 oneshot 404 405service imsqmidaemon /system/bin/imsqmidaemon 406 class main 407 user system 408 socket ims_qmid stream 0660 system radio 409 group radio net_raw log diag 410 writepid /dev/cpuset/system-background/tasks 411 412service imsdatadaemon /system/bin/imsdatadaemon 413 class main 414 user system 415 socket ims_datad stream 0660 system radio 416 group system wifi radio inet net_raw log diag net_admin 417 writepid /dev/cpuset/system-background/tasks 418 disabled 419 420on property:sys.ims.QMI_DAEMON_STATUS=1 421 start imsdatadaemon 422 423service imscmservice /system/bin/imscmservice 424 class main 425 user system 426 group radio net_raw diag diag log 427 writepid /dev/cpuset/system-background/tasks 428 429service cnd /vendor/bin/cnd 430 class late_start 431 socket cnd stream 660 root inet 432 group root wakelock 433 writepid /dev/cpuset/system-background/tasks 434 435on property:ro.boot.hardware.revision=ANGLER-V1 436 write /sys/module/bcmdhd/parameters/nvram_path \ 437 /system/etc/wifi/bcmdhd-pme.cal 438 439on property:ro.boot.hardware.revision=ANGLER-V2 440 write /sys/module/bcmdhd/parameters/nvram_path \ 441 /system/etc/wifi/bcmdhd-pme.cal 442 443on property:ro.boot.wifi_cal=2 444 write /sys/module/bcmdhd/parameters/nvram_path \ 445 /system/etc/wifi/bcmdhd-low.cal 446 447on property:ro.boot.wifi_cal=3 448 write /sys/module/bcmdhd/parameters/nvram_path \ 449 /system/etc/wifi/bcmdhd-high.cal 450 451on property:ro.boot.hardware.sku=H1511 452 setprop ro.boot.wificountrycode US 453 454service mcfg-sh /system/bin/init.mcfg.sh 455 class late_start 456 user radio 457 group radio system 458 oneshot 459 460service oem_qmi_server /vendor/bin/oem_qmi_server 461 class main 462 user root 463 group system radio 464 465service msm_irqbalance /vendor/bin/msm_irqbalance -f /vendor/etc/msm_irqbalance.conf 466 socket msm_irqbalance seqpacket 660 root system 467 class core 468 user root 469 group root 470 writepid /dev/cpuset/system-background/tasks 471 472#start atfwd as daemon 473service atfwd /vendor/bin/ATFWD-daemon 474 class late_start 475 user system 476 group system radio 477 478service ppd /system/bin/mm-pp-daemon 479 class late_start 480 user system 481 socket pps stream 0660 system system 482 group system graphics 483 484on property:init.svc.surfaceflinger=stopped 485 stop ppd 486 487service diag_test_server /vendor/bin/diag_test_server 488 class core 489 user root 490 disabled 491 492on property:ro.boot.mode=hw-factory 493 start diag_test_server 494 495