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