start_apx() { #if backup_image is booted, rename them so that the broken image partition will be flashed next time (grep OLD_IMAGE_BOOTED /proc/cmdline) && { ubirename /dev/ubi0 image image_backup image_backup image || \ ubirename /dev/ubi0 image_backup image } #create backup ubivolume (ubinfo /dev/ubi0 -N image_backup) || { ubimkvol /dev/ubi0 -s 64MiB -N image_backup cat $(get_ubi_dev_by_name image) > /tmp/uimage ubiupdatevol $(get_ubi_dev_by_name image_backup) /tmp/uimage rm -rf /tmp/uimage } # Collect APX crashlog dump if last boot created panic or oops case "$DEVICE_TYPE" in APX320) CRASHLOG_FLASH_PARTITION=/dev/mtd10 ;; APX530) CRASHLOG_FLASH_PARTITION=/dev/mtd12 ;; APX740) CRASHLOG_FLASH_PARTITION=/dev/mtd12 ;; esac CRASHLOG_OFFSET=2438 CRASHLOGFILE=/tmp/crashlog-bt crash_detect_string=`hexdump -s $CRASHLOG_OFFSET -n 2 $CRASHLOG_FLASH_PARTITION | awk '{print $2;}'` if [ "$crash_detect_string" = "dead" ] then dd if=$CRASHLOG_FLASH_PARTITION bs=128 skip=19 count=5 > $CRASHLOGFILE sed '/end trace/q' $CRASHLOGFILE > /tmp/crashlog-bt1 mv /tmp/crashlog-bt1 $CRASHLOGFILE mtd erase $CRASHLOG_FLASH_PARTITION fi write_mac_to_art "$ETHMAC" 0 0 # eth0 write_mac_to_art "$ETHMAC" 1 1 # eth1 write_mac_to_art "$ETHMAC" 2 2 # BLE [ ! -d /config ] && mount_config [ -d /config/preinit.d ] && { for script in /config/preinit.d/*; do $script $1 done } oscar_A_bdf_path=/lib/firmware/IPQ4019/hw.1 oscar_B_bdf_path=/lib/firmware/QCA9984/hw.1 oscar_C_bdf_path=/lib/firmware/AR900B/hw.2 tmp_regdmn=$(cat /tmp/regdomain.txt); if [ "$tmp_regdmn" = "ROW" ] then if [ -f /config/cc.txt ] then tmp_country=$(cat /config/cc.txt); countrymd5=$(md5sum /config/cc.txt); cfgmd5=$(cat /config/ccmd5.txt); fi if [ "$countrymd5" == "$cfgmd5" ] then oscar_A_regdmn_bdf_path=$oscar_A_bdf_path/$tmp_regdmn/$tmp_country oscar_B_regdmn_bdf_path=$oscar_B_bdf_path/$tmp_regdmn/$tmp_country oscar_C_regdmn_bdf_path=$oscar_C_bdf_path/$tmp_regdmn/$tmp_country else oscar_A_regdmn_bdf_path=$oscar_A_bdf_path/ETSI oscar_B_regdmn_bdf_path=$oscar_B_bdf_path/ETSI oscar_C_regdmn_bdf_path=$oscar_C_bdf_path/ETSI fi else #For FCC and ETSI oscar_A_regdmn_bdf_path=$oscar_A_bdf_path/$tmp_regdmn oscar_B_regdmn_bdf_path=$oscar_B_bdf_path/$tmp_regdmn oscar_C_regdmn_bdf_path=$oscar_C_bdf_path/$tmp_regdmn fi #copy correct board data files #Oscar A bdf files cp $oscar_A_regdmn_bdf_path/boardData_1_0_IPQ4019_DK07_wifi0_2G.bin \ $oscar_A_bdf_path/boardData_1_0_IPQ4019_DK07_wifi0_2G.bin cp $oscar_A_regdmn_bdf_path/boardData_1_0_IPQ4019_DK07_wifi0_5G_HB.bin \ $oscar_A_bdf_path/boardData_1_0_IPQ4019_DK07_wifi0_5G_HB.bin cp $oscar_A_regdmn_bdf_path/boardData_1_0_IPQ4019_DK07_wifi1_5G_LB.bin \ $oscar_A_bdf_path/boardData_1_0_IPQ4019_DK07_wifi1_5G_LB.bin cp $oscar_A_regdmn_bdf_path/boardData_1_0_IPQ4019_DK07_wifi1_5G_LB.bin \ $oscar_A_bdf_path/boarddata_1.bin cp $oscar_A_regdmn_bdf_path/boardData_1_0_IPQ4019_DK07_wifi0_2G.bin \ $oscar_A_bdf_path/boarddata_0.bin #Oscar B bdf files cp $oscar_B_regdmn_bdf_path/boardData_QCA9984_CUS240_2G_v1_004.bin \ $oscar_B_bdf_path/boardData_QCA9984_CUS240_2G_v1_004.bin cp $oscar_B_regdmn_bdf_path/boardData_QCA9984_CUS238_5G_v1_003.bin \ $oscar_B_bdf_path/boardData_QCA9984_CUS238_5G_v1_003.bin cp $oscar_B_regdmn_bdf_path/boardData_QCA9984_CUS240_2G_v1_004.bin \ $oscar_B_bdf_path/boarddata_0.bin cp $oscar_B_regdmn_bdf_path/boardData_QCA9984_CUS238_5G_v1_003.bin \ $oscar_B_bdf_path/boarddata_1.bin #Oscar C bdf files cp $oscar_C_regdmn_bdf_path/* $oscar_C_bdf_path/ [ ! -d /download ] && mount_download case "$DEVICE_TYPE" in APX320) echo 41 > /etc/reset_button_gpio ;; APX530) echo 29 > /etc/reset_button_gpio ;; APX740) echo 29 > /etc/reset_button_gpio ;; esac cat /etc/reset_button_gpio > /sys/class/gpio/export poll_reset_button & /etc/init.d/extract_caldata start eval `fw_printenv | grep ^radio0_select_5g` [ $radio0_select_5g -eq 1 ] && band=5G || band=2G change_band.sh $band }