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