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