-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.tenderloin.rc
executable file
·267 lines (212 loc) · 9.18 KB
/
init.tenderloin.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
import init.tenderloin.usb.rc
on early-init
start serial
#set SELINUX to passive
setenforce 0
on init
# Enable LVM
# We need to set LVM_SYSTEM_DIR for lvm to work and it does not work
# with embedded export command until too late, so we exploit
# the fact that there is /bin/sh on the 13th partition that we can use.
mkdir /boot
mount ext3 /dev/block/mmcblk0p13 /boot wait noatime barrier=1
# Unfortunately it's dynamically linked so we need to create this
# /lib symlink first and kill it later when no longer needed.
symlink /boot/lib /lib
# Also stupid lvm binary expects block devices to live in /dev,
# not /dev/block
symlink /dev/block/mmcblk0p14 /dev/mmcblk0p14
exec /boot/bin/sh -c "LVM_SYSTEM_DIR=/lvm /boot/usr/sbin/lvm.static vgchange -ay"
# remove all the lvm stuff as well as the moboot nextboot instruction
exec /system/xbin/rm -rf /dev/mmcblk0p14 /lib /boot/moboot.next /var
# remount /boot read-only
mount ext3 /dev/block/mmcblk0p13 /boot remount ro wait noatime barrier=1
# set up additional storage
mkdir /mnt/shell/emulated 0700 shell shell
mkdir /storage/emulated 0555 root root
mkdir /mnt/media_rw/sdcard1 0700 media_rw media_rw
mkdir /storage/sdcard1 0700 root root
export EXTERNAL_STORAGE /storage/emulated/legacy
export EMULATED_STORAGE_SOURCE /mnt/shell/emulated
export EMULATED_STORAGE_TARGET /storage/emulated
export SECONDARY_STORAGE /storage/sdcard1
# 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 /external_sd
symlink /storage/sdcard1 /mnt/external_sd
# create directory for mounting usb drives
mkdir /mnt/media_rw/usbdisk 0700 media_rw media_rw
mkdir /storage/usbdisk 0700 root root
symlink /storage/usbdisk /usbdisk
symlink /storage/usbdisk /mnt/usbdisk
on fs
on fs
# mount partitions
mount_all /fstab.tenderloin
setprop ro.crypto.fuse_sdcard true
# sdcard service is sometimes too slow and can't create nodes properly
start sdcard
on post-fs-data
mkdir /data/media 0770 media_rw media_rw
chown media_rw media_rw /data/media
# camera calibration
mkdir /data/misc/camera 0770 media system
mkdir /data/misc/camera/R5_MVEN003_LD2_ND0_IR0_SH0_FL1_SVEN003_DCCID1044 0770 media media
# camera config
exec /system/bin/touch /data/misc/camera/config.txt
chown media system /data/misc/camera/config.txt
chmod 660 /data/misc/camera/config.txt
setprop vold.post_fs_data_done 1
on boot
mount debugfs /sys/kernel/debug /sys/kernel/debug
chmod 0666 /proc/net/xt_qtaguid/ctrl
chmod 0660 /dev/ctp_uart
# for Invense MPU3050
chmod 0664 /dev/mpu
chmod 0664 /dev/mpuirq
chmod 0664 /dev/timerirq
chown system system /dev/mpu
chown system system /dev/mpuirq
chown system system /dev/timerirq
chmod 0664 /dev/lm8502
chmod 0664 /sys/class/leds/core_navi_left/brightness
chmod 0664 /sys/class/leds/core_navi_right/brightness
chmod 0664 /sys/devices/i2c-3/3-0033/vibrator/vib0/vib_enable
chmod 0664 /sys/devices/i2c-3/3-0033/vibrator/vib0/vib_duty_cycle
chown system system /dev/lm8502
chown system system /sys/class/leds/core_navi_left/brightness
chown system system /sys/class/leds/core_navi_right/brightness
chown system system /sys/devices/i2c-3/3-0033/vibrator/vib0/vib_enable
chown system system /sys/devices/i2c-3/3-0033/vibrator/vib0/vib_duty_cycle
# For TS control
chown system system /sys/devices/platform/cy8ctma395/vdd
chown system system /sys/devices/platform/cy8ctma395/xres
chown system system /sys/user_hw/pins/ctp/wake/level
chown system system /dev/i2c-5
# increase per-process file limit to prevent warning
setrlimit 7 10000 10000
# Create the directories used by the Wireless subsystem
mkdir /data/misc/wifi 0770 wifi wifi
mkdir /data/misc/wifi/sockets 0770 wifi wifi
mkdir /data/misc/wifi/wpa_supplicant 0770 wifi wifi
mkdir /data/misc/dhcp 0770 dhcp dhcp
mount debugfs /sys/kernel/debug /sys/kernel/debug
# bluetooth power up/down interface
chown bluetooth bluetooth /sys/class/rfkill/rfkill0/type
chown bluetooth bluetooth /sys/class/rfkill/rfkill0/state
chmod 0660 /sys/class/rfkill/rfkill0/state
# fmtx
chown bluetooth bluetooth /sys/class/rfkill/rfkill1/type
chown bluetooth bluetooth /sys/class/rfkill/rfkill1/state
chmod 0660 /sys/class/rfkill/rfkill1/state
chown bluetooth bluetooth /dev/rfkill
chmod 0660 /dev/rfkill
chown bluetooth bluetooth /sys/user_hw/pins/bt/reset/level
chown bluetooth bluetooth /sys/user_hw/pins/bt/host_wake/level
# Headphone jack detection
chown audio audio /dev/input/event5
chmod 0660 /dev/input/event5
# Increase readahead buffers on MMC devices
write /sys/block/mmcblk0/bdi/read_ahead_kb 1024
# Enable low memory killer to check file pages
write /sys/module/lowmemorykiller/parameters/minfree 8192,10240,12288,14336,16384,20480
write /sys/devices/system/cpu/cpufreq/ondemand/up_threshold 90
write /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate 50000
# Enable power collapse where always safe
write /sys/module/pm_8x60/modes/cpu0/power_collapse/suspend_enabled 1
#write /sys/module/pm_8x60/modes/cpu0/power_collapse/idle_enabled 1
write /sys/module/pm_8x60/modes/cpu0/standalone_power_collapse/suspend_enabled 1
#write /sys/module/pm_8x60/modes/cpu0/standalone_power_collapse/idle_enabled 1
#write /sys/module/pm_8x60/modes/cpu1/power_collapse/idle_enabled 1
write /sys/module/pm_8x60/modes/cpu1/power_collapse/suspend_enabled 1
#write /sys/module/pm_8x60/modes/cpu1/standalone_power_collapse/idle_enabled 1
write /sys/module/pm_8x60/modes/cpu1/standalone_power_collapse/suspend_enabled 1
write /sys/module/rpm_resources/enable_low_power/vdd_dig 2
write /sys/module/rpm_resources/enable_low_power/vdd_mem 2
write /sys/module/rpm_resources/enable_low_power/L2_cache 1
write /sys/module/rpm_resources/enable_low_power/pxo 1
write /sys/module/rpm_resources/enable_low_power/rpm_cpu 1
write /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq 384000
write /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq 384000
# allow Q6 bites to restart LPASS(Q6/audio) subsystem
write /sys/module/subsystem_restart/parameters/restart_level 3
# change permissions for i2c-2 device
chmod 0660 /dev/i2c-2
chown media media /dev/i2c-2
# virtual sdcard daemon running as media_rw (1023)
service sdcard /system/bin/sdcard -u 1023 -g 1023 -l /data/media /mnt/shell/emulated
class late_start
service fuse_sdcard1 /system/bin/sdcard -u 1023 -g 1023 -d /mnt/media_rw/sdcard1 /storage/sdcard1
class late_start
disabled
service fuse_usbdisk /system/bin/sdcard -u 1023 -g 1023 -d /mnt/media_rw/usbdisk /storage/usbdisk
class late_start
disabled
service wpa_supplicant /system/bin/wpa_supplicant \
-iwlan0 -Dnl80211 -c/data/misc/wifi/wpa_supplicant.conf \
-O/data/misc/wifi/sockets \
-e/data/misc/wifi/entropy.bin -g@android:wpa_wlan0
# 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 late_start
disabled
oneshot
service iprenew_wlan0 /system/bin/dhcpcd -n
class late_start
disabled
oneshot
service tsdriver /system/bin/ts_srv
class core
user root
critical
service mpdecision /system/bin/mpdecision --no_sleep --avg_comp
class core
user root
disabled
service serial /sbin/serial
class core
disabled
oneshot
on property:init.svc.bootanim=stopped
# start mpdecision
on post-fs-data
setprop vold.post_fs_data_done 1
# MBM
on init
# Enable USB auto suspend for MBM devices
write /sys/bus/usb/devices/1-1/power/autosuspend 3
write /sys/bus/usb/devices/1-1/power/control auto
write /sys/bus/usb/devices/1-1/power/wakeup enabled
chown radio radio /dev/cdc-wdm0
chmod 0660 /dev/cdc-wdm0
chown radio radio /dev/cdc-wdm1
chmod 0660 /dev/cdc-wdm1
# Set Neighboring Cell Info reporting options
# yes = supported, no = not supported
# screen = only supported when screen on
setprop mbm.ril.config.nci screen
# Set NITZ Feature on or off
setprop mbm.ril.config.nitz no
# Set Loglevel for MBM GPS
setprop mbm.gps.config.loglevel INFO
# Set the device for controlling the gps
setprop mbm.gps.config.gps_ctrl /dev/cdc-wdm0
# Set the device for nmea data
setprop mbm.gps.config.gps_nmea /dev/ttyACM2
# Set the desired mode (PGPS,SUPL or STANDALONE
setprop mbm.gps.config.gps_pref_mode PGPS
# The following settings are only used for SUPL
# Enable network initiated requests
setprop mbm.gps.config.supl.enable_ni yes
# Allow connecting to supl servers without certificates
setprop mbm.gps.config.supl.uncert yes