1# 2# Copyright 2012 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.mako.usb.rc 18import init.mako_svelte.rc 19 20on early-init 21 mount debugfs debugfs /sys/kernel/debug 22 chown system system /sys/kernel/debug/kgsl/proc 23 24on init 25 # See storage config details at http://source.android.com/tech/storage/ 26 mkdir /mnt/shell/emulated 0700 shell shell 27 mkdir /storage/emulated 0555 root root 28 29 # Set permissions for persist partition 30 mkdir /persist 0771 system system 31 mkdir /firmware 0771 system system 32 33 export EXTERNAL_STORAGE /storage/emulated/legacy 34 export EMULATED_STORAGE_SOURCE /mnt/shell/emulated 35 export EMULATED_STORAGE_TARGET /storage/emulated 36 37 # Support legacy paths 38 symlink /storage/emulated/legacy /sdcard 39 symlink /storage/emulated/legacy /mnt/sdcard 40 symlink /storage/emulated/legacy /storage/sdcard0 41 symlink /mnt/shell/emulated/0 /storage/emulated/legacy 42 43 # Setup custom emergency number list based on 44 # the MCC. This is needed by RIL. 45 setprop persist.radio.custom_ecc "1" 46 setprop persist.radio.custom_ecc_mcc "{234,235,424,426,427,430,431:999},{334:060,066},{422:9999},{730:133}" 47 setprop persist.radio.custom_ecc_mcc_ex "{450:111,112,113,119,122,125,127},{724:190}" 48 setprop persist.radio.custom_ecc_voice "{515:117},{452:113,114,115}" 49 setprop persist.radio.custom_ecc_hard "911,*911,#911,112,999,000,08,118,120,122,110,119,995,111,113,125,127,133" 50 51on fs 52 mount_all ./fstab.mako 53 setprop ro.crypto.fuse_sdcard true 54 write /sys/kernel/boot_adsp/boot 1 55 56on early-boot 57 # set RLIMIT_MEMLOCK to 64MB 58 setrlimit 8 67108864 67108864 59 60on boot 61 #Create QMUX deamon socket area 62 mkdir /dev/socket/qmux_radio 0770 radio radio 63 chmod 2770 /dev/socket/qmux_radio 64 mkdir /dev/socket/qmux_audio 0770 media audio 65 chmod 2770 /dev/socket/qmux_audio 66 mkdir /dev/socket/qmux_bluetooth 0770 bluetooth bluetooth 67 chmod 2770 /dev/socket/qmux_bluetooth 68 mkdir /dev/socket/qmux_gps 0770 gps gps 69 chmod 2770 /dev/socket/qmux_gps 70 71 # Allow QMUX daemon to assign port open wait time 72 chown radio radio /sys/devices/virtual/hsicctl/hsicctl0/modem_wait 73 74 #Remove SUID bit for iproute2 ip tool 75 chmod 0755 /system/bin/ip 76 77 #port-bridge 78 chmod 0660 /dev/smd0 79 chown system system /dev/smd0 80 81 #BT DUN port-bridge 82 chmod 0660 /dev/smd7 83 chown bluetooth bluetooth /dev/smd7 84 85 chmod 0444 /sys/devices/platform/msm_hsusb/gadget/usb_state 86 87 # create symlink for fb1 as HDMI 88 symlink /dev/graphics/fb1 /dev/graphics/hdmi 89 90 # Remove write permissions to video related nodes 91 chmod 0664 /sys/devices/virtual/graphics/fb1/hpd 92 chmod 0664 /sys/devices/virtual/graphics/fb1/video_mode 93 chmod 0664 /sys/devices/virtual/graphics/fb1/format_3d 94 95 # Change owner and group for media server and surface flinger 96 chown system system /sys/devices/virtual/graphics/fb1/format_3d 97 chown system system /sys/devices/virtual/graphics/fb1/hpd 98 99 #For bridgemgr daemon to inform the USB driver of the correct transport 100 chown radio radio /sys/class/android_usb/f_rmnet_smd_sdio/transport 101 102 chmod 660 /dev/rtc0 103 chown system system /dev/rtc0 104 105 chown root system /proc/net/ip_conntrack 106 107 # Enable DEBUG_SUSPEND, DEBUG_EXIT_SUSPEND, and DEBUG_WAKEUP 108 write /sys/module/wakelock/parameters/debug_mask 7 109 110 #To allow interfaces to get v6 address when tethering is enabled 111 write /proc/sys/net/ipv6/conf/rmnet0/accept_ra 2 112 write /proc/sys/net/ipv6/conf/rmnet1/accept_ra 2 113 write /proc/sys/net/ipv6/conf/rmnet2/accept_ra 2 114 write /proc/sys/net/ipv6/conf/rmnet3/accept_ra 2 115 write /proc/sys/net/ipv6/conf/rmnet4/accept_ra 2 116 write /proc/sys/net/ipv6/conf/rmnet5/accept_ra 2 117 write /proc/sys/net/ipv6/conf/rmnet6/accept_ra 2 118 write /proc/sys/net/ipv6/conf/rmnet7/accept_ra 2 119 write /proc/sys/net/ipv6/conf/rmnet_sdio0/accept_ra 2 120 write /proc/sys/net/ipv6/conf/rmnet_sdio1/accept_ra 2 121 write /proc/sys/net/ipv6/conf/rmnet_sdio2/accept_ra 2 122 write /proc/sys/net/ipv6/conf/rmnet_sdio3/accept_ra 2 123 write /proc/sys/net/ipv6/conf/rmnet_sdio4/accept_ra 2 124 write /proc/sys/net/ipv6/conf/rmnet_sdio5/accept_ra 2 125 write /proc/sys/net/ipv6/conf/rmnet_sdio6/accept_ra 2 126 write /proc/sys/net/ipv6/conf/rmnet_sdio7/accept_ra 2 127 128 129# NFC: create data/nfc for nv storage 130 mkdir /data/nfc 770 nfc nfc 131 mkdir /data/nfc/param 770 nfc nfc 132 133# Assign TCP buffer thresholds to be ceiling value of technology maximums 134# Increased technology maximums should be reflected here. 135 write /proc/sys/net/core/rmem_max 1220608 136 write /proc/sys/net/core/wmem_max 1220608 137 138# msm specific files that need to be created on /data 139on post-fs-data 140 mkdir /data/media 0770 media_rw media_rw 141 142 # Create the directories used by the Wireless subsystem 143 mkdir /data/misc/wifi 0770 wifi wifi 144 mkdir /data/misc/wifi/sockets 0770 wifi wifi 145 mkdir /data/misc/wifi/wpa_supplicant 0770 wifi wifi 146 mkdir /data/misc/dhcp 0770 dhcp dhcp 147# to observe dnsmasq.leases file for dhcp information of soft ap. 148 chown dhcp system /data/misc/dhcp 149 150 write /dev/wcnss_wlan 1 151 write /sys/module/wcnss_ssr_8960/parameters/enable_riva_ssr 1 152 153 # Create directory used by audio subsystem 154 mkdir /data/misc/audio 0770 audio audio 155 156 # Workaround for conn_init not copying the updated firmware 157 rm /data/misc/wifi/WCNSS_qcom_cfg.ini 158 rm /data/misc/wifi/WCNSS_qcom_wlan_nv.bin 159 160 # Mounting of persist is moved to 'on emmc-fs' and 'on fs' sections 161 # We chown/chmod /persist again so because mount is run as root + defaults 162 chown system system /persist 163 chmod 0664 /sys/devices/platform/msm_sdcc.1/polling 164 chmod 0664 /sys/devices/platform/msm_sdcc.2/polling 165 chmod 0664 /sys/devices/platform/msm_sdcc.3/polling 166 chmod 0664 /sys/devices/platform/msm_sdcc.4/polling 167 168 # Chown polling nodes as needed from UI running on system server 169 chown system system /sys/devices/platform/msm_sdcc.1/polling 170 chown system system /sys/devices/platform/msm_sdcc.2/polling 171 chown system system /sys/devices/platform/msm_sdcc.3/polling 172 chown system system /sys/devices/platform/msm_sdcc.4/polling 173 174 #Create the symlink to qcn wpa_supplicant folder for ar6000 wpa_supplicant 175 mkdir /data/system 0775 system system 176 #symlink /data/misc/wifi/wpa_supplicant /data/system/wpa_supplicant 177 178 #Create directory used by sensor subsystem(dsps) 179 mkdir /data/system/sensors 180 chmod 665 /data/system/sensors 181 write /data/system/sensors/settings 1 182 chmod 660 /data/system/sensors/settings 183 184 # AKM setting data 185 mkdir /data/misc/sensors 186 chmod 775 /data/misc/sensors 187 188 mkdir /persist/sensors 189 chmod 775 /persist/sensors 190 191 #Provide the access to hostapd.conf only to root and group 192 chmod 0660 /data/hostapd/hostapd.conf 193 194 # Enable the setgid bit on the directory 195 mkdir /data/audio 0770 media audio 196 chmod 2770 /data/audio 197 198 # kickstart 199 mkdir /data/qcks 0770 system system 200 chown system /dev/block/platform/msm_sdcc.1/by-name 201 202 setprop vold.post_fs_data_done 1 203 204 rm /data/local/tmp/adreno_config.txt 205 206 # LED On/Off synchronization 207 chown system system /sys/class/leds/red/device/lock 208 209 # communicate with mpdecision and thermald 210 mkdir /dev/socket/mpdecision 0770 system system 211 chmod 2770 /dev/socket/mpdecision 212 213 # adjust vibrator amplitude 214 write /sys/class/timed_output/vibrator/amp 70 215 216 # Enable Power modes and set the CPU Freq Sampling rates 217 write /sys/module/rpm_resources/enable_low_power/L2_cache 1 218 write /sys/module/rpm_resources/enable_low_power/pxo 1 219 write /sys/module/rpm_resources/enable_low_power/vdd_dig 1 220 write /sys/module/rpm_resources/enable_low_power/vdd_mem 1 221 write /sys/module/pm_8x60/modes/cpu0/power_collapse/suspend_enabled 1 222 write /sys/module/pm_8x60/modes/cpu1/power_collapse/suspend_enabled 1 223 write /sys/module/pm_8x60/modes/cpu2/power_collapse/suspend_enabled 1 224 write /sys/module/pm_8x60/modes/cpu3/power_collapse/suspend_enabled 1 225 write /sys/module/pm_8x60/modes/cpu0/power_collapse/idle_enabled 1 226 write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor "ondemand" 227 write /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor "ondemand" 228 write /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor "ondemand" 229 write /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor "ondemand" 230 write /sys/devices/system/cpu/cpufreq/ondemand/up_threshold 90 231 write /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate 50000 232 write /sys/devices/system/cpu/cpufreq/ondemand/io_is_busy 1 233 write /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor 4 234 write /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq 384000 235 write /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq 384000 236 write /sys/devices/system/cpu/cpu2/cpufreq/scaling_min_freq 384000 237 write /sys/devices/system/cpu/cpu3/cpufreq/scaling_min_freq 384000 238 239on charger 240 # Enable Power modes and set the CPU Freq Sampling rates 241 write /sys/module/rpm_resources/enable_low_power/L2_cache 1 242 write /sys/module/rpm_resources/enable_low_power/pxo 1 243 write /sys/module/rpm_resources/enable_low_power/vdd_dig 1 244 write /sys/module/rpm_resources/enable_low_power/vdd_mem 1 245 write /sys/module/pm_8x60/modes/cpu0/power_collapse/suspend_enabled 1 246 write /sys/module/pm_8x60/modes/cpu1/power_collapse/suspend_enabled 1 247 write /sys/module/pm_8x60/modes/cpu2/power_collapse/suspend_enabled 1 248 write /sys/module/pm_8x60/modes/cpu3/power_collapse/suspend_enabled 1 249 write /sys/module/pm_8x60/modes/cpu0/power_collapse/idle_enabled 1 250 write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor "powersave" 251 write /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor "powersave" 252 write /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor "powersave" 253 write /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor "powersave" 254 write /sys/devices/system/cpu/cpufreq/ondemand/up_threshold 90 255 write /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate 50000 256 write /sys/devices/system/cpu/cpufreq/ondemand/io_is_busy 1 257 write /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor 4 258 write /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq 384000 259 write /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq 384000 260 write /sys/devices/system/cpu/cpu2/cpufreq/scaling_min_freq 384000 261 write /sys/devices/system/cpu/cpu3/cpufreq/scaling_min_freq 384000 262 write /sys/devices/system/cpu/cpu1/online 0 263 write /sys/devices/system/cpu/cpu2/online 0 264 write /sys/devices/system/cpu/cpu3/online 0 265 266on property:init.svc.wpa_supplicant=stopped 267 stop dhcpcd 268 269service rmt_storage /system/bin/rmt_storage 270 class core 271 user root 272 273service hciattach /system/bin/sh /system/etc/init.mako.bt.sh 274 class late_start 275 user bluetooth 276 group qcom_oncrpc bluetooth net_bt_admin system 277 disabled 278 oneshot 279 280on property:bluetooth.hciattach=true 281 start hciattach 282 283on property:bluetooth.hciattach=false 284 setprop bluetooth.status off 285 286service bridgemgrd /system/bin/bridgemgrd 287 class main 288 user radio 289 group radio 290 291# QMUX must be in multiple groups to support external process connections 292service qmuxd /system/bin/qmuxd 293 class main 294 user radio 295 group radio audio bluetooth gps 296 297service kickstart /system/bin/qcks -i /firmware/image/ -r /data/tombstones/mdm/ 298 class core 299 user system 300 group system 301 oneshot 302 303service netmgrd /system/bin/netmgrd 304 class main 305 306 307service sensors /system/bin/sensors.qcom 308 class late_start 309 user root 310 group root 311 312service wpa_supplicant /system/bin/wpa_supplicant \ 313 -iwlan0 -Dnl80211 -c/data/misc/wifi/wpa_supplicant.conf \ 314 -I/system/etc/wifi/wpa_supplicant_overlay.conf \ 315 -O/data/misc/wifi/sockets \ 316 -e/data/misc/wifi/entropy.bin -g@android:wpa_wlan0 317 # we will start as root and wpa_supplicant will switch to user wifi 318 # after setting up the capabilities required for WEXT 319 # user wifi 320 # group wifi inet keystore 321 class main 322 socket wpa_wlan0 dgram 660 wifi wifi 323 disabled 324 oneshot 325 326service p2p_supplicant /system/bin/wpa_supplicant \ 327 -ip2p0 -Dnl80211 -c/data/misc/wifi/p2p_supplicant.conf \ 328 -I/system/etc/wifi/p2p_supplicant_overlay.conf -N \ 329 -iwlan0 -Dnl80211 -c/data/misc/wifi/wpa_supplicant.conf \ 330 -I/system/etc/wifi/wpa_supplicant_overlay.conf \ 331 -O/data/misc/wifi/sockets -puse_p2p_group_interface=1 \ 332 -e/data/misc/wifi/entropy.bin -g@android:wpa_wlan0 333# we will start as root and wpa_supplicant will switch to user wifi 334# after setting up the capabilities required for WEXT 335# user wifi 336# group wifi inet keystore 337 class main 338 socket wpa_wlan0 dgram 660 wifi wifi 339 disabled 340 oneshot 341 342service dhcpcd_wlan0 /system/bin/dhcpcd -aABDKL 343 class main 344 disabled 345 oneshot 346 347service dhcpcd_p2p /system/bin/dhcpcd -aABKL 348 class main 349 disabled 350 oneshot 351 352service iprenew_wlan0 /system/bin/dhcpcd -n 353 class main 354 disabled 355 oneshot 356 357service iprenew_p2p /system/bin/dhcpcd -n 358 class main 359 disabled 360 oneshot 361 362service dhcpcd_bt-pan /system/bin/dhcpcd -BKLG 363 disabled 364 oneshot 365 366service iprenew_bt-pan /system/bin/dhcpcd -n 367 disabled 368 oneshot 369 370on property:ro.data.large_tcp_window_size=true 371 # Adjust socket buffer to enlarge TCP receive window for high bandwidth (e.g. DO-RevB) 372 write /proc/sys/net/ipv4/tcp_adv_win_scale 1 373 374service charger /charger 375 class charger 376 377# virtual sdcard daemon running as media_rw (1023) 378service sdcard /system/bin/sdcard -u 1023 -g 1023 -l /data/media /mnt/shell/emulated 379 class late_start 380 381service thermald /system/bin/thermald 382 class main 383 384service mpdecision /system/bin/mpdecision --no_sleep --avg_comp 385 class main 386 387service qcamerasvr /system/bin/mm-qcamera-daemon 388 class late_start 389 user camera 390 group camera system inet input 391 392service conn_init /system/bin/conn_init 393 class late_start 394 user system 395 group system wifi 396 oneshot 397 398service bdAddrLoader /system/bin/bdAddrLoader -f /persist/bluetooth/.bdaddr -h -x 399 class main 400 user bluetooth 401 group system bluetooth 402 oneshot 403 404# bugreport is triggered by holding down volume down, volume up and power 405service bugreport /system/bin/dumpstate -d -p -B \ 406 -o /data/data/com.android.shell/files/bugreports/bugreport 407 class main 408 disabled 409 oneshot 410 keycodes 114 115 116 411 412service qseecomd /system/bin/qseecomd 413 class late_start 414 user system 415 group system 416 417service diag_mdlog /system/bin/diag_mdlog -s 100 418 class late_start 419 disabled 420 421# on property:gsm.sim.state=READY 422# start diag_mdlog 423