aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/brcm47xx/base-files
diff options
context:
space:
mode:
authorRafał Miłecki <rafal@milecki.pl>2019-09-04 06:35:31 +0200
committerRafał Miłecki <rafal@milecki.pl>2019-09-12 14:30:18 +0200
commit87fe1a560ac3ad86e8315eab0efd1c90e879cf8e (patch)
treeed20838695753af3c572def0431591b5676ca3b4 /target/linux/brcm47xx/base-files
parenta717428828558577760abfcf83a54e3d7459ee0b (diff)
downloadupstream-87fe1a560ac3ad86e8315eab0efd1c90e879cf8e.tar.gz
upstream-87fe1a560ac3ad86e8315eab0efd1c90e879cf8e.tar.bz2
upstream-87fe1a560ac3ad86e8315eab0efd1c90e879cf8e.zip
brcm47xx: extend firmware validation
This provides TRX validation result, so final JSON may look like: { "tests": { "fwtool_signature": true, "fwtool_device_match": true, "trx_valid": true }, "valid": true, "forceable": true } It also prevents users from installing broken firmware files, e.g.: root@OpenWrt:/# sysupgrade -F -n /tmp/TZ Image metadata not found Invalid image type. Please use firmware specific for this device. Image check failed but --force given - will update anyway! Commencing upgrade. Closing all shell sessions. Firmware image is broken and cannot be installed Signed-off-by: Rafał Miłecki <rafal@milecki.pl> (cherry picked from commit e68c1cebd1d87ce60f0646688e437e83081e2322)
Diffstat (limited to 'target/linux/brcm47xx/base-files')
-rw-r--r--target/linux/brcm47xx/base-files/lib/upgrade/platform.sh12
1 files changed, 11 insertions, 1 deletions
diff --git a/target/linux/brcm47xx/base-files/lib/upgrade/platform.sh b/target/linux/brcm47xx/base-files/lib/upgrade/platform.sh
index dfd4e97ed2..537bac2328 100644
--- a/target/linux/brcm47xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/brcm47xx/base-files/lib/upgrade/platform.sh
@@ -98,7 +98,10 @@ platform_check_image() {
if ! otrx check "$1" -o "$header_len"; then
echo "No valid TRX firmware in the CHK image"
+ notify_firmware_test_result "trx_valid" 0
error=1
+ else
+ notify_firmware_test_result "trx_valid" 1
fi
;;
"cybertan")
@@ -113,17 +116,24 @@ platform_check_image() {
if ! otrx check "$1" -o 32; then
echo "No valid TRX firmware in the CyberTAN image"
+ notify_firmware_test_result "trx_valid" 0
error=1
+ else
+ notify_firmware_test_result "trx_valid" 1
fi
;;
"trx")
if ! otrx check "$1"; then
echo "Invalid (corrupted?) TRX firmware"
+ notify_firmware_test_result "trx_valid" 0
error=1
+ else
+ notify_firmware_test_result "trx_valid" 1
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
;;
esac