Advertisement
Guest User

init.qcom.early_boot.sh

a guest
Oct 29th, 2014
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 6.85 KB | None | 0 0
  1. #!/system/bin/sh
  2. # Copyright (c) 2012-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. export PATH=/system/bin
  30.  
  31. # Set platform variables
  32. if [ -f /sys/devices/soc0/hw_platform ]; then
  33.     soc_hwplatform=`cat /sys/devices/soc0/hw_platform` 2> /dev/null
  34. else
  35.     soc_hwplatform=`cat /sys/devices/system/soc/soc0/hw_platform` 2> /dev/null
  36. fi
  37. if [ -f /sys/devices/soc0/soc_id ]; then
  38.     soc_hwid=`cat /sys/devices/soc0/soc_id` 2> /dev/null
  39. else
  40.     soc_hwid=`cat /sys/devices/system/soc/soc0/id` 2> /dev/null
  41. fi
  42. if [ -f /sys/devices/soc0/platform_version ]; then
  43.     soc_hwver=`cat /sys/devices/soc0/platform_version` 2> /dev/null
  44. else
  45.     soc_hwver=`cat /sys/devices/system/soc/soc0/platform_version` 2> /dev/null
  46. fi
  47.  
  48. log -t BOOT -p i "MSM target '$1', SoC '$soc_hwplatform', HwID '$soc_hwid', SoC ver '$soc_hwver'"
  49.  
  50. case "$1" in
  51.     "msm7630_surf" | "msm7630_1x" | "msm7630_fusion")
  52.         case "$soc_hwplatform" in
  53.             "FFA" | "SVLTE_FFA")
  54.                 # linking to surf_keypad_qwerty.kcm.bin instead of surf_keypad_numeric.kcm.bin so that
  55.                 # the UI keyboard works fine.
  56.                 ln -s  /system/usr/keychars/surf_keypad_qwerty.kcm.bin /system/usr/keychars/surf_keypad.kcm.bin
  57.                 ;;
  58.             "Fluid")
  59.                 setprop ro.sf.lcd_density 240
  60.                 setprop qcom.bt.dev_power_class 2
  61.                 ;;
  62.             *)
  63.                 ln -s  /system/usr/keychars/surf_keypad_qwerty.kcm.bin /system/usr/keychars/surf_keypad.kcm.bin
  64.                 ;;
  65.         esac
  66.         ;;
  67.  
  68.     "msm8660")
  69.         case "$soc_hwplatform" in
  70.             "Fluid")
  71.                 setprop ro.sf.lcd_density 240
  72.                 ;;
  73.             "Dragon")
  74.                 setprop ro.sound.alsa "WM8903"
  75.                 ;;
  76.         esac
  77.         ;;
  78.  
  79.     "msm8960")
  80.         # lcd density is write-once. Hence the separate switch case
  81.         case "$soc_hwplatform" in
  82.             "Liquid")
  83.                 if [ "$soc_hwver" == "196608" ]; then # version 0x30000 is 3D sku
  84.                     setprop ro.sf.hwrotation 90
  85.                 fi
  86.  
  87.                 setprop ro.sf.lcd_density 160
  88.                 ;;
  89.             "MTP")
  90.                 setprop ro.sf.lcd_density 240
  91.                 ;;
  92.             *)
  93.                 case "$soc_hwid" in
  94.                     "142") #8x30 QRD
  95.                         setprop ro.sf.lcd_density 320
  96.                         ;;
  97.                     "109")
  98.                         setprop ro.sf.lcd_density 160
  99.                         ;;
  100.                     *)
  101.                         setprop ro.sf.lcd_density 240
  102.                         ;;
  103.                 esac
  104.             ;;
  105.         esac
  106.  
  107.         #Set up MSM-specific configuration
  108.         case "$soc_hwid" in
  109.             87)
  110.                 #8960
  111.                 setprop debug.composition.type dyn
  112.                 ;;
  113.             153 | 154 | 155 | 156 | 157 | 138 | 179 | 180 | 181)
  114.                 #8064 V2 PRIME | 8930AB | 8630AB | 8230AB | 8030AB | 8960AB | 8130/AA/AB
  115.                 setprop debug.composition.type c2d
  116.                 ;;
  117.             *)
  118.                 ;;
  119.         esac
  120.  
  121.         case "$soc_hwid" in
  122.             87 | 116 | 117 | 118 | 119 | 138 | 142 | 143 | 144 | 154 | 155 | 156 | 157 | 179 | 180 | 181)
  123.                 #Disable subsystem restart for 8x30 and 8960
  124.                 setprop persist.sys.ssr.restart_level 1
  125.                 ;;
  126.             *)
  127.                 ;;
  128.         esac
  129.         ;;
  130.  
  131.     "msm8974")
  132.         case "$soc_hwplatform" in
  133.             "Liquid")
  134.                 setprop ro.sf.lcd_density 160
  135.                 # Liquid do not have hardware navigation keys, so enable
  136.                 # Android sw navigation bar
  137.                 setprop ro.hw.nav_keys 0
  138.                 ;;
  139.             "Dragon")
  140.                 setprop ro.sf.lcd_density 240
  141.                 ;;
  142.             *)
  143.                 setprop ro.sf.lcd_density 320
  144.                 ;;
  145.         esac
  146.         ;;
  147.  
  148.     "msm8226")
  149.         case "$soc_hwplatform" in
  150.             *)
  151.                 setprop ro.sf.lcd_density 320
  152.                 ;;
  153.         esac
  154.         ;;
  155.  
  156.     "msm8610" | "apq8084")
  157.         case "$soc_hwplatform" in
  158.             *)
  159.                 setprop ro.sf.lcd_density 240
  160.                 ;;
  161.         esac
  162.         ;;
  163. esac
  164.  
  165. # Setup HDMI related nodes & permissions
  166. # HDMI can be fb1 or fb2
  167. # Loop through the sysfs nodes and determine
  168. # the HDMI(dtv panel)
  169. fb_cnt=0
  170. for file in /sys/class/graphics/fb*
  171. do
  172.     value=`cat $file/msm_fb_type`
  173.     case "$value" in
  174.             "dtv panel")
  175.         chown -h system.graphics $file/hpd
  176.         chown -h system.graphics $file/vendor_name
  177.         chown -h system.graphics $file/product_description
  178.         chmod -h 0664 $file/hpd
  179.         chmod -h 0664 $file/vendor_name
  180.         chmod -h 0664 $file/product_description
  181.         chmod -h 0664 $file/video_mode
  182.         chmod -h 0664 $file/format_3d
  183.         # create symbolic link
  184.         ln -s "/dev/graphics/fb"$fb_cnt /dev/graphics/hdmi
  185.         # Change owner and group for media server and surface flinger
  186.         chown -h system.system $file/format_3d;;
  187.     esac
  188.     fb_cnt=$(( $fb_cnt + 1))
  189. done
  190.  
  191. # Set date to a time after 2008
  192. # This is a workaround for Zygote to preload time related classes properly
  193. # Disabled since we are using RTC now
  194. #date -s 20090102.130000
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement