blob: 9c40d94694e3d5dcb6bc0f5998f7a2842aa7520a [file] [log] [blame]
Zvikomborero VIncent Zvikarambaa25011a2016-07-21 16:32:35 -04001#!/system/bin/sh
2# Copyright (c) 2009-2014, 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 #Remove SUID bit for iproute2 ip tool
70 chmod -h 0755 /system/bin/ip
71
72 chmod -h 0444 /sys/devices/platform/msm_hsusb/gadget/usb_state
73
74 # setup permissions for fb1 related nodes
75 chown -h system.graphics /sys/class/graphics/fb1/hpd
76 chown -h system.system /sys/class/graphics/fb1/hdcp/tp
77 chmod -h 0664 /sys/devices/virtual/graphics/fb1/hpd
78 chmod -h 0664 /sys/devices/virtual/graphics/fb1/hdcp/tp
79 chmod -h 0664 /sys/devices/virtual/graphics/fb1/video_mode
80 chmod -h 0664 /sys/devices/virtual/graphics/fb1/format_3d
81
82 # Change owner and group for media server and surface flinger
83 chown -h system.system /sys/devices/virtual/graphics/fb1/format_3d
84
85 #For bridgemgr daemon to inform the USB driver of the correct transport
86 chown -h radio.radio /sys/class/android_usb/f_rmnet_smd_sdio/transport
87
88 #To allow interfaces to get v6 address when tethering is enabled
89 echo 2 > /proc/sys/net/ipv6/conf/rmnet0/accept_ra
90 echo 2 > /proc/sys/net/ipv6/conf/rmnet1/accept_ra
91 echo 2 > /proc/sys/net/ipv6/conf/rmnet2/accept_ra
92 echo 2 > /proc/sys/net/ipv6/conf/rmnet3/accept_ra
93 echo 2 > /proc/sys/net/ipv6/conf/rmnet4/accept_ra
94 echo 2 > /proc/sys/net/ipv6/conf/rmnet5/accept_ra
95 echo 2 > /proc/sys/net/ipv6/conf/rmnet6/accept_ra
96 echo 2 > /proc/sys/net/ipv6/conf/rmnet7/accept_ra
97 echo 2 > /proc/sys/net/ipv6/conf/rmnet_sdio0/accept_ra
98 echo 2 > /proc/sys/net/ipv6/conf/rmnet_sdio1/accept_ra
99 echo 2 > /proc/sys/net/ipv6/conf/rmnet_sdio2/accept_ra
100 echo 2 > /proc/sys/net/ipv6/conf/rmnet_sdio3/accept_ra
101 echo 2 > /proc/sys/net/ipv6/conf/rmnet_sdio4/accept_ra
102 echo 2 > /proc/sys/net/ipv6/conf/rmnet_sdio5/accept_ra
103 echo 2 > /proc/sys/net/ipv6/conf/rmnet_sdio6/accept_ra
104 echo 2 > /proc/sys/net/ipv6/conf/rmnet_sdio7/accept_ra
105 echo 2 > /proc/sys/net/ipv6/conf/rmnet_usb0/accept_ra
106 echo 2 > /proc/sys/net/ipv6/conf/rmnet_usb1/accept_ra
107 echo 2 > /proc/sys/net/ipv6/conf/rmnet_usb2/accept_ra
108 echo 2 > /proc/sys/net/ipv6/conf/rmnet_usb3/accept_ra
109
110 # To prevent out of order acknowledgements from making
111 # connection tracking to treat them as not belonging to
112 # the connection they belong to.
113 # Otherwise, a weird issue happens in which some long
114 # connections on high-throughput links get dropped when
115 # an ack packet comes out of order
116 echo 1 > /proc/sys/net/netfilter/nf_conntrack_tcp_be_liberal
117
118#TODO:
119# basic network init
120# ifup lo
121# hostname localhost
122# domainname localdomain
123
124# set RLIMIT_NICE to allow priorities from 19 to -20
125# setrlimit 13 40 40
126
127# Memory management. Basic kernel parameters, and allow the high
128# level system server to be able to adjust the kernel OOM driver
129# parameters to match how it is managing things.
130 echo 1 > /proc/sys/vm/overcommit_memory
131 echo 4 > /proc/sys/vm/min_free_order_shift
132 chown -h root.system /sys/module/lowmemorykiller/parameters/adj
133 chmod -h 0664 /sys/module/lowmemorykiller/parameters/adj
134 chown -h root.system /sys/module/lowmemorykiller/parameters/minfree
135 chmod -h 0664 /sys/module/lowmemorykiller/parameters/minfree
136
137 # Tweak background writeout
138 echo 200 > /proc/sys/vm/dirty_expire_centisecs
139 echo 5 > /proc/sys/vm/dirty_background_ratio
140
141 # Permissions for System Server and daemons.
142 chown -h radio.system /sys/android_power/state
143 chown -h radio.system /sys/android_power/request_state
144 chown -h radio.system /sys/android_power/acquire_full_wake_lock
145 chown -h radio.system /sys/android_power/acquire_partial_wake_lock
146 chown -h radio.system /sys/android_power/release_wake_lock
147 chown -h system.system /sys/power/autosleep
148 chown -h system.system /sys/power/state
149 chown -h system.system /sys/power/wakeup_count
150 chown -h radio.system /sys/power/wake_lock
151 chown -h radio.system /sys/power/wake_unlock
152 chmod -h 0660 /sys/power/state
153 chmod -h 0660 /sys/power/wake_lock
154 chmod -h 0660 /sys/power/wake_unlock
155
156 chown -h system.system /sys/devices/system/cpu/cpufreq/interactive/timer_rate
157 chmod -h 0660 /sys/devices/system/cpu/cpufreq/interactive/timer_rate
158 chown -h system.system /sys/devices/system/cpu/cpufreq/interactive/min_sample_time
159 chmod -h 0660 /sys/devices/system/cpu/cpufreq/interactive/min_sample_time
160 chown -h system.system /sys/devices/system/cpu/cpufreq/interactive/hispeed_freq
161 chmod -h 0660 /sys/devices/system/cpu/cpufreq/interactive/hispeed_freq
162 chown -h system.system /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load
163 chmod -h 0660 /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load
164 chown -h system.system /sys/devices/system/cpu/cpufreq/interactive/above_hispeed_delay
165 chmod -h 0660 /sys/devices/system/cpu/cpufreq/interactive/above_hispeed_delay
166 chown -h system.system /sys/devices/system/cpu/cpufreq/interactive/boost
167 chmod -h 0660 /sys/devices/system/cpu/cpufreq/interactive/boost
168 chown -h system.system /sys/devices/system/cpu/cpufreq/interactive/boostpulse
169 chown -h system.system /sys/devices/system/cpu/cpufreq/interactive/input_boost
170 chmod -h 0660 /sys/devices/system/cpu/cpufreq/interactive/input_boost
171 chown -h system.system /sys/devices/system/cpu/cpufreq/interactive/boostpulse_duration
172 chmod -h 0660 /sys/devices/system/cpu/cpufreq/interactive/boostpulse_duration
173
174 # Assume SMP uses shared cpufreq policy for all CPUs
175 chown -h system.system /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
176 chmod -h 0660 /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
177
178 chown -h system.system /sys/class/timed_output/vibrator/enable
179 chown -h system.system /sys/class/leds/keyboard-backlight/brightness
180 chown -h system.system /sys/class/leds/lcd-backlight/brightness
181 chown -h system.system /sys/class/leds/button-backlight/brightness
182 chown -h system.system /sys/class/leds/jogball-backlight/brightness
183 chown -h system.system /sys/class/leds/red/brightness
184 chown -h system.system /sys/class/leds/green/brightness
185 chown -h system.system /sys/class/leds/blue/brightness
186 chown -h system.system /sys/class/leds/red/device/grpfreq
187 chown -h system.system /sys/class/leds/red/device/grppwm
188 chown -h system.system /sys/class/leds/red/device/blink
189 chown -h system.system /sys/class/leds/red/brightness
190 chown -h system.system /sys/class/leds/green/brightness
191 chown -h system.system /sys/class/leds/blue/brightness
192 chown -h system.system /sys/class/leds/red/device/grpfreq
193 chown -h system.system /sys/class/leds/red/device/grppwm
194 chown -h system.system /sys/class/leds/red/device/blink
195 chown -h system.system /sys/class/timed_output/vibrator/enable
196 chown -h system.system /sys/module/sco/parameters/disable_esco
197 chown -h system.system /sys/kernel/ipv4/tcp_wmem_min
198 chown -h system.system /sys/kernel/ipv4/tcp_wmem_def
199 chown -h system.system /sys/kernel/ipv4/tcp_wmem_max
200 chown -h system.system /sys/kernel/ipv4/tcp_rmem_min
201 chown -h system.system /sys/kernel/ipv4/tcp_rmem_def
202 chown -h system.system /sys/kernel/ipv4/tcp_rmem_max
203 chown -h root radio /proc/cmdline
204
205# Define TCP buffer sizes for various networks
206# ReadMin, ReadInitial, ReadMax, WriteMin, WriteInitial, WriteMax,
207 setprop net.tcp.buffersize.default 4096,87380,110208,4096,16384,110208
208 setprop net.tcp.buffersize.wifi 524288,1048576,2097152,262144,524288,1048576
209 setprop net.tcp.buffersize.lte 524288,1048576,2097152,262144,524288,1048576
210 setprop net.tcp.buffersize.umts 4094,87380,110208,4096,16384,110208
211 setprop net.tcp.buffersize.hspa 4094,87380,1220608,4096,16384,1220608
212 setprop net.tcp.buffersize.hsupa 4094,87380,1220608,4096,16384,1220608
213 setprop net.tcp.buffersize.hsdpa 4094,87380,1220608,4096,16384,1220608
214 setprop net.tcp.buffersize.hspap 4094,87380,1220608,4096,16384,1220608
215 setprop net.tcp.buffersize.edge 4093,26280,35040,4096,16384,35040
216 setprop net.tcp.buffersize.gprs 4092,8760,11680,4096,8760,11680
217 setprop net.tcp.buffersize.evdo 4094,87380,262144,4096,16384,262144
218
219# Assign TCP buffer thresholds to be ceiling value of technology maximums
220# Increased technology maximums should be reflected here.
221 echo 2097152 > /proc/sys/net/core/rmem_max
222 echo 2097152 > /proc/sys/net/core/wmem_max
223
224# Set the property to indicate type of virtual display to 0
225# 0 indicates that virtual display is not a Wifi display and that the
226# session is not exercised through RemoteDisplay in the android framework
227 setprop persist.sys.wfd.virtual 0
228
229# Set this property so surfaceflinger is not started by system_init
230 setprop system_init.startsurfaceflinger 0
231
232# Configurate USB in FFBM mode, two big change for USB.
233# 1) Using diag,adb in FFBM mode, too many interface will cause
234# problem in factory for multi-line test
235# 2) Not config usb serialnum. Using the default value:"0123456789ABCDEF"
236# Keep the USB serialnum no change for devices. this fix the problem
237# of port change for various devices.
238chown -h root.system /sys/devices/platform/msm_hsusb/gadget/wakeup
239chmod -h 220 /sys/devices/platform/msm_hsusb/gadget/wakeup
240setprop persist.sys.usb.config diag,adb
241
242# Start the following services needed for fftm
243 start logd
244 start config_bluetooth
245 start media
246 start fastmmi
247 start wcnss-service
248 start qcom-post-boot
249 start rmt_storage
250 start qcom-c_main-sh
251 start irsc_util
252 start qcamerasvr
253 start qcomsysd
254 start ptt_ffbm
255 start ftm_ffbm