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