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