summaryrefslogtreecommitdiffstats
path: root/rootdir/init.tuna.rc
blob: 892302a2d6a1524095630b48730a934e8a0e5fc5 (plain)
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
import init.omap4.rc
import init.tuna.usb.rc

on init
    # Support legacy paths
    symlink /sdcard /mnt/sdcard
    symlink /sdcard /storage/sdcard0

    # create directory for mounting usb drives
    chmod 0701 /mnt/media_rw
    mkdir /mnt/media_rw/usbdisk 0775 system system
    mkdir /storage/usbdisk 0000 system system

    # KSM
    write /sys/kernel/mm/ksm/pages_to_scan 100
    write /sys/kernel/mm/ksm/sleep_millisecs 500
    write /sys/kernel/mm/ksm/run 1

on post-fs-data
    mkdir /data/smc 0770 drmrpc drmrpc
    chown drmrpc drmrpc /data/smc/counter.bin
    chown drmrpc drmrpc /data/smc/storage.bin
    chown drmrpc drmrpc /data/smc/system.bin

    # camera calibration
    mkdir /data/misc/camera 0770 media media
    mkdir /data/misc/camera/R5_MVEN003_LD2_ND0_IR0_SH0_FL1_SVEN003_DCCID1044 0770 media media

    mkdir /data/radio 0775 radio radio
    mkdir /data/radio/log 0775 radio radio

    setprop vold.post_fs_data_done 1

    # LTE
    chown radio system /sys/devices/tuna_otg/usb_sel
    chown radio system /sys/devices/tuna_otg/uart_sel
    chown radio system /sys/bus/i2c/drivers/fsa9480/4-0025/switch
    chmod 0660 /sys/bus/i2c/drivers/fsa9480/4-0025/switch
    chmod 0660 /sys/devices/tuna_otg/uart_sel
    chmod 0660 /sys/devices/tuna_otg/usb_sel

on boot
    mount debugfs /sys/kernel/debug /sys/kernel/debug

    # 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

    # Prevents permission denied error for telephony
    chmod 0644 /proc/cmdline

on fs
    mkdir /factory 0775 radio radio

    mount_all /fstab.tuna
    swapon_all /fstab.tuna

    restorecon /dev/block/platform/omap/omap_hsmmc.0/by-name/radio
    restorecon_recursive /factory
    mount ext4 /dev/block/platform/omap/omap_hsmmc.0/by-name/efs /factory ro remount

    # read only 1 page at a time
    write /proc/sys/vm/page-cluster 0

    # set swappines to 100
    write /proc/sys/vm/swappiness 100

    # increase read-ahead value to 256 kb
    write /sys/block/mmcblk0/queue/read_ahead_kb 256

    # change permissions for mtd device
    chmod 0660 /dev/mtd/mtd0
    chown media media /dev/mtd/mtd0

    # change permissions for i2c-2 device
    chmod 0660 /dev/i2c-2
    chown media media /dev/i2c-2

    # pvr module
    insmod /system/lib/modules/pvrsrvkm_sgx540_120.ko

    # add symlink for HDCP key
    symlink /factory/hdcp.keys /system/vendor/firmware/hdcp.keys

    # nfc
    setprop ro.nfc.port "COM4"
    chmod 0600 /dev/ttyO3
    chown nfc nfc /dev/ttyO3
    chmod 0600 /sys/devices/platform/nfc-power/nfc_power
    chown nfc nfc /sys/devices/platform/nfc-power/nfc_power

    # permissions for bluetooth.
    setprop ro.bt.bdaddr_path "/factory/bluetooth/bt_addr"
    chown bluetooth bluetooth ro.bt.bdaddr_path
    chown bluetooth bluetooth /dev/ttyO1
    chmod 0600 /dev/ttyO1
    chmod 0660 /sys/class/rfkill/rfkill0/state
    chown bluetooth bluetooth /sys/class/rfkill/rfkill0/state
    chown bluetooth bluetooth /sys/class/rfkill/rfkill0/type

    # backlight
    chown system system /sys/class/backlight/s6e8aa0/brightness

    # leds
    chown system system /dev/an30259a_leds

    # for GPS
    chown root system /sys/class/sec/gps/GPS_PWR_EN/value
    chmod 0660 /sys/class/sec/gps/GPS_PWR_EN/value
    chown root system /sys/class/sec/gps/GPS_nRST/value
    chmod 0660 /sys/class/sec/gps/GPS_nRST/value
    chown system system /proc/mcspi1_cs3_ctrl
    chmod 0600 /proc/mcspi1_cs3_ctrl

    # ril control auto-suspend
    chmod 0660 /sys/bus/usb/devices/usb1/power/control
    chown radio radio /sys/bus/usb/devices/usb1/power/control

	# CMHW permissions
	# Adaptive backlight
	chmod 0666 /sys/class/backlight/s6e8aa0/acl_set
	# Gamma
	chmod 0666 /sys/devices/platform/omapdss/manager0/gamma

