1import init.manta.usb.rc
2
3on init
4    start watchdogd
5
6    # See storage config details at http://source.android.com/tech/storage/
7    mkdir /mnt/shell/emulated 0700 shell shell
8    mkdir /storage/emulated 0555 root root
9
10    export EXTERNAL_STORAGE /storage/emulated/legacy
11    export EMULATED_STORAGE_SOURCE /mnt/shell/emulated
12    export EMULATED_STORAGE_TARGET /storage/emulated
13
14    # Support legacy paths
15    symlink /storage/emulated/legacy /sdcard
16    symlink /storage/emulated/legacy /mnt/sdcard
17    symlink /storage/emulated/legacy /storage/sdcard0
18    symlink /mnt/shell/emulated/0 /storage/emulated/legacy
19
20# KSM
21    write /sys/kernel/mm/ksm/pages_to_scan 100
22    write /sys/kernel/mm/ksm/sleep_millisecs 500
23#    write /sys/kernel/mm/ksm/run 1
24
25on post-fs-data
26    mkdir /data/media 0770 media_rw media_rw
27
28    setprop vold.post_fs_data_done 1
29
30# permissions for bluetooth.
31	setprop ro.bt.bdaddr_path "/factory/bluetooth/bt_addr"
32	chown bluetooth net_bt_stack ro.bt.bdaddr_path
33	chown bluetooth net_bt_stack /dev/ttySAC0
34	chmod 0660 /dev/ttySAC0
35	chmod 0660 /sys/class/rfkill/rfkill0/state
36	chown bluetooth net_bt_stack /sys/class/rfkill/rfkill0/state
37	chown bluetooth net_bt_stack /sys/class/rfkill/rfkill0/type
38
39on boot
40    # override init.rc to keep plenty of large order chunks around
41    # to improve allocation times
42    write /proc/sys/vm/min_free_order_shift 1
43
44    mount debugfs /sys/kernel/debug /sys/kernel/debug
45    setprop ro.radio.noril yes
46
47    # Set up kernel tracing, but disable it by default
48    chmod 0222 /sys/kernel/debug/tracing/trace_marker
49    write /sys/kernel/debug/tracing/tracing_on 0
50
51    chmod 0444 /sys/kernel/debug/smb347-regs
52
53# Set Mali power policy as Coarse demand
54    write /sys/devices/platform/mali.0/power_policy coarse_demand
55
56on fs
57    mkdir /factory 0775 radio radio
58
59    mount_all /fstab.manta
60    restorecon_recursive /factory
61    mount ext4 /dev/block/platform/dw_mmc.0/by-name/efs /factory ro remount
62    setprop ro.crypto.fuse_sdcard true
63
64# Permissions for backlight
65    chmod 0660 /sys/class/backlight/pwm-backlight.0/brightness
66    chown system system /sys/class/backlight/pwm-backlight.0/brightness
67
68# create data/gps for GPS daemon
69    chown root system /sys/class/gps/bcm475x/GPS_PWR_EN/value
70    chmod 0664 /sys/class/gps/bcm475x/GPS_PWR_EN/value
71    chown root system /sys/class/gps/bcm475x/GPS_nRST/value
72    chmod 0664 /sys/class/gps/bcm475x/GPS_nRST/value
73    mkdir /data/gps 771 gps system
74    chown gps system /data/gps
75
76# NFC: create data/nfc for nv storage
77    mkdir /data/nfc 770 nfc nfc
78    mkdir /data/nfc/param 770 nfc nfc
79
80# audio: permissions for voice processing
81    # global switch for voice processing effects
82    chown root audio /sys/class/i2c-dev/i2c-4/device/4-003e/voice_processing
83    chmod 0660 /sys/class/i2c-dev/i2c-4/device/4-003e/voice_processing
84    # voice processing chip sleep
85    chown root audio /sys/class/i2c-dev/i2c-4/device/4-003e/sleep
86    chmod 0660 /sys/class/i2c-dev/i2c-4/device/4-003e/sleep
87    # voice processing usecase preset
88    chown root audio /sys/class/i2c-dev/i2c-4/device/4-003e/preset
89    chmod 0660 /sys/class/i2c-dev/i2c-4/device/4-003e/preset
90    # voice processing noise suppression level
91    chown root audio /sys/class/i2c-dev/i2c-4/device/4-003e/tx_ns_level
92    chmod 0660 /sys/class/i2c-dev/i2c-4/device/4-003e/tx_ns_level
93    # voice processing AGC enable (TX)
94    chown root audio /sys/class/i2c-dev/i2c-4/device/4-003e/tx_agc_enable
95    chmod 0660 /sys/class/i2c-dev/i2c-4/device/4-003e/tx_agc_enable
96    # voice processing AEC enable
97    chown root audio /sys/class/i2c-dev/i2c-4/device/4-003e/aec_enable
98    chmod 0660 /sys/class/i2c-dev/i2c-4/device/4-003e/aec_enable
99
100# virtual sdcard daemon running as media_rw (1023)
101service sdcard /system/bin/sdcard -u 1023 -g 1023 -l /data/media /mnt/shell/emulated
102    class late_start
103
104service p2p_supplicant /system/bin/wpa_supplicant \
105    -iwlan0 -Dnl80211 -c/data/misc/wifi/wpa_supplicant.conf \
106    -I/system/etc/wifi/wpa_supplicant_overlay.conf -N \
107    -ip2p0 -Dnl80211 -c/data/misc/wifi/p2p_supplicant.conf \
108    -I/system/etc/wifi/p2p_supplicant_overlay.conf \
109    -puse_p2p_group_interface=1 \
110    -e/data/misc/wifi/entropy.bin -g@android:wpa_wlan0
111    #   we will start as root and wpa_supplicant will switch to user wifi
112    #   after setting up the capabilities required for WEXT
113    #   user wifi
114    #   group wifi inet keystore
115    class main
116    socket wpa_wlan0 dgram 660 wifi wifi
117    disabled
118    oneshot
119
120service wpa_supplicant /system/bin/wpa_supplicant \
121    -iwlan0 -Dnl80211 -c/data/misc/wifi/wpa_supplicant.conf \
122    -I/system/etc/wifi/wpa_supplicant_overlay.conf \
123    -e/data/misc/wifi/entropy.bin -g@android:wpa_wlan0
124    #   we will start as root and wpa_supplicant will switch to user wifi
125    #   after setting up the capabilities required for WEXT
126    #   user wifi
127    #   group wifi inet keystore
128    class main
129    socket wpa_wlan0 dgram 660 wifi wifi
130    disabled
131    oneshot
132
133service dhcpcd_wlan0 /system/bin/dhcpcd -aABDKL
134    class main
135    disabled
136    oneshot
137
138service dhcpcd_p2p /system/bin/dhcpcd -aABKL
139    class main
140    disabled
141    oneshot
142
143service dhcpcd_eth0 /system/bin/dhcpcd -ABDKL
144    class main
145    disabled
146    oneshot
147
148service dhcpcd_bt-pan /system/bin/dhcpcd -ABKL
149    class main
150    disabled
151    oneshot
152
153service iprenew_wlan0 /system/bin/dhcpcd -n
154    class main
155    disabled
156    oneshot
157
158service iprenew_p2p /system/bin/dhcpcd -n
159    class main
160    disabled
161    oneshot
162
163service iprenew_eth0 /system/bin/dhcpcd -n
164    class main
165    disabled
166    oneshot
167
168service iprenew_bt-pan /system/bin/dhcpcd -n
169    class main
170    disabled
171    oneshot
172
173service battery_charger /charger
174    class charger
175    critical
176    seclabel u:r:healthd:s0
177
178# Set watchdog timer to 30 seconds and pet it every 10 seconds to get a 20 second margin
179service watchdogd /sbin/watchdogd 10 20
180    class core
181    seclabel u:r:watchdogd:s0
182
183service gpsd /system/vendor/bin/gpsd -c /system/vendor/etc/gps.xml
184    class main
185    socket gps seqpacket 0660 gps system
186    user gps
187    group system inet
188
189# MobiCore startup
190service mobicore /system/bin/mcDriverDaemon -r /system/vendor/secapp/020a0000000000000000000000000000.drbin
191    setenv MC_REGISTRY_PATH /system/vendor/secapp
192    user drmrpc
193    group drmrpc
194    class main
195
196# on userdebug and eng builds, enable kgdb on the serial console
197on property:ro.debuggable=1
198    write /sys/module/kgdboc/parameters/kgdboc ttyFIQ2
199    write /sys/module/fiq_debugger/parameters/kgdb_enable 1
200
201# bugreport is triggered by holding down volume down, volume up and power
202service bugreport /system/bin/dumpstate -d -p -B \
203        -o /data/data/com.android.shell/files/bugreports/bugreport
204    class main
205    disabled
206    oneshot
207    keycodes 114 115 116
208