PageRenderTime 39ms CodeModel.GetById 9ms RepoModel.GetById 1ms app.codeStats 0ms

/rootdir/init.qcom.factory.sh

https://gitlab.com/doti2p/android-device-configuration-for-the-xiaomi-redmi-1s
Shell | 247 lines | 156 code | 27 blank | 64 comment | 0 complexity | 2a62449d1c37c9d5ef73a6e711ddc6ad MD5 | raw file
  1. #!/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. # Actions on fast factory test mode
  29. chown -h bluetooth.bluetooth /sys/module/bluetooth_power/parameters/power
  30. chown -h bluetooth.bluetooth /sys/class/rfkill/rfkill0/type
  31. chown -h bluetooth.bluetooth /sys/class/rfkill/rfkill0/state
  32. chown -h bluetooth.bluetooth /proc/bluetooth/sleep/proto
  33. chown -h system.system /sys/module/sco/parameters/disable_esco
  34. chown -h bluetooth.bluetooth /sys/module/hci_smd/parameters/hcismd_set
  35. chmod -h 0660 /sys/module/bluetooth_power/parameters/power
  36. chmod -h 0660 /sys/module/hci_smd/parameters/hcismd_set
  37. chmod -h 0660 /sys/class/rfkill/rfkill0/state
  38. chmod -h 0660 /proc/bluetooth/sleep/proto
  39. chown -h bluetooth.bluetooth /dev/ttyHS0
  40. chmod -h 0660 /dev/ttyHS0
  41. chown -h bluetooth.bluetooth /sys/devices/platform/msm_serial_hs.0/clock
  42. chmod -h 0660 /sys/devices/platform/msm_serial_hs.0/clock
  43. chmod -h 0660 /dev/ttyHS2
  44. chown -h bluetooth.bluetooth /dev/ttyHS2
  45. #Create QMUX deamon socket area
  46. mkdir -p /dev/socket/qmux_radio
  47. chown -h radio.radio /dev/socket/qmux_radio
  48. chmod -h 2770 /dev/socket/qmux_radio
  49. mkdir -p /dev/socket/qmux_audio
  50. chown -h media.audio /dev/socket/qmux_audio
  51. chmod -h 2770 /dev/socket/qmux_audio
  52. mkdir -p /dev/socket/qmux_bluetooth
  53. chown -h bluetooth.bluetooth /dev/socket/qmux_bluetooth
  54. chmod -h 2770 /dev/socket/qmux_bluetooth
  55. mkdir -p /dev/socket/qmux_gps
  56. chown -h gps.gps /dev/socket/qmux_gps
  57. chmod -h 2770 /dev/socket/qmux_gps
  58. # Allow QMUX daemon to assign port open wait time
  59. chown -h radio.radio /sys/devices/virtual/hsicctl/hsicctl0/modem_wait
  60. setprop wifi.interface wlan0
  61. setprop ro.telephony.call_ring.multiple false
  62. #Set SUID bit for usbhub
  63. chmod -h 4755 /system/bin/usbhub
  64. chmod -h 755 /system/bin/usbhub_init
  65. #Remove SUID bit for iproute2 ip tool
  66. chmod -h 0755 /system/bin/ip
  67. chmod -h 0444 /sys/devices/platform/msm_hsusb/gadget/usb_state
  68. # setup permissions for fb1 related nodes
  69. chown -h system.graphics /sys/class/graphics/fb1/hpd
  70. chown -h system.system /sys/class/graphics/fb1/hdcp/tp
  71. chmod -h 0664 /sys/devices/virtual/graphics/fb1/hpd
  72. chmod -h 0664 /sys/devices/virtual/graphics/fb1/hdcp/tp
  73. chmod -h 0664 /sys/devices/virtual/graphics/fb1/video_mode
  74. chmod -h 0664 /sys/devices/virtual/graphics/fb1/format_3d
  75. # Change owner and group for media server and surface flinger
  76. chown -h system.system /sys/devices/virtual/graphics/fb1/format_3d
  77. #For bridgemgr daemon to inform the USB driver of the correct transport
  78. chown -h radio.radio /sys/class/android_usb/f_rmnet_smd_sdio/transport
  79. #To allow interfaces to get v6 address when tethering is enabled
  80. echo 2 > /proc/sys/net/ipv6/conf/rmnet0/accept_ra
  81. echo 2 > /proc/sys/net/ipv6/conf/rmnet1/accept_ra
  82. echo 2 > /proc/sys/net/ipv6/conf/rmnet2/accept_ra
  83. echo 2 > /proc/sys/net/ipv6/conf/rmnet3/accept_ra
  84. echo 2 > /proc/sys/net/ipv6/conf/rmnet4/accept_ra
  85. echo 2 > /proc/sys/net/ipv6/conf/rmnet5/accept_ra
  86. echo 2 > /proc/sys/net/ipv6/conf/rmnet6/accept_ra
  87. echo 2 > /proc/sys/net/ipv6/conf/rmnet7/accept_ra
  88. echo 2 > /proc/sys/net/ipv6/conf/rmnet_sdio0/accept_ra
  89. echo 2 > /proc/sys/net/ipv6/conf/rmnet_sdio1/accept_ra
  90. echo 2 > /proc/sys/net/ipv6/conf/rmnet_sdio2/accept_ra
  91. echo 2 > /proc/sys/net/ipv6/conf/rmnet_sdio3/accept_ra
  92. echo 2 > /proc/sys/net/ipv6/conf/rmnet_sdio4/accept_ra
  93. echo 2 > /proc/sys/net/ipv6/conf/rmnet_sdio5/accept_ra
  94. echo 2 > /proc/sys/net/ipv6/conf/rmnet_sdio6/accept_ra
  95. echo 2 > /proc/sys/net/ipv6/conf/rmnet_sdio7/accept_ra
  96. echo 2 > /proc/sys/net/ipv6/conf/rmnet_usb0/accept_ra
  97. echo 2 > /proc/sys/net/ipv6/conf/rmnet_usb1/accept_ra
  98. echo 2 > /proc/sys/net/ipv6/conf/rmnet_usb2/accept_ra
  99. echo 2 > /proc/sys/net/ipv6/conf/rmnet_usb3/accept_ra
  100. # To prevent out of order acknowledgements from making
  101. # connection tracking to treat them as not belonging to
  102. # the connection they belong to.
  103. # Otherwise, a weird issue happens in which some long
  104. # connections on high-throughput links get dropped when
  105. # an ack packet comes out of order
  106. echo 1 > /proc/sys/net/netfilter/nf_conntrack_tcp_be_liberal
  107. #TODO:
  108. # basic network init
  109. # ifup lo
  110. # hostname localhost
  111. # domainname localdomain
  112. # set RLIMIT_NICE to allow priorities from 19 to -20
  113. # setrlimit 13 40 40
  114. # Memory management. Basic kernel parameters, and allow the high
  115. # level system server to be able to adjust the kernel OOM driver
  116. # parameters to match how it is managing things.
  117. echo 1 > /proc/sys/vm/overcommit_memory
  118. echo 4 > /proc/sys/vm/min_free_order_shift
  119. chown -h root.system /sys/module/lowmemorykiller/parameters/adj
  120. chmod -h 0664 /sys/module/lowmemorykiller/parameters/adj
  121. chown -h root.system /sys/module/lowmemorykiller/parameters/minfree
  122. chmod -h 0664 /sys/module/lowmemorykiller/parameters/minfree
  123. # Tweak background writeout
  124. echo 200 > /proc/sys/vm/dirty_expire_centisecs
  125. echo 5 > /proc/sys/vm/dirty_background_ratio
  126. # Permissions for System Server and daemons.
  127. chown -h radio.system /sys/android_power/state
  128. chown -h radio.system /sys/android_power/request_state
  129. chown -h radio.system /sys/android_power/acquire_full_wake_lock
  130. chown -h radio.system /sys/android_power/acquire_partial_wake_lock
  131. chown -h radio.system /sys/android_power/release_wake_lock
  132. chown -h system.system /sys/power/autosleep
  133. chown -h system.system /sys/power/state
  134. chown -h system.system /sys/power/wakeup_count
  135. chown -h radio.system /sys/power/wake_lock
  136. chown -h radio.system /sys/power/wake_unlock
  137. chmod -h 0660 /sys/power/state
  138. chmod -h 0660 /sys/power/wake_lock
  139. chmod -h 0660 /sys/power/wake_unlock
  140. chown -h system.system /sys/devices/system/cpu/cpufreq/interactive/timer_rate
  141. chmod -h 0660 /sys/devices/system/cpu/cpufreq/interactive/timer_rate
  142. chown -h system.system /sys/devices/system/cpu/cpufreq/interactive/min_sample_time
  143. chmod -h 0660 /sys/devices/system/cpu/cpufreq/interactive/min_sample_time
  144. chown -h system.system /sys/devices/system/cpu/cpufreq/interactive/hispeed_freq
  145. chmod -h 0660 /sys/devices/system/cpu/cpufreq/interactive/hispeed_freq
  146. chown -h system.system /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load
  147. chmod -h 0660 /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load
  148. chown -h system.system /sys/devices/system/cpu/cpufreq/interactive/above_hispeed_delay
  149. chmod -h 0660 /sys/devices/system/cpu/cpufreq/interactive/above_hispeed_delay
  150. chown -h system.system /sys/devices/system/cpu/cpufreq/interactive/boost
  151. chmod -h 0660 /sys/devices/system/cpu/cpufreq/interactive/boost
  152. chown -h system.system /sys/devices/system/cpu/cpufreq/interactive/boostpulse
  153. chown -h system.system /sys/devices/system/cpu/cpufreq/interactive/input_boost
  154. chmod -h 0660 /sys/devices/system/cpu/cpufreq/interactive/input_boost
  155. chown -h system.system /sys/devices/system/cpu/cpufreq/interactive/boostpulse_duration
  156. chmod -h 0660 /sys/devices/system/cpu/cpufreq/interactive/boostpulse_duration
  157. # Assume SMP uses shared cpufreq policy for all CPUs
  158. chown -h system.system /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
  159. chmod -h 0660 /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
  160. chown -h system.system /sys/class/timed_output/vibrator/enable
  161. chown -h system.system /sys/class/leds/keyboard-backlight/brightness
  162. chown -h system.system /sys/class/leds/lcd-backlight/brightness
  163. chown -h system.system /sys/class/leds/button-backlight/brightness
  164. chown -h system.system /sys/class/leds/jogball-backlight/brightness
  165. chown -h system.system /sys/class/leds/red/brightness
  166. chown -h system.system /sys/class/leds/green/brightness
  167. chown -h system.system /sys/class/leds/blue/brightness
  168. chown -h system.system /sys/class/leds/red/device/grpfreq
  169. chown -h system.system /sys/class/leds/red/device/grppwm
  170. chown -h system.system /sys/class/leds/red/device/blink
  171. chown -h system.system /sys/class/leds/red/brightness
  172. chown -h system.system /sys/class/leds/green/brightness
  173. chown -h system.system /sys/class/leds/blue/brightness
  174. chown -h system.system /sys/class/leds/red/device/grpfreq
  175. chown -h system.system /sys/class/leds/red/device/grppwm
  176. chown -h system.system /sys/class/leds/red/device/blink
  177. chown -h system.system /sys/class/timed_output/vibrator/enable
  178. chown -h system.system /sys/module/sco/parameters/disable_esco
  179. chown -h system.system /sys/kernel/ipv4/tcp_wmem_min
  180. chown -h system.system /sys/kernel/ipv4/tcp_wmem_def
  181. chown -h system.system /sys/kernel/ipv4/tcp_wmem_max
  182. chown -h system.system /sys/kernel/ipv4/tcp_rmem_min
  183. chown -h system.system /sys/kernel/ipv4/tcp_rmem_def
  184. chown -h system.system /sys/kernel/ipv4/tcp_rmem_max
  185. chown -h root radio /proc/cmdline
  186. # Define TCP buffer sizes for various networks
  187. # ReadMin, ReadInitial, ReadMax, WriteMin, WriteInitial, WriteMax,
  188. setprop net.tcp.buffersize.default 4096,87380,110208,4096,16384,110208
  189. setprop net.tcp.buffersize.wifi 524288,1048576,2097152,262144,524288,1048576
  190. setprop net.tcp.buffersize.lte 524288,1048576,2097152,262144,524288,1048576
  191. setprop net.tcp.buffersize.umts 4094,87380,110208,4096,16384,110208
  192. setprop net.tcp.buffersize.hspa 4094,87380,1220608,4096,16384,1220608
  193. setprop net.tcp.buffersize.hsupa 4094,87380,1220608,4096,16384,1220608
  194. setprop net.tcp.buffersize.hsdpa 4094,87380,1220608,4096,16384,1220608
  195. setprop net.tcp.buffersize.hspap 4094,87380,1220608,4096,16384,1220608
  196. setprop net.tcp.buffersize.edge 4093,26280,35040,4096,16384,35040
  197. setprop net.tcp.buffersize.gprs 4092,8760,11680,4096,8760,11680
  198. setprop net.tcp.buffersize.evdo 4094,87380,262144,4096,16384,262144
  199. # Assign TCP buffer thresholds to be ceiling value of technology maximums
  200. # Increased technology maximums should be reflected here.
  201. echo 2097152 > /proc/sys/net/core/rmem_max
  202. echo 2097152 > /proc/sys/net/core/wmem_max
  203. # Set the property to indicate type of virtual display to 0
  204. # 0 indicates that virtual display is not a Wifi display and that the
  205. # session is not exercised through RemoteDisplay in the android framework
  206. setprop persist.sys.wfd.virtual 0
  207. # Set this property so surfaceflinger is not started by system_init
  208. setprop system_init.startsurfaceflinger 0
  209. # Start the following services needed for fftm
  210. start config_bluetooth
  211. start media
  212. start fastmmi
  213. start adbd
  214. start qcom-post-boot
  215. start rmt_storage
  216. start qcom-c_main-sh
  217. start irsc_util
  218. start qcamerasvr
  219. start qcom-usb-sh
  220. start qcomsysd