Просмотр исходного кода

bcm53xx: extend firmware validation

This provides TRX validation result to the validation JSON. It also
prevents users from installing broken firmware files.

Signed-off-by: Rafał Miłecki <[email protected]>
Rafał Miłecki 6 лет назад
Родитель
Сommit
c19b9f9a26
1 измененных файлов с 11 добавлено и 1 удалено
  1. 11 1
      target/linux/bcm53xx/base-files/lib/upgrade/platform.sh

+ 11 - 1
target/linux/bcm53xx/base-files/lib/upgrade/platform.sh

@@ -88,7 +88,10 @@ platform_check_image() {
 
 
 			if ! otrx check "$1" -o "$header_len"; then
 			if ! otrx check "$1" -o "$header_len"; then
 				echo "No valid TRX firmware in the CHK image"
 				echo "No valid TRX firmware in the CHK image"
+				notify_firmware_test_result "trx_valid" 0
 				error=1
 				error=1
+			else
+				notify_firmware_test_result "trx_valid" 1
 			fi
 			fi
 		;;
 		;;
 		"cybertan")
 		"cybertan")
@@ -103,7 +106,10 @@ platform_check_image() {
 
 
 			if ! otrx check "$1" -o 32; then
 			if ! otrx check "$1" -o 32; then
 				echo "No valid TRX firmware in the CyberTAN image"
 				echo "No valid TRX firmware in the CyberTAN image"
+				notify_firmware_test_result "trx_valid" 0
 				error=1
 				error=1
+			else
+				notify_firmware_test_result "trx_valid" 1
 			fi
 			fi
 		;;
 		;;
 		"safeloader")
 		"safeloader")
@@ -133,11 +139,15 @@ platform_check_image() {
 
 
 			if ! otrx check "$1"; then
 			if ! otrx check "$1"; then
 				echo "Invalid (corrupted?) TRX firmware"
 				echo "Invalid (corrupted?) TRX firmware"
+				notify_firmware_test_result "trx_valid" 0
 				error=1
 				error=1
+			else
+				notify_firmware_test_result "trx_valid" 1
 			fi
 			fi
 		;;
 		;;
 		*)
 		*)
-			echo "Invalid image type. Please use only .trx files"
+			echo "Invalid image type. Please use firmware specific for this device."
+			notify_firmware_broken
 			error=1
 			error=1
 		;;
 		;;
 	esac
 	esac