forked from NookieDevs/android_device_bn_encore
-
Notifications
You must be signed in to change notification settings - Fork 20
/
init.encore.rc
executable file
·346 lines (273 loc) · 11.8 KB
/
init.encore.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
334
335
336
337
338
339
340
341
342
343
344
345
346
import init.encore.usb.rc
on early-init
# cap max CPU frequency to 1 GHz as soon as possible
write /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq 1000000
mkdir /storage 0751 root sdcard_r
mkdir /storage/sdcard0 0000 system system
mkdir /storage/sdcard1 0000 system system
mkdir /mnt/media_rw 0700 media_rw media_rw
mkdir /mnt/media_rw/sdcard0 0000 system system
mkdir /mnt/media_rw/sdcard1 0000 system system
# for backwards compatibility
symlink /storage/sdcard0 /mnt/emmc
symlink /storage/sdcard0 /emmc
symlink /storage/sdcard1 /sdcard
symlink /storage/sdcard1 /mnt/sdcard
export EXTERNAL_STORAGE /storage/sdcard1
export SECONDARY_STORAGE /storage/sdcard0
on init
# setup global environment
export PHONE_STORAGE /storage/sdcard0
export DSP_PATH /system/lib/dsp
export DEFAULT_BASEIMAGE /system/lib/dsp/baseimage.dof
# create mountpoints
mkdir /storage/usbdisk 0000 system system
mkdir /mnt/media_rw/usbdisk 0000 system system
symlink /storage/usbdisk /usbdisk
symlink /storage/usbdisk /mnt/usbdisk
symlink /system/vendor /vendor
# for encore
mkdir /rom 0755 root root
# disable swap page clustering -- helpful on disk, not with zram
write /proc/sys/vm/page-cluster 0
# reduce swappiness for foreground processes
write /proc/sys/vm/swappiness 20
on fs
# set up links to block devices based on boot location
mkdir /dev/block/by-name 0755 root root
start fsfinder
wait /dev/block/by-name/system
# mount partitions
mount_all /fstab.encore
swapon_all /fstab.encore
on post-fs-data
# we will remap this as /mnt/sdcard with the sdcard fuse tool
mkdir /data/media 0775 media_rw media_rw
chown media_rw media_rw /data/media
# update vold configuration in fstab
start configure_vold
wait /dev/.vold_configured
setprop vold.post_fs_data_done 1
# wi-fi
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
insmod /system/lib/modules/cfg80211.ko
insmod /system/lib/modules/mac80211.ko
insmod /system/lib/modules/wl12xx.ko
start store_mac_addr
mkdir /data/local 0771 shell shell
mkdir /data/local/tmp 0771 shell shell
mkdir /data/data 0771 system system
mkdir /data/app-private 0771 system system
mkdir /data/app 0771 system system
# We chown/chmod /data/app again in case it was created at build-time
chown system system /data/app
chmod 0771 /data/app
mkdir /data/property 0700 root root
# create dalvik-cache and double-check the perms
mkdir /data/dalvik-cache 0771 system system
chown system system /data/dalvik-cache
chmod 0771 /data/dalvik-cache
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
# bluetooth uart
chown bluetooth bluetooth /dev/ttyS1
# Enable Power Management - thanks NookieFroyo for this
# Mount Debug file system
mount debugfs /sys/kernel/debug /sys/kernel/debug
# Enabling sleep in idle path
write /sys/kernel/debug/pm_debug/sleep_while_idle 1
# Enabling Voltage OFF in idle path
write /sys/kernel/debug/pm_debug/voltage_off_while_idle 1
# Enabling OFF mode
write /sys/kernel/debug/pm_debug/enable_off_mode 1
# switch CPUfreq from performance to ondemand
write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor ondemand
write /sys/devices/system/cpu/cpufreq/ondemand/up_threshold 50
# autosuspend root hubs immediatly after attached devices
write /sys/bus/usb/devices/usb1/power/autosuspend_delay_ms 0
write /sys/bus/usb/devices/usb2/power/autosuspend_delay_ms 0
# Enable SmartReflex autocompensation on VDD1 & VDD2
write /sys/kernel/debug/smartreflex/sr_core/autocomp 1
write /sys/kernel/debug/smartreflex/sr_mpu_iva/autocomp 1
# Permissions for the power HAL
chown system system /sys/devices/platform/omap/pvrsrvkm.0/pin_core_clk
chmod 0664 /sys/devices/platform/dsscomp/isprsz/enable
chown system graphics /sys/devices/platform/dsscomp/isprsz/enable
# change permissions for overlay managers and display devices
chmod 0664 /sys/devices/platform/omapdss/manager0/name
chmod 0664 /sys/devices/platform/omapdss/manager1/name
chown system graphics /sys/devices/platform/omapdss/manager0/name
chown system graphics /sys/devices/platform/omapdss/manager1/name
chmod 0664 /sys/devices/platform/omapdss/display0/name
chown system graphics /sys/devices/platform/omapdss/display0/name
chmod 0664 /sys/devices/platform/omapdss/display0/enabled
chown system graphics /sys/devices/platform/omapdss/display0/enabled
chmod 0664 /sys/devices/platform/omapdss/display0/timings
chown system graphics /sys/devices/platform/omapdss/display0/timings
chmod 0664 /sys/devices/platform/omapdss/overlay0/manager
chmod 0664 /sys/devices/platform/omapdss/overlay1/manager
chmod 0664 /sys/devices/platform/omapdss/overlay2/manager
chown system graphics /sys/devices/platform/omapdss/overlay0/manager
chown system graphics /sys/devices/platform/omapdss/overlay1/manager
chown system graphics /sys/devices/platform/omapdss/overlay2/manager
chmod 0664 /sys/devices/platform/omapdss/overlay0/enabled
chmod 0664 /sys/devices/platform/omapdss/overlay1/enabled
chmod 0664 /sys/devices/platform/omapdss/overlay2/enabled
chown system graphics /sys/devices/platform/omapdss/overlay0/enabled
chown system graphics /sys/devices/platform/omapdss/overlay1/enabled
chown system graphics /sys/devices/platform/omapdss/overlay2/enabled
#Set read_ahead buffers
write /sys/block/mmcblk0/bdi/read_ahead_kb 1024
write /sys/block/mmcblk1/bdi/read_ahead_kb 1024
# There's no back seek penalty on MMC
write /sys/devices/platform/omap/omap_hsmmc.1/mmc_host/mmc0/mmc0:0001/block/mmcblk0/queue/iosched/back_seek_penalty 0
# Allow us to seek up to 1GB back
write /sys/devices/platform/omap/omap_hsmmc.1/mmc_host/mmc0/mmc0:0001/block/mmcblk0/queue/iosched/back_seek_max 1048576
# Only pick one request from each queue at each round robin
write /sys/devices/platform/omap/omap_hsmmc.1/mmc_host/mmc0/mmc0:0001/block/mmcblk0/queue/iosched/quantum 1
# change permissions for overlay managers and display devices
chown system system /sys/devices/platform/omapdss/display0/enabled
chown system system /sys/devices/platform/omapdss/display1/enabled
chown system system /sys/devices/platform/omapdss/display2/enabled
chown system system /sys/devices/platform/omapdss/display3/enabled
chown system system /sys/devices/platform/omapdss/display0/name
chown system system /sys/devices/platform/omapdss/display1/name
chown system system /sys/devices/platform/omapdss/display2/name
chown system system /sys/devices/platform/omapdss/display3/name
chown system system /sys/devices/platform/omapdss/overlay0/manager
chown system system /sys/devices/platform/omapdss/overlay1/manager
chown system system /sys/devices/platform/omapdss/overlay2/manager
chown system system /sys/devices/platform/omapdss/overlay3/manager
chown system graphics /sys/devices/platform/omapdss/overlay0/zorder
chown system graphics /sys/devices/platform/omapdss/overlay1/zorder
chown system graphics /sys/devices/platform/omapdss/overlay2/zorder
chown system system /sys/devices/platform/omapdss/overlay3/zorder
# change permissions for manager tranparency parameters
chown system system /sys/devices/platform/omapdss/manager0/name
chown system system /sys/devices/platform/omapdss/manager0/display
chown system system /sys/devices/platform/omapdss/manager1/name
chown system system /sys/devices/platform/omapdss/manager1/display
chown system system /sys/devices/platform/omapdss/manager2/name
chown system system /sys/devices/platform/omapdss/manager2/display
chown system system /sys/devices/platform/omapdss/overlay0/enabled
chown system system /sys/devices/platform/omapdss/overlay1/enabled
chown system system /sys/devices/platform/omapdss/overlay2/enabled
chown system system /sys/devices/platform/omapdss/overlay3/enabled
# change permissions for display timings to get the resolutions
chown system system /sys/devices/platform/omapdss/display0/timings
chown system system /sys/devices/platform/omapdss/display1/timings
chown system system /sys/devices/platform/omapdss/display2/timings
chown system system /sys/devices/platform/omapdss/display3/timings
chown system system /sys/devices/platform/omapdss/display2/code
on early-boot
start pvrsrvinit
on boot
on property:dev.bootcomplete=1
start bootcnt
class_start default
# Enable KSM to merge duplicate memory pages
write /sys/kernel/mm/ksm/pages_to_scan 100
write /sys/kernel/mm/ksm/sleep_millisecs 500
write /sys/kernel/mm/ksm/run 1
service fsfinder /sbin/fsfinder
class core
disabled
oneshot
#service mountd /system/bin/mountd
# socket mountd stream 0660 root mount
# Initialize the SGX driver
service pvrsrvinit /system/bin/pvrsrvinit
class core
user root
group root
disabled
oneshot
service configure_vold /system/bin/configure_vold.sh
class core
disabled
oneshot
# Update the battery data heuristics every hour
service logbatterydata /system/bin/log_battery_data.sh
class core
user root
group root
# OMAP specific services start here
service bootcnt /system/bin/clear_bootcnt.sh
class core
user root
group root
disabled
oneshot
# OMAP stuff:
# most of this is unused for the moment.
#service pppd_gprs /etc/init.gprs-pppd /dev/pts/1
# user root
# group radio cache inet misc
# disabled
#service fw3a /system/bin/fw3a_core
# user media
# group system camera
service uim /system/bin/uim-sysfs
class core
user root
group media bluetooth
oneshot
service store_mac_addr /system/xbin/store-mac-addr.sh
class core
disabled
oneshot
#service ifcfg_ti /system/bin/netcfg wlan0 up
# class main
# disabled
# oneshot
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
class main
socket wpa_wlan0 dgram 660 wifi wifi
disabled
oneshot
service dhcpcd_wlan0 /system/bin/dhcpcd -ABKL
class main
disabled
oneshot
service iprenew_wlan0 /system/bin/dhcpcd -n
class main
disabled
oneshot
service dhcpcd_bt-pan /system/bin/dhcpcd -ABKL
class main
disabled
oneshot
service iprenew_bt-pan /system/bin/dhcpcd -n
class main
disabled
oneshot
# FUSE sdcard daemon for rich permissions on external storage (runs as media_rw)
service fuse_sdcard1 /system/bin/sdcard -u 1023 -g 1023 -d /mnt/media_rw/sdcard1 /storage/sdcard1
class late_start
disabled
service fuse_sdcard0 /system/bin/sdcard -u 1023 -g 1023 /mnt/media_rw/sdcard0 /storage/sdcard0
class late_start
disabled
service fuse_usbdisk /system/bin/sdcard -u 1023 -g 1023 /mnt/media_rw/usbdisk /storage/usbdisk
class late_start
disabled
# load DSP firmware
service baseimage /system/bin/cexec.out /system/lib/dsp/baseimage.dof
class main
user root
group root
oneshot
# Restart adbd so it can run as root
on property:service.adb.root=1
write /sys/class/android_usb/android0/enable 0
restart adbd
write /sys/class/android_usb/android0/enable 1
#on property:sys.boot_completed=1
# log "== init.encore.rc: on property:sys.boot_completed=1 -----------------------"