1# 2# Copyright 2013 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.hammerhead.usb.rc 18 19on early-init 20 mount debugfs debugfs /sys/kernel/debug 21 chown system system /sys/kernel/debug/kgsl/proc 22 23on init 24 # See storage config details at http://source.android.com/tech/storage/ 25 mkdir /mnt/shell/emulated 0700 shell shell 26 mkdir /storage/emulated 0555 root root 27 28 # Set permissions for persist partition 29 mkdir /persist 0771 system system 30 mkdir /firmware 0771 system system 31 32 export EXTERNAL_STORAGE /storage/emulated/legacy 33 export EMULATED_STORAGE_SOURCE /mnt/shell/emulated 34 export EMULATED_STORAGE_TARGET /storage/emulated 35 36 # Support legacy paths 37 symlink /storage/emulated/legacy /sdcard 38 symlink /storage/emulated/legacy /mnt/sdcard 39 symlink /storage/emulated/legacy /storage/sdcard0 40 symlink /mnt/shell/emulated/0 /storage/emulated/legacy 41 42on fs 43 mount_all ./fstab.hammerhead 44 setprop ro.crypto.fuse_sdcard true 45 write /sys/kernel/boot_adsp/boot 1 46 47on early-boot 48 # set RLIMIT_MEMLOCK to 64MB 49 setrlimit 8 67108864 67108864 50 51on boot 52 # Enable DEBUG_SUSPEND, DEBUG_EXIT_SUSPEND, and DEBUG_WAKEUP 53 write /sys/module/wakelock/parameters/debug_mask 7 54 55 # bluetooth 56 chown bluetooth net_bt_stack /sys/class/rfkill/rfkill0/type 57 chown bluetooth net_bt_stack /sys/class/rfkill/rfkill0/state 58 chmod 0660 /sys/class/rfkill/rfkill0/state 59 60 # bluetooth LPM 61 chown bluetooth net_bt_stack /proc/bluetooth/sleep/lpm 62 chown bluetooth net_bt_stack /proc/bluetooth/sleep/btwrite 63 64 #bluetooth UART dev 65 chown bluetooth net_bt_stack /sys/devices/platform/msm_serial_hs.0/clock 66 chmod 0660 /sys/devices/platform/msm_serial_hs.0/clock 67 68 #Create QMUX deamon socket area 69 mkdir /dev/socket/qmux_radio 0770 radio radio 70 chmod 2770 /dev/socket/qmux_radio 71 mkdir /dev/socket/qmux_audio 0770 media audio 72 chmod 2770 /dev/socket/qmux_audio 73 mkdir /dev/socket/qmux_bluetooth 0770 bluetooth bluetooth 74 chmod 2770 /dev/socket/qmux_bluetooth 75 mkdir /dev/socket/qmux_gps 0770 gps gps 76 chmod 2770 /dev/socket/qmux_gps 77 78 # Camera Recording 79 mkdir /dev/video 80 symlink /dev/video32 /dev/video/venus_dec 81 symlink /dev/video33 /dev/video/venus_enc 82 83 # Allow QMUX daemon to assign port open wait time 84 chown radio radio /sys/devices/virtual/hsicctl/hsicctl0/modem_wait 85 86 #For bridgemgr daemon to inform the USB driver of the correct transport 87 chown radio radio /sys/class/android_usb/f_rmnet_smd_sdio/transport 88 89 # Assign TCP buffer thresholds to be ceiling value of technology maximums 90 # Increased technology maximums should be reflected here. 91 write /proc/sys/net/core/rmem_max 2097152 92 write /proc/sys/net/core/wmem_max 2097152 93 94 # Define TCP buffer sizes 95 # ReadMin, ReadInitial, ReadMax, WriteMin, WriteInitial, WriteMax 96 setprop net.tcp.buffersize.hsdpa 4094,87380,704512,4096,16384,110208 97 setprop net.tcp.buffersize.hspa 4094,87380,704512,4096,16384,110208 98 setprop net.tcp.buffersize.hsupa 4094,87380,704512,4096,16384,110208 99 100 # create symlink for fb1 as HDMI 101 symlink /dev/graphics/fb1 /dev/graphics/hdmi 102 103 # setup permissions for fb1 related nodes 104 chown system graphics /sys/class/graphics/fb1/hpd 105 chown system graphics /sys/class/graphics/fb1/vendor_name 106 chown system graphics /sys/class/graphics/fb1/product_description 107 chmod 0664 /sys/devices/virtual/graphics/fb1/hpd 108 chmod 0664 /sys/devices/virtual/graphics/fb1/vendor_name 109 chmod 0664 /sys/devices/virtual/graphics/fb1/product_description 110 111 # To allow interfaces to get v6 address when tethering is enabled 112 write /proc/sys/net/ipv6/conf/rmnet0/accept_ra 2 113 write /proc/sys/net/ipv6/conf/rmnet1/accept_ra 2 114 write /proc/sys/net/ipv6/conf/rmnet2/accept_ra 2 115 write /proc/sys/net/ipv6/conf/rmnet3/accept_ra 2 116 write /proc/sys/net/ipv6/conf/rmnet4/accept_ra 2 117 write /proc/sys/net/ipv6/conf/rmnet5/accept_ra 2 118 write /proc/sys/net/ipv6/conf/rmnet6/accept_ra 2 119 write /proc/sys/net/ipv6/conf/rmnet7/accept_ra 2 120 121 # Subsytem Restart 122 #adsp 123 write /sys/bus/msm_subsys/devices/subsys0/restart_level "related" 124 #modem 125 write /sys/bus/msm_subsys/devices/subsys1/restart_level "related" 126 #venus 127 write /sys/bus/msm_subsys/devices/subsys2/restart_level "related" 128 129 # leds 130 chown system system /sys/class/leds/red/on_off_ms 131 chown system system /sys/class/leds/green/on_off_ms 132 chown system system /sys/class/leds/blue/on_off_ms 133 chown system system /sys/class/leds/red/rgb_start 134 135on post-fs-data 136 mkdir /data/media 0770 media_rw media_rw 137 138 # NFC: create data/nfc for nv storage 139 mkdir /data/nfc 0770 nfc nfc 140 mkdir /data/nfc/param 0770 nfc nfc 141 142 # wifi 143 chown wifi system /persist/wifi 144 145 # bluetooth 146 mkdir /data/misc/bluetooth 0770 bluetooth bluetooth 147 148 # Create directory used by audio subsystem 149 mkdir /data/misc/audio 0770 audio audio 150 151 # Create directory used by sensor subsystem 152 mkdir /data/system 0755 system system 153 mkdir /data/system/sensors 154 chmod 655 /data/system/sensors 155 write /data/system/sensors/settings 1 156 chmod 660 /data/system/sensors/settings 157 158 # AKM setting data 159 mkdir /data/misc/sensors 160 chmod 775 /data/misc/sensors 161 162 # Sensor 163 mkdir /persist/sensors 164 chmod 775 /persist/sensors 165 166 # Create the directories used by the Wireless subsystem 167 mkdir /data/misc/wifi 0770 wifi wifi 168 mkdir /data/misc/wifi/sockets 0770 wifi wifi 169 mkdir /data/misc/wifi/wpa_supplicant 0770 wifi wifi 170 mkdir /data/misc/dhcp 0770 dhcp dhcp 171 chown dhcp dhcp /data/misc/dhcp 172 173 # communicate with mpdecision and thermald 174 mkdir /dev/socket/mpdecision 0770 system system 175 chmod 2770 /dev/socket/mpdecision 176 177 # save rtc time offsets 178 mkdir /data/system/time/ 0700 system system 179 180 # Ecc_Handler qcril.db 181 mkdir /data/misc/radio 0770 radio radio 182 symlink /system/etc/qcril.db /data/misc/radio/qcril.db 183 184 setprop vold.post_fs_data_done 1 185 186 # Set the CPU Freq Sampling rates 187 write /sys/module/msm_thermal/core_control/enabled 0 188 write /sys/devices/system/cpu/cpu1/online 1 189 write /sys/devices/system/cpu/cpu2/online 1 190 write /sys/devices/system/cpu/cpu3/online 1 191 write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor "ondemand" 192 write /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor "ondemand" 193 write /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor "ondemand" 194 write /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor "ondemand" 195 write /sys/devices/system/cpu/cpufreq/ondemand/up_threshold 90 196 write /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate 50000 197 write /sys/devices/system/cpu/cpufreq/ondemand/io_is_busy 1 198 write /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor 4 199 write /sys/devices/system/cpu/cpufreq/ondemand/down_differential 10 200 write /sys/devices/system/cpu/cpufreq/ondemand/up_threshold_multi_core 70 201 write /sys/devices/system/cpu/cpufreq/ondemand/down_differential_multi_core 3 202 write /sys/devices/system/cpu/cpufreq/ondemand/optimal_freq 960000 203 write /sys/devices/system/cpu/cpufreq/ondemand/sync_freq 960000 204 write /sys/devices/system/cpu/cpufreq/ondemand/up_threshold_any_cpu_load 80 205 write /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq 300000 206 write /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq 300000 207 write /sys/devices/system/cpu/cpu2/cpufreq/scaling_min_freq 300000 208 write /sys/devices/system/cpu/cpu3/cpufreq/scaling_min_freq 300000 209 chown system /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq 210 chown system /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq 211 write /sys/module/msm_thermal/core_control/enabled 1 212 chown root.system /sys/devices/system/cpu/mfreq 213 chmod 220 /sys/devices/system/cpu/mfreq 214 chown root.system /sys/devices/system/cpu/cpu1/online 215 chown root.system /sys/devices/system/cpu/cpu2/online 216 chown root.system /sys/devices/system/cpu/cpu3/online 217 chmod 664 /sys/devices/system/cpu/cpu1/online 218 chmod 664 /sys/devices/system/cpu/cpu2/online 219 chmod 664 /sys/devices/system/cpu/cpu3/online 220 write /dev/cpuctl/apps/cpu.notify_on_migrate 1 221 222on charger 223 # Booting modem 224 wait /dev/block/platform/msm_sdcc.1/by-name/modem 225 mount vfat /dev/block/platform/msm_sdcc.1/by-name/modem /firmware ro shortname=lower,uid=1000,gid=1000,dmask=227,fmask=337 226 wait /dev/block/platform/msm_sdcc.1/by-name/system 227 mount ext4 /dev/block/platform/msm_sdcc.1/by-name/system /system ro barrier=1 228 start rmt_storage 229 start irsc_util 230 231 # Enable Power modes and set the CPU Freq Sampling rates 232 write /sys/module/lpm_resources/enable_low_power/l2 2 233 write /sys/module/lpm_resources/enable_low_power/pxo 1 234 write /sys/module/lpm_resources/enable_low_power/vdd_dig 1 235 write /sys/module/lpm_resources/enable_low_power/vdd_mem 1 236 write /sys/module/pm_8x60/modes/cpu0/power_collapse/suspend_enabled 1 237 write /sys/module/pm_8x60/modes/cpu1/power_collapse/suspend_enabled 1 238 write /sys/module/pm_8x60/modes/cpu2/power_collapse/suspend_enabled 1 239 write /sys/module/pm_8x60/modes/cpu3/power_collapse/suspend_enabled 1 240 write /sys/module/pm_8x60/modes/cpu0/power_collapse/idle_enabled 1 241 write /sys/module/msm_thermal/core_control/enabled 0 242 write /sys/devices/system/cpu/cpu1/online 1 243 write /sys/devices/system/cpu/cpu2/online 1 244 write /sys/devices/system/cpu/cpu3/online 1 245 write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor "powersave" 246 write /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor "powersave" 247 write /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor "powersave" 248 write /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor "powersave" 249 write /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq 300000 250 write /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq 300000 251 write /sys/devices/system/cpu/cpu2/cpufreq/scaling_min_freq 300000 252 write /sys/devices/system/cpu/cpu3/cpufreq/scaling_min_freq 300000 253 write /sys/module/msm_thermal/core_control/enabled 1 254 write /sys/devices/system/cpu/cpu1/online 0 255 write /sys/devices/system/cpu/cpu2/online 0 256 write /sys/devices/system/cpu/cpu3/online 0 257 start mpdecision 258 259on property:init.svc.wpa_supplicant=stopped 260 stop dhcpcd 261 262on property:sys.boot_completed=1 263 # Enable Power modes 264 write /sys/module/lpm_resources/enable_low_power/l2 2 265 write /sys/module/lpm_resources/enable_low_power/pxo 1 266 write /sys/module/lpm_resources/enable_low_power/vdd_dig 1 267 write /sys/module/lpm_resources/enable_low_power/vdd_mem 1 268 write /sys/module/pm_8x60/modes/cpu0/power_collapse/suspend_enabled 1 269 write /sys/module/pm_8x60/modes/cpu1/power_collapse/suspend_enabled 1 270 write /sys/module/pm_8x60/modes/cpu2/power_collapse/suspend_enabled 1 271 write /sys/module/pm_8x60/modes/cpu3/power_collapse/suspend_enabled 1 272 write /sys/module/pm_8x60/modes/cpu0/power_collapse/idle_enabled 1 273 write /sys/module/pm_8x60/modes/cpu0/standalone_power_collapse/suspend_enabled 1 274 write /sys/module/pm_8x60/modes/cpu1/standalone_power_collapse/suspend_enabled 1 275 write /sys/module/pm_8x60/modes/cpu2/standalone_power_collapse/suspend_enabled 1 276 write /sys/module/pm_8x60/modes/cpu3/standalone_power_collapse/suspend_enabled 1 277 write /sys/module/pm_8x60/modes/cpu0/standalone_power_collapse/idle_enabled 1 278 write /sys/module/pm_8x60/modes/cpu1/standalone_power_collapse/idle_enabled 1 279 write /sys/module/pm_8x60/modes/cpu2/standalone_power_collapse/idle_enabled 1 280 write /sys/module/pm_8x60/modes/cpu3/standalone_power_collapse/idle_enabled 1 281 write /sys/module/pm_8x60/modes/cpu0/retention/idle_enabled 1 282 write /sys/module/pm_8x60/modes/cpu1/retention/idle_enabled 1 283 write /sys/module/pm_8x60/modes/cpu2/retention/idle_enabled 1 284 write /sys/module/pm_8x60/modes/cpu3/retention/idle_enabled 1 285 start mpdecision 286 287 # enable slimport detection 288 write /sys/module/slimport/parameters/enable_irq 1 289 290service rmt_storage /system/bin/rmt_storage 291 class core 292 user root 293 294service bridgemgrd /system/bin/bridgemgrd 295 class main 296 user radio 297 group radio 298 299# QMUX must be in multiple groups to support external process connections 300service qmuxd /system/bin/qmuxd 301 class main 302 user radio 303 group radio audio bluetooth gps 304 305service netmgrd /system/bin/netmgrd 306 class main 307 308# QCOM sensor 309service sensors /system/bin/sensors.qcom 310 class main 311 user root 312 group root 313 314service irsc_util /system/bin/irsc_util "/etc/sec_config" 315 class main 316 user root 317 oneshot 318 319service p2p_supplicant /system/bin/wpa_supplicant \ 320 -iwlan0 -Dnl80211 -c/data/misc/wifi/wpa_supplicant.conf \ 321 -I/system/etc/wifi/wpa_supplicant_overlay.conf \ 322 -O/data/misc/wifi/sockets -N \ 323 -ip2p0 -Dnl80211 -c/data/misc/wifi/p2p_supplicant.conf \ 324 -I/system/etc/wifi/p2p_supplicant_overlay.conf \ 325 -puse_p2p_group_interface=1 -e/data/misc/wifi/entropy.bin \ 326 -g@android:wpa_wlan0 327 # we will start as root and wpa_supplicant will switch to user wifi 328 # after setting up the capabilities required for WEXT 329 # user wifi 330 # group wifi inet keystore 331 class main 332 socket wpa_wlan0 dgram 660 wifi wifi 333 disabled 334 oneshot 335 336service wpa_supplicant /system/bin/wpa_supplicant \ 337 -iwlan0 -Dnl80211 -c/data/misc/wifi/wpa_supplicant.conf \ 338 -I/system/etc/wifi/wpa_supplicant_overlay.conf \ 339 -O/data/misc/wifi/sockets \ 340 -e/data/misc/wifi/entropy.bin -g@android:wpa_wlan0 341 # we will start as root and wpa_supplicant will switch to user wifi 342 # after setting up the capabilities required for WEXT 343 # user wifi 344 # group wifi inet keystore 345 class main 346 socket wpa_wlan0 dgram 660 wifi wifi 347 disabled 348 oneshot 349 350service dhcpcd_wlan0 /system/bin/dhcpcd -aABDKL 351 class late_start 352 disabled 353 oneshot 354 355service dhcpcd_p2p /system/bin/dhcpcd -aABKL 356 class late_start 357 disabled 358 oneshot 359 360service iprenew_wlan0 /system/bin/dhcpcd -n 361 class late_start 362 disabled 363 oneshot 364 365service iprenew_p2p /system/bin/dhcpcd -n 366 class late_start 367 disabled 368 oneshot 369 370service dhcpcd_bnep0 /system/bin/dhcpcd -BKLG 371 disabled 372 oneshot 373 374service dhcpcd_bnep1 /system/bin/dhcpcd -BKLG 375 disabled 376 oneshot 377 378service dhcpcd_bnep2 /system/bin/dhcpcd -BKLG 379 disabled 380 oneshot 381 382service dhcpcd_bnep3 /system/bin/dhcpcd -BKLG 383 disabled 384 oneshot 385 386service dhcpcd_bnep4 /system/bin/dhcpcd -BKLG 387 disabled 388 oneshot 389 390service dhcpcd_bt-pan /system/bin/dhcpcd -BKLG 391 disabled 392 oneshot 393 394service iprenew_bt-pan /system/bin/dhcpcd -n 395 disabled 396 oneshot 397 398service qseecomd /system/bin/qseecomd 399 class late_start 400 user system 401 group system 402 403# virtual sdcard daemon running as media_rw (1023) 404service sdcard /system/bin/sdcard -u 1023 -g 1023 -l /data/media /mnt/shell/emulated 405 class late_start 406 407service charger /charger 408 class charger 409 410 411service qcamerasvr /system/bin/mm-qcamera-daemon 412 class late_start 413 user camera 414 group camera system inet input 415 416service bdAddrLoader /system/bin/bdAddrLoader -f /persist/bluetooth/.bdaddr -h -x 417 class main 418 user bluetooth 419 group system bluetooth 420 oneshot 421 422# bugreport is triggered by holding down volume down, volume up and power 423service bugreport /system/bin/dumpstate -d -p -B \ 424 -o /data/data/com.android.shell/files/bugreports/bugreport 425 class main 426 disabled 427 oneshot 428 keycodes 114 115 116 429 430service mpdecision /system/bin/mpdecision --no_sleep --avg_comp 431 class main 432 user root 433 group root 434 disabled 435 436service ssr_ramdump /system/bin/subsystem_ramdump -m -t emmc 437 class main 438 disabled 439 user root 440 group root 441 442service thermal-engine /system/bin/thermal-engine-hh 443 class main 444 user root 445 group root 446 447service vss_init /vendor/bin/vss_init 448 class late_start 449 user root 450 group root 451 disabled 452 453service time_daemon /system/bin/time_daemon 454 class late_start 455 user root 456 group root 457 458