/
init.stingray.rc
333 lines (277 loc) · 10.6 KB
/
init.stingray.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
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
import init.stingray.usb.rc
on init
# See storage config details at http://source.android.com/tech/storage/
mkdir /mnt/shell/emulated 0700 shell shell
mkdir /storage 0550 system sdcard_r
mkdir /storage/emulated 0555 root root
mkdir /storage/sdcard1 0000 system system
mkdir /storage/usbdisk0 0000 system system
export EXTERNAL_STORAGE /storage/emulated/legacy
export SECONDARY_STORAGE /storage/sdcard1
export EMULATED_STORAGE_SOURCE /mnt/shell/emulated
export EMULATED_STORAGE_TARGET /storage/emulated
# Support legacy paths
symlink /storage/emulated/legacy /sdcard
symlink /storage/emulated/legacy /mnt/sdcard
symlink /storage/emulated/legacy /storage/sdcard0
symlink /mnt/shell/emulated/0 /storage/emulated/legacy
symlink /storage/sdcard1 /mnt/external1
symlink /storage/usbdisk0 /mnt/usbdisk
mkdir /pds 0777 system system
on fs
mount_all /fstab.stingray
setprop ro.crypto.fuse_sdcard true
mount debugfs debugfs /sys/kernel/debug
on post-fs-data
mkdir /data/misc/wifi 0770 wifi wifi
mkdir /data/misc/wifi/sockets 0770 wifi wifi
mkdir /data/misc/dhcp 0770 dhcp dhcp
chown dhcp dhcp /data/misc/dhcp
mkdir /data/tpapi 0771 system system
mkdir /data/tpapi/etc 0771 system system
mkdir /data/tpapi/etc/tpa 0771 system system
mkdir /data/tpapi/etc/tpa/persistent 0771 system system
chown system system /data/tpapi/etc/tpa/mmap_vars.dat
chmod 0660 /data/tpapi/etc/tpa/mmap_vars.dat
chown system system /data/tpapi/etc/tpa/keymgr.lock
chmod 0660 /data/tpapi/etc/tpa/keymgr.lock
chown system system /data/tpapi/etc/tpa/persistent/keymaptable.lock
chmod 0660 /data/tpapi/etc/tpa/persistent/keymaptable.lock
chown system system /data/tpapi/etc/tpa/persistent/keyring.lock
chmod 0660 /data/tpapi/etc/tpa/persistent/keyring.lock
chown system system /data/tpapi/etc/tpa/persistent/iprm.lock
chmod 0660 /data/tpapi/etc/tpa/persistent/iprm.lock
# cleanup obsolete symlink hack that may be lying around
rm /data/misc/ril
# we will remap this as /storage/sdcard0 with the sdcard fuse tool
mkdir /data/media 0770 media_rw media_rw
chown media_rw media_rw /data/media
# GPS
#Create location directory, BRCM guci library stores LTO file and read/write
# config file.
mkdir /data/location 0770 radio radio
# Set indication (checked by vold) that we have finished this action
setprop vold.post_fs_data_done 1
on boot
# bluetooth
# power up/down interface
chmod 0660 /sys/class/rfkill/rfkill0/state
chmod 0660 /sys/class/rfkill/rfkill0/type
chown bluetooth net_bt_stack /sys/class/rfkill/rfkill0/state
chown bluetooth net_bt_stack /sys/class/rfkill/rfkill0/type
# UART device
chmod 0660 /dev/ttyHS2
chown bluetooth net_bt_stack /dev/ttyHS2
# bluetooth MAC address programming
chown bluetooth net_bt_stack /sys/module/board_stingray/parameters/bdaddr
setprop ro.bt.bdaddr_path /sys/module/board_stingray/parameters/bdaddr
# Sensor
chown compass compass /dev/kxtf9
chmod 660 /dev/kxtf9
chown compass compass /dev/max9635
chmod 660 /dev/max9635
chown compass compass /dev/bmp085
chmod 660 /dev/bmp085
chown compass compass /dev/l3g4200d
chmod 660 /dev/l3g4200d
chown compass compass /dev/akm8975_dev
chmod 660 /dev/akm8975_dev
chown compass compass /dev/akm8975_aot
chmod 660 /dev/akm8975_aot
# light
chown system system /sys/class/leds/notification-led/brightness
chmod 660 /sys/class/leds/notification-led/brightness
chown system system /sys/class/leds/notification-led/blink
chmod 660 /sys/class/leds/notification-led/blink
chmod 666 /dev/nvhost-ctrl
chmod 666 /dev/nvhost-display
chmod 666 /dev/nvhost-dsi
chmod 666 /dev/nvhost-gr2d
chmod 666 /dev/nvhost-gr3d
chmod 666 /dev/nvhost-isp
chmod 666 /dev/nvhost-mpe
chmod 666 /dev/nvhost-vi
# Camera
chown media camera /sys/class/leds/privacy-led/brightness
chown media camera /sys/class/leds/flash/brightness
chown media camera /sys/class/leds/torch/brightness
chmod 660 /sys/class/leds/privacy-led/brightness
chmod 660 /sys/class/leds/flash/brightness
chmod 660 /sys/class/leds/torch/brightness
# UART Device
chown radio radio /dev/ttyHS4
chmod 640 /dev/ttyHS4
# broadcom 4750 device
chown radio radio /dev/gps_brcm4750
chmod 660 /dev/gps_brcm4750
# Whisper UART Device
chown radio radio /dev/ttyHS0
chmod 640 /dev/ttyHS0
# Whisper audio settings
chown media media /sys/class/switch/dock/dock_prop
chmod 660 /sys/class/switch/dock/dock_prop
# Modem Control CDMA
chown radio radio /sys/class/radio/mdm6600/command
chmod 220 /sys/class/radio/mdm6600/command
chown radio radio /sys/bus/usb/devices/usb2/power/control
chmod 660 /sys/bus/usb/devices/usb2/power/control
# Modem Control LTE
chown radio radio /sys/class/radio/wrigley/command
chmod 220 /sys/class/radio/wrigley/command
chown radio radio /sys/bus/usb/devices/usb1/power/control
chmod 660 /sys/bus/usb/devices/usb1/power/control
# StingrayParts: Control charging LED
chown root system /sys/class/gpio/gpio168/value
chmod 664 /sys/class/gpio/gpio168/value
# Power Management Settings
# cpufreq defaults
write /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq 216000
write /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq 1000000
write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor interactive
write /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq 216000
write /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq 1000000
write /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor interactive
# timer 20ms, min sample 80ms, go max at 80%
write /sys/devices/system/cpu/cpufreq/interactive/timer_rate 20000
write /sys/devices/system/cpu/cpufreq/interactive/min_sample_time 80000
write /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load 80
write /sys/devices/system/cpu/cpufreq/interactive/above_hispeed_delay 20000
write /sys/devices/system/cpu/cpufreq/interactive/input_boost 1
# Wakelock debug
write /sys/module/wakelock/parameters/debug_mask 7
# No need to continuously scan w1 bus
write /sys/devices/w1\ bus\ master/w1_master_search 1
# Disable charging LED by default
write /sys/class/gpio/gpio168/value 1
# LTE specific TCP buffer setting for stingray
# ReadMin, ReadInitial, ReadMax, WriteMin, WriteInitial, WriteMax,
setprop net.tcp.buffersize.lte 524288,1048576,2097152,262144,524288,1048576
# make binder state/stats readable by root only, so that they are not
# captured by default in bugreports
chmod 0400 /sys/kernel/debug/binder/stats
chmod 0400 /sys/kernel/debug/binder/state
# Ecompass daemon
service akmd2 /system/bin/akmd2
class late_start
user compass
group compass misc input
service wpa_supplicant /system/bin/wpa_supplicant \
-iwlan0 -Dnl80211 -c/data/misc/wifi/wpa_supplicant.conf -e/data/misc/wifi/entropy.bin
# we will start as root and wpa_supplicant will switch to user wifi
# after setting up the capabilities required for WEXT
# user wifi
# group wifi inet keystore
class main
socket wpa_wlan0 dgram 660 wifi wifi
disabled
oneshot
service dhcpcd_wlan0 /system/bin/dhcpcd -aABDKL
class main
disabled
oneshot
service dhcpcd_p2p /system/bin/dhcpcd -aABKL
class main
disabled
oneshot
service dhcpcd_eth0 /system/bin/dhcpcd -ABDKL -f/system/etc/dhcpcd/dhcpcd.conf
class main
disabled
oneshot
service iprenew_wlan0 /system/bin/dhcpcd -n
class main
disabled
oneshot
service iprenew_p2p /system/bin/dhcpcd -n
class main
disabled
oneshot
service iprenew_eth0 /system/bin/dhcpcd -n
class main
disabled
oneshot
# bluetooth
service dhcpcd_bnep0 /system/bin/dhcpcd -ABKL
class main
disabled
oneshot
service iprenew_bnep0 /system/bin/dhcpcd -n
class main
disabled
oneshot
# bugreport is triggered by the VOLUME-DOWN and VOLUME-UP keys.
# bugtogo.sh tool will invoke bugreport and propt email composer
# if not in user build.
service bugreport /system/bin/bugmailer.sh -b /system/media/audio/ui/Dock.ogg -e /system/media/audio/ui/Undock.ogg
class main
disabled
oneshot
keycodes 115 114
service location /system/bin/location
class late_start
socket gpshal_socket stream 660 radio system
socket location_shim stream 660 system system
socket gps_tcmd stream 660 radio system
user radio
group radio system mot_accy
oneshot
service locDrv /system/bin/brcm_guci_drv -config /system/etc/gpsconfig.xml
class late_start
user radio
group radio inet sdcard_rw sdcard_r
service tcmd /system/bin/tcmd
class core
socket local_tcmd stream 0660 root root
socket batch_socket stream 0600 root root
disabled
service ftmipcd /system/bin/ftmipcd
class core
disabled
# Immediately drops to user radio, after starting the real-time thread
service whisper /system/bin/whisperd
class late_start
group radio system mot_accy
# create virtual SD card at /storage/sdcard0, based on the /data/media directory
# daemon will drop to user/group system/media_rw after initializing
# underlying files in /data/media will be created with user and group media_rw (1023)
service sdcard /system/bin/sdcard /data/media /mnt/shell/emulated 1023 1023
class late_start
service motolocation /system/bin/sh /system/bin/am startservice -n com.motorola.android.locationproxy/com.motorola.android.locationproxy.LocationProxyService
class late_start
disabled
oneshot
on property:gsm.mot.locatonproxy=start
start motolocation
# Get BP version and save to misc
service savebpver /system/bin/savebpver
class main
oneshot
disabled
on property:dev.bootcomplete=1
start savebpver
service gadget-lte-modem /system/bin/tty2ttyd ril.wrigley.modem.tty /dev/ttyGS0 0 512
disabled
service gadget-qbp-modem /system/bin/tty2ttyd persist.ril.modem.ttydevice /dev/ttyGS1 0 1024
disabled
service gadget-qbp-diag /system/bin/tty2ttyd persist.ril.diag.ttydevice /dev/ttyGS2 0 1024
disabled
service wrigley-diag /system/bin/wrigley-diag.sh
oneshot
disabled
service logcatd-blan /system/bin/logcatd-blan
user root
# Immediately drops root, keeps CAP_SYS_ADMIN, and runs as below
# user system
# group system log inet
disabled
on property:ro.bootmode=factorycable
start tcmd
start ftmipcd
on property:ro.bootmode=qbp-hw-bypass
setprop ril.moto-qc.usb-hw-bypass.state "on"
on property:ro.bootmode=bp-tools
start tcmd
start gadget-lte-modem
start gadget-qbp-diag
start gadget-qbp-modem
start wrigley-diag
start logcatd-blan