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