init.deb.rc revision 155f7a3f36c24e53fb072bdbc78c6ffefb1c5ae2
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    # White LED
199    chown system system /sys/class/leds/white/device/lock
200    chown system system /sys/class/leds/white/brightness
201    chown system system /sys/class/leds/white/device/grpfreq
202    chown system system /sys/class/leds/white/device/grppwm
203    chown system system /sys/class/leds/white/device/blink
204
205    # communicate with mpdecision and thermald
206    mkdir /dev/socket/mpdecision 0770 system system
207    chmod 2770 /dev/socket/mpdecision
208
209    # adjust vibrator amplitude
210    write /sys/class/timed_output/vibrator/amp 70
211
212    # Enable Power modes and set the CPU Freq Sampling rates
213    write /sys/module/rpm_resources/enable_low_power/L2_cache 1
214    write /sys/module/rpm_resources/enable_low_power/pxo 1
215    write /sys/module/rpm_resources/enable_low_power/vdd_dig 1
216    write /sys/module/rpm_resources/enable_low_power/vdd_mem 1
217    write /sys/module/pm_8x60/modes/cpu0/power_collapse/suspend_enabled 1
218    write /sys/module/pm_8x60/modes/cpu1/power_collapse/suspend_enabled 1
219    write /sys/module/pm_8x60/modes/cpu2/power_collapse/suspend_enabled 1
220    write /sys/module/pm_8x60/modes/cpu3/power_collapse/suspend_enabled 1
221    write /sys/module/pm_8x60/modes/cpu0/power_collapse/idle_enabled 1
222    write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor "ondemand"
223    write /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor "ondemand"
224    write /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor "ondemand"
225    write /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor "ondemand"
226    write /sys/devices/system/cpu/cpufreq/ondemand/up_threshold 90
227    write /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate 50000
228    write /sys/devices/system/cpu/cpufreq/ondemand/io_is_busy 1
229    write /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor 4
230    write /sys/devices/system/cpu/cpufreq/ondemand/down_differential 10
231    write /sys/devices/system/cpu/cpufreq/ondemand/up_threshold_multi_core 60
232    write /sys/devices/system/cpu/cpufreq/ondemand/down_differential_multi_core 3
233    write /sys/devices/system/cpu/cpufreq/ondemand/optimal_freq 918000
234    write /sys/devices/system/cpu/cpufreq/ondemand/sync_freq 1026000
235    write /sys/devices/system/cpu/cpufreq/ondemand/up_threshold_any_cpu_load 80
236    write /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq 384000
237    write /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq 384000
238    write /sys/devices/system/cpu/cpu2/cpufreq/scaling_min_freq 384000
239    write /sys/devices/system/cpu/cpu3/cpufreq/scaling_min_freq 384000
240    write /sys/devices/system/cpu/cpu1/online 1
241    write /sys/devices/system/cpu/cpu2/online 1
242    write /sys/devices/system/cpu/cpu3/online 1
243
244on charger
245    # Enable Power modes and set the CPU Freq Sampling rates
246    write /sys/module/rpm_resources/enable_low_power/L2_cache 1
247    write /sys/module/rpm_resources/enable_low_power/pxo 1
248    write /sys/module/rpm_resources/enable_low_power/vdd_dig 1
249    write /sys/module/rpm_resources/enable_low_power/vdd_mem 1
250    write /sys/module/pm_8x60/modes/cpu0/power_collapse/suspend_enabled 1
251    write /sys/module/pm_8x60/modes/cpu1/power_collapse/suspend_enabled 1
252    write /sys/module/pm_8x60/modes/cpu2/power_collapse/suspend_enabled 1
253    write /sys/module/pm_8x60/modes/cpu3/power_collapse/suspend_enabled 1
254    write /sys/module/pm_8x60/modes/cpu0/power_collapse/idle_enabled 1
255    write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor "powersave"
256    write /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor "powersave"
257    write /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor "powersave"
258    write /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor "powersave"
259    write /sys/devices/system/cpu/cpufreq/ondemand/up_threshold 90
260    write /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate 50000
261    write /sys/devices/system/cpu/cpufreq/ondemand/io_is_busy 1
262    write /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor 4
263    write /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq 384000
264    write /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq 384000
265    write /sys/devices/system/cpu/cpu2/cpufreq/scaling_min_freq 384000
266    write /sys/devices/system/cpu/cpu3/cpufreq/scaling_min_freq 384000
267
268on property:init.svc.wpa_supplicant=stopped
269    stop dhcpcd
270
271service irsc_util /system/bin/logwrapper /system/bin/irsc_util "/etc/sec_config"
272    class main
273    user root
274    oneshot
275
276service rmt_storage /system/bin/rmt_storage
277    class main
278    user root
279
280service hciattach /system/bin/sh /system/etc/init.flo.bt.sh
281    class late_start
282    user bluetooth
283    group qcom_oncrpc bluetooth net_bt_admin system net_bt_stack
284    disabled
285    oneshot
286
287on property:bluetooth.hciattach=true
288    start hciattach
289
290on property:bluetooth.hciattach=false
291    setprop bluetooth.status off
292
293service bridgemgrd /system/bin/bridgemgrd
294    class main
295    user radio
296    group radio
297
298# QMUX must be in multiple groups to support external process connections
299service qmuxd /system/bin/qmuxd
300    class main
301    user radio
302    group radio audio bluetooth gps net_bt_stack
303
304service ks_checker /system/bin/sh /system/etc/kickstart_checker.sh
305    class core
306    oneshot
307
308service kickstart /system/bin/qcks -i /firmware/image/ -r /data/tombstones/mdm/
309    class core
310    user system
311    group system
312    disabled
313    oneshot
314
315service asus-dbug-d /data/data/com.asus.debugger/files/asus-debugger-d
316    class late_start
317    disabled
318
319on property:gsm.radio.kickstart=on
320    start kickstart
321    setprop gsm.radio.kickstart running
322
323on property:gsm.radio.kickstart=off
324    stop kickstart
325
326on property:ril.asus_debugger_running=1
327    start asus-dbug-d
328
329service netmgrd /system/bin/netmgrd
330    class main
331
332service sensors /system/bin/sensors.qcom
333    class late_start
334    user root
335    group root
336
337service wpa_supplicant /system/bin/logwrapper /system/bin/wpa_supplicant \
338    -iwlan0 -Dnl80211 -c/data/misc/wifi/wpa_supplicant.conf \
339    -I/system/etc/wifi/wpa_supplicant_overlay.conf \
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 p2p_supplicant /system/bin/logwrapper /system/bin/wpa_supplicant \
351    -iwlan0 -Dnl80211 -c/data/misc/wifi/wpa_supplicant.conf \
352    -I/system/etc/wifi/wpa_supplicant_overlay.conf -N \
353    -ip2p0 -Dnl80211 -c/data/misc/wifi/p2p_supplicant.conf \
354    -I/system/etc/wifi/p2p_supplicant_overlay.conf \
355    -puse_p2p_group_interface=1 -e/data/misc/wifi/entropy.bin \
356    -g@android:wpa_wlan0
357#   we will start as root and wpa_supplicant will switch to user wifi
358#   after setting up the capabilities required for WEXT
359#   user wifi
360#   group wifi inet keystore
361    class main
362    socket wpa_wlan0 dgram 660 wifi wifi
363    disabled
364    oneshot
365
366service dhcpcd_wlan0 /system/bin/dhcpcd -aABDKL
367    class main
368    disabled
369    oneshot
370
371service dhcpcd_p2p /system/bin/dhcpcd -aABKL
372    class main
373    disabled
374    oneshot
375
376service iprenew_wlan0 /system/bin/dhcpcd -n
377    class main
378    disabled
379    oneshot
380
381service iprenew_p2p /system/bin/dhcpcd -n
382    class main
383    disabled
384    oneshot
385
386service dhcpcd_bt-pan /system/bin/dhcpcd -ABKL
387    class main
388    disabled
389    oneshot
390
391service iprenew_bt-pan /system/bin/dhcpcd -n
392    class main
393    disabled
394    oneshot
395
396on property:ro.data.large_tcp_window_size=true
397    # Adjust socket buffer to enlarge TCP receive window for high bandwidth (e.g. DO-RevB)
398    write /proc/sys/net/ipv4/tcp_adv_win_scale  1
399
400service charger /charger
401    class charger
402
403# virtual sdcard daemon running as media_rw (1023)
404service sdcard /system/bin/sdcard /data/media /mnt/shell/emulated 1023 1023
405    class late_start
406
407# Binding fuse mount point to /storage/emulated/legacy
408on property:init.svc.sdcard=running
409    wait /mnt/shell/emulated/0
410    mount none /mnt/shell/emulated/0 /storage/emulated/legacy bind
411
412service thermald /system/bin/thermald
413    class main
414
415service mpdecision /system/bin/mpdecision --no_sleep --avg_comp
416    class main
417
418service ppd /system/bin/mm-pp-daemon -s
419    class late_start
420    user system
421    socket pps stream 0660 system system graphics
422    group system graphics
423
424service qcamerasvr /system/bin/mm-qcamera-daemon
425    class late_start
426    user camera
427    group camera system inet input
428
429service wcnss_init /system/bin/sh /system/etc/init.flo.wifi.sh
430    class main
431    user system
432    group system wifi
433    oneshot
434
435service bdAddrLoader /system/bin/bdAddrLoader -f /persist/bluetooth/.bdaddr -h -x
436    class main
437    user bluetooth
438    group system bluetooth net_bt_stack
439    oneshot
440
441# bugreport is triggered by holding down volume down, volume up and power
442service bugreport /system/bin/dumpstate -d -p -B \
443        -o /data/data/com.android.shell/files/bugreports/bugreport
444    class main
445    disabled
446    oneshot
447    keycodes 114 115 116
448
449service qseecomd /system/bin/qseecomd
450    class late_start
451    user system
452    group system
453
454service diag_mdlog /system/bin/logwrapper /system/bin/diag_mdlog -s 100
455    class late_start
456    disabled
457
458on property:init.svc.surfaceflinger=stopped
459    stop ppd
460