blob: 6ba48236e68ebc5fd93b894941f44a6ee65f9c08 [file] [log] [blame]
Zvikomborero VIncent Zvikarambaa25011a2016-07-21 16:32:35 -04001#!/system/bin/sh
2# Copyright (c) 2009-2013, The Linux Foundation. All rights reserved.
3#
4# Redistribution and use in source and binary forms, with or without
5# modification, are permitted provided that the following conditions are met:
6# * Redistributions of source code must retain the above copyright
7# notice, this list of conditions and the following disclaimer.
8# * Redistributions in binary form must reproduce the above copyright
9# notice, this list of conditions and the following disclaimer in the
10# documentation and/or other materials provided with the distribution.
11# * Neither the name of The Linux Foundation nor
12# the names of its contributors may be used to endorse or promote
13# products derived from this software without specific prior written
14# permission.
15#
16# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18# IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19# NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
20# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
22# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
23# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
25# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
26# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27#
28
29# Actions on fast factory test mode
30 chown -h bluetooth.bluetooth /sys/module/bluetooth_power/parameters/power
31 chown -h bluetooth.bluetooth /sys/class/rfkill/rfkill0/type
32 chown -h bluetooth.bluetooth /sys/class/rfkill/rfkill0/state
33 chown -h bluetooth.bluetooth /proc/bluetooth/sleep/proto
34 chown -h system.system /sys/module/sco/parameters/disable_esco
35 chown -h bluetooth.bluetooth /sys/module/hci_smd/parameters/hcismd_set
36 chmod -h 0660 /sys/module/bluetooth_power/parameters/power
37 chmod -h 0660 /sys/module/hci_smd/parameters/hcismd_set
38 chmod -h 0660 /sys/class/rfkill/rfkill0/state
39 chmod -h 0660 /proc/bluetooth/sleep/proto
40 chown -h bluetooth.bluetooth /dev/ttyHS0
41 chmod -h 0660 /dev/ttyHS0
42 chown -h bluetooth.bluetooth /sys/devices/platform/msm_serial_hs.0/clock
43 chmod -h 0660 /sys/devices/platform/msm_serial_hs.0/clock
44
45 chmod -h 0660 /dev/ttyHS2
46 chown -h bluetooth.bluetooth /dev/ttyHS2
47
48 #Create QMUX deamon socket area
49 mkdir -p /dev/socket/qmux_radio
50 chown -h radio.radio /dev/socket/qmux_radio
51 chmod -h 2770 /dev/socket/qmux_radio
52 mkdir -p /dev/socket/qmux_audio
53 chown -h media.audio /dev/socket/qmux_audio
54 chmod -h 2770 /dev/socket/qmux_audio
55 mkdir -p /dev/socket/qmux_bluetooth
56 chown -h bluetooth.bluetooth /dev/socket/qmux_bluetooth
57 chmod -h 2770 /dev/socket/qmux_bluetooth
58 mkdir -p /dev/socket/qmux_gps
59 chown -h gps.gps /dev/socket/qmux_gps
60 chmod -h 2770 /dev/socket/qmux_gps
61
62 # Allow QMUX daemon to assign port open wait time
63 chown -h radio.radio /sys/devices/virtual/hsicctl/hsicctl0/modem_wait
64
65 setprop wifi.interface wlan0
66
67 setprop ro.telephony.call_ring.multiple false
68
69 #Set SUID bit for usbhub
70 chmod -h 4755 /system/bin/usbhub
71 chmod -h 755 /system/bin/usbhub_init
72
73 #Remove SUID bit for iproute2 ip tool
74 chmod -h 0755 /system/bin/ip
75
76 chmod -h 0444 /sys/devices/platform/msm_hsusb/gadget/usb_state
77
78 # setup permissions for fb1 related nodes
79 chown -h system.graphics /sys/class/graphics/fb1/hpd
80 chown -h system.system /sys/class/graphics/fb1/hdcp/tp
81 chmod -h 0664 /sys/devices/virtual/graphics/fb1/hpd
82 chmod -h 0664 /sys/devices/virtual/graphics/fb1/hdcp/tp
83 chmod -h 0664 /sys/devices/virtual/graphics/fb1/video_mode
84 chmod -h 0664 /sys/devices/virtual/graphics/fb1/format_3d
85
86 # Change owner and group for media server and surface flinger
87 chown -h system.system /sys/devices/virtual/graphics/fb1/format_3d
88
89 #For bridgemgr daemon to inform the USB driver of the correct transport
90 chown -h radio.radio /sys/class/android_usb/f_rmnet_smd_sdio/transport
91
92 #To allow interfaces to get v6 address when tethering is enabled
93 echo 2 > /proc/sys/net/ipv6/conf/rmnet0/accept_ra
94 echo 2 > /proc/sys/net/ipv6/conf/rmnet1/accept_ra
95 echo 2 > /proc/sys/net/ipv6/conf/rmnet2/accept_ra
96 echo 2 > /proc/sys/net/ipv6/conf/rmnet3/accept_ra
97 echo 2 > /proc/sys/net/ipv6/conf/rmnet4/accept_ra
98 echo 2 > /proc/sys/net/ipv6/conf/rmnet5/accept_ra
99 echo 2 > /proc/sys/net/ipv6/conf/rmnet6/accept_ra
100 echo 2 > /proc/sys/net/ipv6/conf/rmnet7/accept_ra
101 echo 2 > /proc/sys/net/ipv6/conf/rmnet_sdio0/accept_ra
102 echo 2 > /proc/sys/net/ipv6/conf/rmnet_sdio1/accept_ra
103 echo 2 > /proc/sys/net/ipv6/conf/rmnet_sdio2/accept_ra
104 echo 2 > /proc/sys/net/ipv6/conf/rmnet_sdio3/accept_ra
105 echo 2 > /proc/sys/net/ipv6/conf/rmnet_sdio4/accept_ra
106 echo 2 > /proc/sys/net/ipv6/conf/rmnet_sdio5/accept_ra
107 echo 2 > /proc/sys/net/ipv6/conf/rmnet_sdio6/accept_ra
108 echo 2 > /proc/sys/net/ipv6/conf/rmnet_sdio7/accept_ra
109 echo 2 > /proc/sys/net/ipv6/conf/rmnet_usb0/accept_ra
110 echo 2 > /proc/sys/net/ipv6/conf/rmnet_usb1/accept_ra
111 echo 2 > /proc/sys/net/ipv6/conf/rmnet_usb2/accept_ra
112 echo 2 > /proc/sys/net/ipv6/conf/rmnet_usb3/accept_ra
113
114 # To prevent out of order acknowledgements from making
115 # connection tracking to treat them as not belonging to
116 # the connection they belong to.
117 # Otherwise, a weird issue happens in which some long
118 # connections on high-throughput links get dropped when
119 # an ack packet comes out of order
120 echo 1 > /proc/sys/net/netfilter/nf_conntrack_tcp_be_liberal
121
122#TODO:
123# basic network init
124# ifup lo
125# hostname localhost
126# domainname localdomain
127
128# set RLIMIT_NICE to allow priorities from 19 to -20
129# setrlimit 13 40 40
130
131# Memory management. Basic kernel parameters, and allow the high
132# level system server to be able to adjust the kernel OOM driver
133# parameters to match how it is managing things.
134 echo 1 > /proc/sys/vm/overcommit_memory
135 echo 4 > /proc/sys/vm/min_free_order_shift
136 chown -h root.system /sys/module/lowmemorykiller/parameters/adj
137 chmod -h 0664 /sys/module/lowmemorykiller/parameters/adj
138 chown -h root.system /sys/module/lowmemorykiller/parameters/minfree
139 chmod -h 0664 /sys/module/lowmemorykiller/parameters/minfree
140
141 # Tweak background writeout
142 echo 200 > /proc/sys/vm/dirty_expire_centisecs
143 echo 5 > /proc/sys/vm/dirty_background_ratio
144
145 # Permissions for System Server and daemons.
146 chown -h radio.system /sys/android_power/state
147 chown -h radio.system /sys/android_power/request_state
148 chown -h radio.system /sys/android_power/acquire_full_wake_lock
149 chown -h radio.system /sys/android_power/acquire_partial_wake_lock
150 chown -h radio.system /sys/android_power/release_wake_lock
151 chown -h system.system /sys/power/autosleep
152 chown -h system.system /sys/power/state
153 chown -h system.system /sys/power/wakeup_count
154 chown -h radio.system /sys/power/wake_lock
155 chown -h radio.system /sys/power/wake_unlock
156 chmod -h 0660 /sys/power/state
157 chmod -h 0660 /sys/power/wake_lock
158 chmod -h 0660 /sys/power/wake_unlock
159
160 chown -h system.system /sys/devices/system/cpu/cpufreq/interactive/timer_rate
161 chmod -h 0660 /sys/devices/system/cpu/cpufreq/interactive/timer_rate
162 chown -h system.system /sys/devices/system/cpu/cpufreq/interactive/min_sample_time
163 chmod -h 0660 /sys/devices/system/cpu/cpufreq/interactive/min_sample_time
164 chown -h system.system /sys/devices/system/cpu/cpufreq/interactive/hispeed_freq
165 chmod -h 0660 /sys/devices/system/cpu/cpufreq/interactive/hispeed_freq
166 chown -h system.system /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load
167 chmod -h 0660 /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load
168 chown -h system.system /sys/devices/system/cpu/cpufreq/interactive/above_hispeed_delay
169 chmod -h 0660 /sys/devices/system/cpu/cpufreq/interactive/above_hispeed_delay
170 chown -h system.system /sys/devices/system/cpu/cpufreq/interactive/boost
171 chmod -h 0660 /sys/devices/system/cpu/cpufreq/interactive/boost
172 chown -h system.system /sys/devices/system/cpu/cpufreq/interactive/boostpulse
173 chown -h system.system /sys/devices/system/cpu/cpufreq/interactive/input_boost
174 chmod -h 0660 /sys/devices/system/cpu/cpufreq/interactive/input_boost
175 chown -h system.system /sys/devices/system/cpu/cpufreq/interactive/boostpulse_duration
176 chmod -h 0660 /sys/devices/system/cpu/cpufreq/interactive/boostpulse_duration
177
178 # Assume SMP uses shared cpufreq policy for all CPUs
179 chown -h system.system /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
180 chmod -h 0660 /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
181
182 chown -h system.system /sys/class/timed_output/vibrator/enable
183 chown -h system.system /sys/class/leds/keyboard-backlight/brightness
184 chown -h system.system /sys/class/leds/lcd-backlight/brightness
185 chown -h system.system /sys/class/leds/button-backlight/brightness
186 chown -h system.system /sys/class/leds/jogball-backlight/brightness
187 chown -h system.system /sys/class/leds/red/brightness
188 chown -h system.system /sys/class/leds/green/brightness
189 chown -h system.system /sys/class/leds/blue/brightness
190 chown -h system.system /sys/class/leds/red/device/grpfreq
191 chown -h system.system /sys/class/leds/red/device/grppwm
192 chown -h system.system /sys/class/leds/red/device/blink
193 chown -h system.system /sys/class/leds/red/brightness
194 chown -h system.system /sys/class/leds/green/brightness
195 chown -h system.system /sys/class/leds/blue/brightness
196 chown -h system.system /sys/class/leds/red/device/grpfreq
197 chown -h system.system /sys/class/leds/red/device/grppwm
198 chown -h system.system /sys/class/leds/red/device/blink
199 chown -h system.system /sys/class/timed_output/vibrator/enable
200 chown -h system.system /sys/module/sco/parameters/disable_esco
201 chown -h system.system /sys/kernel/ipv4/tcp_wmem_min
202 chown -h system.system /sys/kernel/ipv4/tcp_wmem_def
203 chown -h system.system /sys/kernel/ipv4/tcp_wmem_max
204 chown -h system.system /sys/kernel/ipv4/tcp_rmem_min
205 chown -h system.system /sys/kernel/ipv4/tcp_rmem_def
206 chown -h system.system /sys/kernel/ipv4/tcp_rmem_max
207 chown -h root radio /proc/cmdline
208
209# Set the property to indicate type of virtual display to 0
210# 0 indicates that virtual display is not a Wifi display and that the
211# session is not exercised through RemoteDisplay in the android framework
212 setprop persist.sys.wfd.virtual 0
213
214# Set this property so surfaceflinger is not started by system_init
215 setprop system_init.startsurfaceflinger 0
216
217# Start the following services needed for fftm
218 start config_bluetooth
219 start media
220 start fastmmi
221 start adbd
222 start qcom-post-boot
223 start rmt_storage
224 start qcom-c_main-sh
225 start irsc_util
226 start qcamerasvr
227 start qcom-usb-sh
228 start qcomsysd
229 start ptt_ffbm
230 start ftm_ffbm