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