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