on charger
    mount ext4 /dev/block/platform/omap/omap_hsmmc.0/by-name/system /system ro

on property:persist.sys.tuna.off_mode=*
    write /d/pm_debug/enable_off_mode ${persist.sys.tuna.off_mode}

on property:ril.modem.lte.powercontrol=*
    write /sys/bus/usb/devices/1-1/power/control ${ril.modem.lte.powercontrol}

service dumpdcc /system/bin/dumpdcc
    user media
    group media
    class late_start
    oneshot

# create filesystems if necessary
service setup_fs /system/bin/setup_fs \
        /dev/block/platform/omap/omap_hsmmc.0/by-name/cache \
        /dev/block/platform/omap/omap_hsmmc.0/by-name/userdata
        class core
        user root
        group root
        oneshot

service tf_daemon /system/bin/tf_daemon \
        -d -c /vendor/etc/smc_normal_world_android_cfg.ini
        class main
        user drmrpc
        group drmrpc
        disabled

service smc_pa_wvdrm /system/bin/smc_pa_ctrl \
        -c /vendor/etc/smc_normal_world_android_cfg.ini \
        start /vendor/firmware/smc_pa_wvdrm.ift
        class core
        user drmrpc
        group drmrpc
        oneshot
        disabled

service fuse_usbdisk /system/bin/sdcard -u 1023 -g 1023 /mnt/media_rw/usbdisk /storage/usbdisk
    class late_start
    disabled

service p2p_supplicant /system/bin/wpa_supplicant \
    -iwlan0 -Dnl80211 -c/data/misc/wifi/wpa_supplicant.conf \
    -I/system/etc/wifi/wpa_supplicant_overlay.conf -N \
    -ip2p0 -Dnl80211 -c/data/misc/wifi/p2p_supplicant.conf \
    -I/system/etc/wifi/p2p_supplicant_overlay.conf \
    -O/data/misc/wifi/sockets -puse_p2p_group_interface=1 \
    -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 wpa_supplicant /system/bin/wpa_supplicant \
    -iwlan0 -Dnl80211 -c/data/misc/wifi/wpa_supplicant.conf \
    -I/system/etc/wifi/wpa_supplicant_overlay.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 main
    disabled
    oneshot

service dhcpcd_p2p /system/bin/dhcpcd -aABKL
    class main
    disabled
    oneshot

service dhcpcd_bt-pan /system/bin/dhcpcd -ABKL
    class main
    disabled
    oneshot

service dhcpcd_eth0 /system/bin/dhcpcd -ABDKL
    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_bt-pan /system/bin/dhcpcd -n
    class main
    disabled
    oneshot

service iprenew_eth0 /system/bin/dhcpcd -n
    class main
    disabled
    oneshot

# bugreport is triggered by holding down volume down, volume up and power
service bugreport /system/bin/dumpstate -d -p -B \
        -o /data/data/com.android.shell/files/bugreports/bugreport
    class main
    disabled
    oneshot
    keycodes 114 115 116

service battery_charger /sbin/healthd -c
    class charger
    critical
    seclabel u:r:healthd:s0

# Allow writing to the kernel trace log. Enabling tracing still requires root.
on property:ro.debuggable=1
    chmod 0222 /sys/kernel/debug/tracing/trace_marker