1import init.dragon.usb.rc
2
3on early-init
4    mount debugfs /sys/kernel/debug /sys/kernel/debug mode=755
5
6on init
7    symlink /sdcard /storage/sdcard0
8
9    # Setup zram options
10    write /sys/block/zram0/comp_algorithm lz4
11    write /sys/block/zram0/max_comp_streams 4
12
13    setprop ro.hardware.gralloc tegra
14    setprop ro.hardware.hwcomposer drm
15    setprop hwc.drm.device /dev/dri/card1
16    setprop persist.tegra.compression off
17    setprop persist.tegra.decompression disabled
18    setprop ro.radio.noril yes
19    setprop persist.tegra.nvblit.engine gpu
20
21    # GL driver parameters for tiled cache size and efficient tex fetch
22    setprop persist.tegra.0x523dc5 0x3f000000
23    setprop persist.tegra.58027529 0x00000002
24    setprop persist.tegra.a3456abe 0x087f6080
25
26    # fix navigation bar not showing
27    setprop qemu.hw.mainkeys 0
28    start watchdogd
29
30on late-init
31    # Setting slice_idle to 0 for CFQ, so make sure the scheduler is CFQ.
32    write /sys/block/mmcblk0/queue/scheduler cfq
33    write /sys/block/mmcblk0/queue/iosched/slice_idle 0
34
35    # enable rcu_expedited
36    write /sys/kernel/rcu_expedited 1
37
38on early-boot
39    # Update dm-verity state and set partition.*.verified properties
40    verity_update_state
41
42# Set watchdog timer to 30 seconds and pet it every 10 seconds to get a 20 second margin
43service watchdogd /sbin/watchdogd 10 20
44    class core
45    seclabel u:r:watchdogd:s0
46
47on post-fs
48    # Turn on swap
49    swapon_all /fstab.dragon
50
51    # Swap in only 1 page at a time
52    write /proc/sys/vm/page-cluster 0
53
54on post-fs-data
55    # Now that are booted all the way and out of mount panics, ensure that we panic on later errors.
56    # This is a hack to work around the fact that we can't recover from all errors that would lead to a panic
57    # during the initial mount (http://b/17382778), yet we need to panic on emmc errors (http://b/17640053)
58    # For a remount only the flags and the target mount point are relevant.
59    mount dummy dummy /data remount nosuid nodev noatime rw seclabel,background_gc=on,user_xattr,acl,errors=panic
60
61    mkdir /data/nvcam 0700 media camera
62    mkdir /data/misc/camera 0700 media camera
63
64    # NFC: create data/nfc for nv storage
65    mkdir /data/nfc 0770 nfc nfc
66    mkdir /data/nfc/param 0770 nfc nfc
67
68    # secure os storage
69    mkdir /data/ss 0700 system system
70    mkdir /data/ss/tlk 0700 system system
71
72    # secure os storage
73    mkdir /data/ss 0700 system system
74
75    # modem init
76    mkdir /data/qcks 0770 system system
77    mkdir /data/efs 0771 system system
78    mkdir /data/qcks/mdm 0770 system system
79
80    # crash_collector
81    mkdir /data/system/crash_reports 0700 system system
82
83    # EC/charger logs
84    mkdir /data/misc/fw_logs 0755 root root
85
86    # touch firmware updater logs
87    mkdir /data/misc/touchfwup 0755 root log
88
89    # initialize region info
90    exec -- /system/bin/init_regions.sh
91
92    setprop vold.post_fs_data_done 1
93
94on boot
95    # power down interface
96    write /sys/class/rfkill/rfkill0/state 0
97
98    write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor interactive
99    write /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor interactive
100    write /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor interactive
101    write /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor interactive
102
103    # (crosbug.com/p/46057) : Limit min frequency to 204Mhz for audio latency
104    write /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq 204000
105    write /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq 204000
106    write /sys/devices/system/cpu/cpu2/cpufreq/scaling_min_freq 204000
107    write /sys/devices/system/cpu/cpu3/cpufreq/scaling_min_freq 204000
108
109    restorecon_recursive /sys/devices/system/cpu/cpufreq/interactive
110    chown system system /sys/devices/system/cpu/cpufreq/interactive/timer_rate
111    chmod 0660 /sys/devices/system/cpu/cpufreq/interactive/timer_rate
112    chown system system /sys/devices/system/cpu/cpufreq/interactive/timer_slack
113    chmod 0660 /sys/devices/system/cpu/cpufreq/interactive/timer_slack
114    chown system system /sys/devices/system/cpu/cpufreq/interactive/min_sample_time
115    chmod 0660 /sys/devices/system/cpu/cpufreq/interactive/min_sample_time
116    chown system system /sys/devices/system/cpu/cpufreq/interactive/hispeed_freq
117    chmod 0660 /sys/devices/system/cpu/cpufreq/interactive/hispeed_freq
118    chown system system /sys/devices/system/cpu/cpufreq/interactive/target_loads
119    chmod 0660 /sys/devices/system/cpu/cpufreq/interactive/target_loads
120    chown system system /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load
121    chmod 0660 /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load
122    chown system system /sys/devices/system/cpu/cpufreq/interactive/above_hispeed_delay
123    chmod 0660 /sys/devices/system/cpu/cpufreq/interactive/above_hispeed_delay
124    chown system system /sys/devices/system/cpu/cpufreq/interactive/boost
125    chmod 0660 /sys/devices/system/cpu/cpufreq/interactive/boost
126    chown system system /sys/devices/system/cpu/cpufreq/interactive/boostpulse
127    chown system system /sys/devices/system/cpu/cpufreq/interactive/input_boost
128    chmod 0660 /sys/devices/system/cpu/cpufreq/interactive/input_boost
129    chown system system /sys/devices/system/cpu/cpufreq/interactive/boostpulse_duration
130    chmod 0660 /sys/devices/system/cpu/cpufreq/interactive/boostpulse_duration
131    chown system system /sys/devices/system/cpu/cpufreq/interactive/io_is_busy
132    chmod 0660 /sys/devices/system/cpu/cpufreq/interactive/io_is_busy
133    chown system system /sys/devices/57000000.gpu/pstate
134
135    # update foreground cpuset now that processors are up
136    # reserve CPU 3 for the top app
137    write /dev/cpuset/foreground/cpus 0-2
138    write /dev/cpuset/foreground/boost/cpus 0-2
139    write /dev/cpuset/background/cpus 0
140    write /dev/cpuset/system-background/cpus 0-1
141    write /dev/cpuset/top-app/cpus 0-3
142
143    # for gpu cap in battery saver mode
144    chown system system /sys/kernel/debug/system_edp/capping/force_gpu
145    chmod 0660 /sys/kernel/debug/system_edp/capping/force_gpu
146
147    # for lightbar
148    chown system system /sys/class/chromeos/cros_ec/lightbar/userspace_control
149    chmod 0660 /sys/class/chromeos/cros_ec/lightbar/userspace_control
150    chown system system /sys/class/chromeos/cros_ec/lightbar/sequence
151    chmod 0660 /sys/class/chromeos/cros_ec/lightbar/sequence
152
153    # for external power limits
154    chown system system /sys/class/chromeos/cros_ec/usb-pd-charger/ext_voltage_lim
155    chmod 0660 /sys/class/chromeos/cros_ec/usb-pd-charger/ext_voltage_lim
156
157    # Enable CC4
158    write /sys/devices/system/cpu/cpu0/cpuidle/state1/disabled 0
159    write /sys/devices/system/cpu/cpu1/cpuidle/state1/disabled 0
160    write /sys/devices/system/cpu/cpu2/cpuidle/state1/disabled 0
161    write /sys/devices/system/cpu/cpu3/cpuidle/state1/disabled 0
162
163    # b/13568411: make lazy vfree flush thresholds match flush_tlb_range
164    write /proc/sys/vm/lazy_vfree_tlb_flush_all_threshold 524288
165
166    chmod 0444 /sys/kernel/debug/bq2419x-regs
167
168    write /proc/sys/net/core/rmem_max 1048576
169    write /proc/sys/net/core/wmem_max 1048576
170
171    # Execute crash_collector when a process is crashing.
172    write /proc/sys/kernel/core_pattern "|/system/bin/crash_dispatcher %p %u %g %s %t %e"
173    write /proc/sys/kernel/core_pipe_limit 4
174    write /proc/self/coredump_filter 0x1
175
176    # enable GPU dvfs
177    write /sys/class/drm/card0/device/pstate auto
178
179    # set GPU auto suspend
180    write /sys/devices/57000000.gpu/power/autosuspend_delay_ms 520
181
182    # Raise RLIMIT_NOFILE softlimit to workaround b/28277319. This is intended
183    # to go away at some point, do not copy it to new devices! This makes fd
184    # leaks much harder to notice and debug.
185    setrlimit 7 2048 4096
186
187    # Wifi firmware reload path
188    chown wifi wifi /sys/module/bcmdhd/parameters/firmware_path
189
190on fs
191    # Enable verity notification
192    write /sys/module/dm_verity/parameters/error_behavior notify
193
194    mount_all /fstab.dragon
195
196# run the touch firmware update script as soon as non-tmpfs /data is ready
197on property:vold.decrypt=trigger_restart_framework
198    exec -- /system/bin/touchfwup.sh
199
200# tune thermal governor
201service tune_therm_gov /system/bin/tune-thermal-gov.sh skin-therm pd_thermal_gov \
202    max_err_temp 5000
203    class main
204    oneshot
205
206service battery_charger /charger
207    class charger
208    seclabel u:r:healthd:s0
209
210# on userdebug and eng builds, enable kgdb on the serial console
211on property:ro.debuggable=1
212    write /sys/module/kgdboc/parameters/kgdboc ttyFIQ0
213    write /sys/module/fiq_debugger/parameters/kgdb_enable 1
214
215# bugreport is triggered by holding down volume down, volume up and power
216service bugreport /system/bin/dumpstate -d -p -B -z \
217        -o /data/user_de/0/com.android.shell/files/bugreports/bugreport
218    class late_start
219    disabled
220    oneshot
221    keycodes 114 115 116
222
223service wpa_supplicant /vendor/bin/hw/wpa_supplicant \
224    -iwlan0 -Dnl80211 -c/data/misc/wifi/wpa_supplicant.conf \
225    -I/system/etc/wifi/p2p_supplicant_overlay.conf \
226    -puse_p2p_group_interface=1p2p_device=1 \
227    -m/data/misc/wifi/p2p_supplicant.conf \
228    -e/data/misc/wifi/entropy.bin -g@android:wpa_wlan0
229    class late_start
230    socket wpa_wlan0 dgram 660 wifi wifi
231    disabled
232    oneshot
233
234service fwtool /system/bin/fwtool mark_boot success
235    class late_start
236    user root
237    oneshot
238
239service kickstart /vendor/bin/qcks -i /vendor/firmware/mdm/image/ -r /data/qcks/mdm/
240    class late_start
241    disabled
242    user system
243    group system
244    oneshot
245
246service qmuxd /vendor/bin/qmuxd
247    class late_start
248    disabled
249    user system
250    group system radio
251
252service netmgrd /vendor/bin/netmgrd
253    class late_start
254    disabled
255    group system radio
256
257service tlk_daemon /vendor/bin/tlk_daemon --storagedir /data/ss --rpmbdev /dev/block/mmcblk0rpmb
258    class main
259    group system
260
261on property:debug.bq25892=dump
262    exec - root root system -- /system/bin/dump_bq25892.sh
263