1import init.flounder.usb.rc
2
3on init
4    start watchdogd
5
6    # See storage config details at http://source.android.com/tech/storage/
7    mkdir /mnt/shell/emulated 0700 shell shell
8    mkdir /storage/emulated 0555 root root
9
10    export EXTERNAL_STORAGE /storage/emulated/legacy
11    export EMULATED_STORAGE_SOURCE /mnt/shell/emulated
12    export EMULATED_STORAGE_TARGET /storage/emulated
13
14    # Support legacy paths
15    symlink /storage/emulated/legacy /sdcard
16    symlink /storage/emulated/legacy /mnt/sdcard
17    symlink /storage/emulated/legacy /storage/sdcard0
18    symlink /mnt/shell/emulated/0 /storage/emulated/legacy
19
20on post-fs
21    write /sys/power/gpu_power_on 1
22    write /sys/module/input_cfboost/parameters/gpu_wakeup 1
23    # Turn on swap
24    swapon_all /fstab.flounder
25
26    # Swap in only 1 page at a time
27    write /proc/sys/vm/page-cluster 0
28
29on post-fs-data
30    # Now that are booted all the way and out of mount panics, ensure that we panic on later errors.
31    # This is a hack to work around the fact that we can't recover from all errors that would lead to a panic
32    # during the initial mount (http://b/17382778), yet we need to panic on emmc errors (http://b/17640053)
33    # For a remount only the flags and the target mount point are relevant.
34    mount dummy dummy /data remount nosuid nodev noatime rw seclabel,background_gc=on,user_xattr,acl,errors=panic
35
36    mkdir /data/media 0770 media_rw media_rw
37    mkdir /data/nvcam 0700 media camera
38
39    # NFC: create data/nfc for nv storage
40    mkdir /data/nfc 0770 nfc nfc
41    mkdir /data/nfc/param 0770 nfc nfc
42
43    # secure os storage
44    mkdir /data/ss 0700 system system
45
46    # for GPS files
47    mkdir /data/gps 0770 gps system
48
49    # modem init
50    mkdir /data/qcks 0770 system system
51    mkdir /data/efs 0771 system system
52    mkdir /data/qcks/mdm 0770 system system
53
54    setprop vold.post_fs_data_done 1
55
56on boot
57  # bluetooth
58    # change back to bluetooth from system
59    chown bluetooth net_bt_stack /data/misc/bluetooth
60
61    # power down interface
62    write /sys/class/rfkill/rfkill0/state 0
63
64    mount debugfs /sys/kernel/debug /sys/kernel/debug mode=755
65
66    # Set up kernel tracing, but disable it by default
67    chmod 0222 /sys/kernel/debug/tracing/trace_marker
68    write /sys/kernel/debug/tracing/tracing_on 0
69
70    write /sys/module/tegra3_emc/parameters/emc_enable 0
71    #write /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq 1000000
72    #write /sys/module/cpu_tegra/parameters/cpu_user_cap 700000
73    write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor interactive
74    write /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor interactive
75    write /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq 510000
76    write /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq 510000
77    #write /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed 700000
78    #write /sys/devices/system/cpu/cpu1/cpufreq/scaling_setspeed 700000
79    #write /sys/devices/system/cpu/cpufreq/interactive/boost_factor 2
80    #write /sys/devices/system/cpu/cpufreq/interactive/sustain_load 80
81    write /sys/devices/system/cpu/cpuquiet/tegra_cpuquiet/enable 0
82
83    restorecon_recursive /sys/devices/system/cpu/cpufreq/interactive
84    chown system system /sys/devices/system/cpu/cpufreq/interactive/timer_rate
85    chmod 0660 /sys/devices/system/cpu/cpufreq/interactive/timer_rate
86    chown system system /sys/devices/system/cpu/cpufreq/interactive/timer_slack
87    chmod 0660 /sys/devices/system/cpu/cpufreq/interactive/timer_slack
88    chown system system /sys/devices/system/cpu/cpufreq/interactive/min_sample_time
89    chmod 0660 /sys/devices/system/cpu/cpufreq/interactive/min_sample_time
90    chown system system /sys/devices/system/cpu/cpufreq/interactive/hispeed_freq
91    chmod 0660 /sys/devices/system/cpu/cpufreq/interactive/hispeed_freq
92    chown system system /sys/devices/system/cpu/cpufreq/interactive/target_loads
93    chmod 0660 /sys/devices/system/cpu/cpufreq/interactive/target_loads
94    chown system system /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load
95    chmod 0660 /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load
96    chown system system /sys/devices/system/cpu/cpufreq/interactive/above_hispeed_delay
97    chmod 0660 /sys/devices/system/cpu/cpufreq/interactive/above_hispeed_delay
98    chown system system /sys/devices/system/cpu/cpufreq/interactive/boost
99    chmod 0660 /sys/devices/system/cpu/cpufreq/interactive/boost
100    chown system system /sys/devices/system/cpu/cpufreq/interactive/boostpulse
101    chown system system /sys/devices/system/cpu/cpufreq/interactive/input_boost
102    chmod 0660 /sys/devices/system/cpu/cpufreq/interactive/input_boost
103    chown system system /sys/devices/system/cpu/cpufreq/interactive/boostpulse_duration
104    chmod 0660 /sys/devices/system/cpu/cpufreq/interactive/boostpulse_duration
105    chown system system /sys/devices/system/cpu/cpufreq/interactive/io_is_busy
106    chmod 0660 /sys/devices/system/cpu/cpufreq/interactive/io_is_busy
107
108    # Enable CC4
109    write /sys/devices/system/cpu/cpu0/cpuidle/state1/disabled 0
110    write /sys/devices/system/cpu/cpu1/cpuidle/state1/disabled 0
111
112    # b/13568411: make lazy vfree flush thresholds match flush_tlb_range
113    write /proc/sys/vm/lazy_vfree_tlb_flush_all_threshold 524288
114
115    chmod 0444 /sys/kernel/debug/bq2419x-regs
116
117    write /proc/sys/net/core/rmem_max 1048576
118    write /proc/sys/net/core/wmem_max 1048576
119
120on fs
121    mount_all /fstab.flounder
122    setprop ro.crypto.fuse_sdcard true
123
124# virtual sdcard daemon running as media_rw (1023)
125service sdcard /system/bin/sdcard -u 1023 -g 1023 -l /data/media /mnt/shell/emulated
126    class late_start
127
128service battery_charger /charger
129    class charger
130    seclabel u:r:healthd:s0
131
132# Set watchdog timer to 30 seconds and pet it every 10 seconds to get a 20 second margin
133service watchdogd /sbin/watchdogd 10 20
134    class core
135    disabled
136    seclabel u:r:watchdogd:s0
137
138# on userdebug and eng builds, enable kgdb on the serial console
139on property:ro.debuggable=1
140    write /sys/module/kgdboc/parameters/kgdboc ttyFIQ0
141    write /sys/module/fiq_debugger/parameters/kgdb_enable 1
142
143# for loading correct gps hal share libraries
144on property:ro.boot.baseband=N/A
145    setprop ro.hardware.gps bcm47521
146    enable gpsd
147
148on property:ro.boot.baseband=US
149    write /sys/module/bcmdhd/parameters/nvram_path /system/etc/wifi/bcmdhd_lte.cal
150
151on property:ro.boot.baseband=ROW
152    write /sys/module/bcmdhd/parameters/nvram_path /system/etc/wifi/bcmdhd_lte.cal
153
154on property:ro.baseband=unknown
155    setprop ro.hardware.gps bcm47521
156    enable gpsd
157
158# for telephony function
159on property:ro.boot.baseband=N/A
160    setprop ro.radio.noril true
161    stop ril-daemon
162
163on property:ro.hw.ks.ready=1
164    start ril-daemon
165
166on property:ro.boot.baseband=ROW
167    stop ril-daemon
168    enable kickstart
169    mkdir /dev/socket/qmux_radio 0770 radio radio
170    chmod 2770 /dev/socket/qmux_radio
171    setprop ro.baseband.arch mdm
172    enable qmuxd
173    enable netmgrd
174    setprop rild.libpath /vendor/lib64/libril-qc-qmi-1.so
175    setprop rild.libargs "-e wwan0"
176
177on property:ro.boot.baseband=US
178    stop ril-daemon
179    enable kickstart
180    mkdir /dev/socket/qmux_radio 0770 radio radio
181    chmod 2770 /dev/socket/qmux_radio
182    setprop ro.baseband.arch mdm
183    enable qmuxd
184    enable netmgrd
185    setprop rild.libpath /vendor/lib64/libril-qc-qmi-1.so
186    setprop rild.libargs "-e wwan0"
187
188# bugreport is triggered by holding down volume down, volume up and power
189service bugreport /system/bin/dumpstate -d -p -B \
190        -o /data/data/com.android.shell/files/bugreports/bugreport
191    class late_start
192    disabled
193    oneshot
194    keycodes 114 115 116
195
196service p2p_supplicant /system/bin/wpa_supplicant \
197    -iwlan0 -Dnl80211 -c/data/misc/wifi/wpa_supplicant.conf \
198    -I/system/etc/wifi/p2p_supplicant_overlay.conf \
199    -puse_p2p_group_interface=1p2p_device=1 \
200    -m/data/misc/wifi/p2p_supplicant.conf \
201    -e/data/misc/wifi/entropy.bin -g@android:wpa_wlan0
202    class late_start
203    socket wpa_wlan0 dgram 660 wifi wifi
204    disabled
205    oneshot
206
207service gpsd /system/bin/glgps -c /system/etc/gpsconfig.xml
208    class late_start
209    disabled
210    user gps
211    socket gps seqpacket 0660 gps system
212    group system inet sdcard_rw sdcard_r
213
214service wpa_supplicant /system/bin/wpa_supplicant \
215    -iwlan0 -Dnl80211 -c/data/misc/wifi/wpa_supplicant.conf \
216    -I/system/etc/wifi/wpa_supplicant_overlay.conf \
217    -e/data/misc/wifi/entropy.bin -g@android:wpa_wlan0
218    class late_start
219    socket wpa_wlan0 dgram 660 wifi wifi
220    disabled
221    oneshot
222
223service dhcpcd_wlan0 /system/bin/dhcpcd -aABDKL
224    class main
225    disabled
226    oneshot
227
228service dhcpcd_p2p /system/bin/dhcpcd -aABKL
229    class main
230    disabled
231    oneshot
232
233service dhcpcd_bt-pan /system/bin/dhcpcd -aABDKL
234    class main
235    disabled
236    oneshot
237
238service dhcpcd_eth0 /system/bin/dhcpcd -aABDKL
239    class late_start
240    disabled
241    oneshot
242
243service iprenew_wlan0 /system/bin/dhcpcd -n
244    class main
245    disabled
246    oneshot
247
248service iprenew_eth0 /system/bin/dhcpcd -n
249    class late_start
250    disabled
251    oneshot
252
253service iprenew_p2p /system/bin/dhcpcd -n
254    class main
255    disabled
256    oneshot
257
258service iprenew_bt-pan /system/bin/dhcpcd -n
259    class main
260    disabled
261    oneshot
262
263service kickstart /vendor/bin/qcks -i /vendor/firmware/mdm/image/ -r /data/qcks/mdm/
264    class late_start
265    disabled
266    user system
267    group system
268    oneshot
269
270service qmuxd /vendor/bin/qmuxd
271    class late_start
272    disabled
273    user system
274    group system radio
275
276service netmgrd /vendor/bin/netmgrd
277    class late_start
278    disabled
279    group system radio
280
281service tlk_daemon /vendor/bin/tlk_daemon --storagedir /data/ss
282    class main
283    group system
284