Snippet content copied to clipboard.
Are you sure to delete this snippet? No, don't delete
  1. start_apx()
  2. {
  3. #if backup_image is booted, rename them so that the broken image partition will be flashed next time
  4. (grep OLD_IMAGE_BOOTED /proc/cmdline) && {
  5. ubirename /dev/ubi0 image image_backup image_backup image || \
  6. ubirename /dev/ubi0 image_backup image
  7. }
  8. #create backup ubivolume
  9. (ubinfo /dev/ubi0 -N image_backup) || {
  10. ubimkvol /dev/ubi0 -s 64MiB -N image_backup
  11. cat $(get_ubi_dev_by_name image) > /tmp/uimage
  12. ubiupdatevol $(get_ubi_dev_by_name image_backup) /tmp/uimage
  13. rm -rf /tmp/uimage
  14. }
  15. # Collect APX crashlog dump if last boot created panic or oops
  16. case "$DEVICE_TYPE" in
  17. APX320)
  18. CRASHLOG_FLASH_PARTITION=/dev/mtd10
  19. ;;
  20. APX530)
  21. CRASHLOG_FLASH_PARTITION=/dev/mtd12
  22. ;;
  23. APX740)
  24. CRASHLOG_FLASH_PARTITION=/dev/mtd12
  25. ;;
  26. esac
  27. CRASHLOG_OFFSET=2438
  28. CRASHLOGFILE=/tmp/crashlog-bt
  29. crash_detect_string=`hexdump -s $CRASHLOG_OFFSET -n 2 $CRASHLOG_FLASH_PARTITION | awk '{print $2;}'`
  30. if [ "$crash_detect_string" = "dead" ]
  31. then
  32. dd if=$CRASHLOG_FLASH_PARTITION bs=128 skip=19 count=5 > $CRASHLOGFILE
  33. sed '/end trace/q' $CRASHLOGFILE > /tmp/crashlog-bt1
  34. mv /tmp/crashlog-bt1 $CRASHLOGFILE
  35. mtd erase $CRASHLOG_FLASH_PARTITION
  36. fi
  37. write_mac_to_art "$ETHMAC" 0 0 # eth0
  38. write_mac_to_art "$ETHMAC" 1 1 # eth1
  39. write_mac_to_art "$ETHMAC" 2 2 # BLE
  40. [ ! -d /config ] && mount_config
  41. [ -d /config/preinit.d ] && {
  42. for script in /config/preinit.d/*; do
  43. $script $1
  44. done
  45. }
  46. oscar_A_bdf_path=/lib/firmware/IPQ4019/hw.1
  47. oscar_B_bdf_path=/lib/firmware/QCA9984/hw.1
  48. oscar_C_bdf_path=/lib/firmware/AR900B/hw.2
  49. tmp_regdmn=$(cat /tmp/regdomain.txt);
  50. if [ "$tmp_regdmn" = "ROW" ]
  51. then
  52. if [ -f /config/cc.txt ]
  53. then
  54. tmp_country=$(cat /config/cc.txt);
  55. countrymd5=$(md5sum /config/cc.txt);
  56. cfgmd5=$(cat /config/ccmd5.txt);
  57. fi
  58. if [ "$countrymd5" == "$cfgmd5" ]
  59. then
  60. oscar_A_regdmn_bdf_path=$oscar_A_bdf_path/$tmp_regdmn/$tmp_country
  61. oscar_B_regdmn_bdf_path=$oscar_B_bdf_path/$tmp_regdmn/$tmp_country
  62. oscar_C_regdmn_bdf_path=$oscar_C_bdf_path/$tmp_regdmn/$tmp_country
  63. else
  64. oscar_A_regdmn_bdf_path=$oscar_A_bdf_path/ETSI
  65. oscar_B_regdmn_bdf_path=$oscar_B_bdf_path/ETSI
  66. oscar_C_regdmn_bdf_path=$oscar_C_bdf_path/ETSI
  67. fi
  68. else #For FCC and ETSI
  69. oscar_A_regdmn_bdf_path=$oscar_A_bdf_path/$tmp_regdmn
  70. oscar_B_regdmn_bdf_path=$oscar_B_bdf_path/$tmp_regdmn
  71. oscar_C_regdmn_bdf_path=$oscar_C_bdf_path/$tmp_regdmn
  72. fi
  73. #copy correct board data files
  74. #Oscar A bdf files
  75. cp $oscar_A_regdmn_bdf_path/boardData_1_0_IPQ4019_DK07_wifi0_2G.bin \
  76. $oscar_A_bdf_path/boardData_1_0_IPQ4019_DK07_wifi0_2G.bin
  77. cp $oscar_A_regdmn_bdf_path/boardData_1_0_IPQ4019_DK07_wifi0_5G_HB.bin \
  78. $oscar_A_bdf_path/boardData_1_0_IPQ4019_DK07_wifi0_5G_HB.bin
  79. cp $oscar_A_regdmn_bdf_path/boardData_1_0_IPQ4019_DK07_wifi1_5G_LB.bin \
  80. $oscar_A_bdf_path/boardData_1_0_IPQ4019_DK07_wifi1_5G_LB.bin
  81. cp $oscar_A_regdmn_bdf_path/boardData_1_0_IPQ4019_DK07_wifi1_5G_LB.bin \
  82. $oscar_A_bdf_path/boarddata_1.bin
  83. cp $oscar_A_regdmn_bdf_path/boardData_1_0_IPQ4019_DK07_wifi0_2G.bin \
  84. $oscar_A_bdf_path/boarddata_0.bin
  85. #Oscar B bdf files
  86. cp $oscar_B_regdmn_bdf_path/boardData_QCA9984_CUS240_2G_v1_004.bin \
  87. $oscar_B_bdf_path/boardData_QCA9984_CUS240_2G_v1_004.bin
  88. cp $oscar_B_regdmn_bdf_path/boardData_QCA9984_CUS238_5G_v1_003.bin \
  89. $oscar_B_bdf_path/boardData_QCA9984_CUS238_5G_v1_003.bin
  90. cp $oscar_B_regdmn_bdf_path/boardData_QCA9984_CUS240_2G_v1_004.bin \
  91. $oscar_B_bdf_path/boarddata_0.bin
  92. cp $oscar_B_regdmn_bdf_path/boardData_QCA9984_CUS238_5G_v1_003.bin \
  93. $oscar_B_bdf_path/boarddata_1.bin
  94. #Oscar C bdf files
  95. cp $oscar_C_regdmn_bdf_path/* $oscar_C_bdf_path/
  96. [ ! -d /download ] && mount_download
  97. case "$DEVICE_TYPE" in
  98. APX320)
  99. echo 41 > /etc/reset_button_gpio
  100. ;;
  101. APX530)
  102. echo 29 > /etc/reset_button_gpio
  103. ;;
  104. APX740)
  105. echo 29 > /etc/reset_button_gpio
  106. ;;
  107. esac
  108. cat /etc/reset_button_gpio > /sys/class/gpio/export
  109. poll_reset_button &
  110. /etc/init.d/extract_caldata start
  111. eval `fw_printenv | grep ^radio0_select_5g`
  112. [ $radio0_select_5g -eq 1 ] && band=5G || band=2G
  113. change_band.sh $band
  114. }

Edit this Snippet