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