brcm47xx: extend firmware validation
authorRafał Miłecki <rafal@milecki.pl>
Wed, 4 Sep 2019 04:35:31 +0000 (06:35 +0200)
committerRafał Miłecki <rafal@milecki.pl>
Thu, 12 Sep 2019 12:30:18 +0000 (14:30 +0200)
commit87fe1a560ac3ad86e8315eab0efd1c90e879cf8e
treeed20838695753af3c572def0431591b5676ca3b4
parenta717428828558577760abfcf83a54e3d7459ee0b
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)
target/linux/brcm47xx/base-files/lib/upgrade/platform.sh