diff options
author | Rafał Miłecki <zajec5@gmail.com> | 2015-04-09 06:33:56 +0000 |
---|---|---|
committer | Rafał Miłecki <zajec5@gmail.com> | 2015-04-09 06:33:56 +0000 |
commit | 10dd1867866b21ba97851fc5e1814e48b4f3557b (patch) | |
tree | c4c455bc1411991376658006e608d6020e37cc3e /target/linux | |
parent | 8c2b260db8550b35da15f75534b18fc6621a5417 (diff) | |
download | upstream-10dd1867866b21ba97851fc5e1814e48b4f3557b.tar.gz upstream-10dd1867866b21ba97851fc5e1814e48b4f3557b.tar.bz2 upstream-10dd1867866b21ba97851fc5e1814e48b4f3557b.zip |
bcm53xx: switch to the otrx for verifying TRX images
This adds checking CRC32 of provided firmware image.
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@45320 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux')
-rw-r--r-- | target/linux/bcm53xx/Makefile | 2 | ||||
-rw-r--r-- | target/linux/bcm53xx/base-files/lib/upgrade/platform.sh | 22 |
2 files changed, 7 insertions, 17 deletions
diff --git a/target/linux/bcm53xx/Makefile b/target/linux/bcm53xx/Makefile index 5b5e6077ac..8b7f71bbd1 100644 --- a/target/linux/bcm53xx/Makefile +++ b/target/linux/bcm53xx/Makefile @@ -23,7 +23,7 @@ endef KERNELNAME:=zImage dtbs -DEFAULT_PACKAGES += swconfig wpad-mini nvram \ +DEFAULT_PACKAGES += swconfig wpad-mini nvram otrx \ kmod-gpio-button-hotplug \ kmod-leds-gpio kmod-ledtrig-default-on kmod-ledtrig-timer diff --git a/target/linux/bcm53xx/base-files/lib/upgrade/platform.sh b/target/linux/bcm53xx/base-files/lib/upgrade/platform.sh index e174cc7beb..ed84386a68 100644 --- a/target/linux/bcm53xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/bcm53xx/base-files/lib/upgrade/platform.sh @@ -54,20 +54,6 @@ platform_identify() { echo "unknown" } -# $(1): image that should contain trx -# $(2): trx offset in image -platform_check_image_trx() { - local magic=$(get_magic_long_at "$1" $2) - - [ "$magic" != "48445230" ] && { - return 1 - } - - # TODO: Check crc32 - - return 0 -} - platform_check_image() { [ "$#" -gt 1 ] && return 1 @@ -93,7 +79,7 @@ platform_check_image() { error=1 } - if ! platform_check_image_trx "$1" "$header_len"; then + if ! otrx -c "$1" -o "$header_len"; then echo "No valid TRX firmware in the CHK image" error=1 fi @@ -108,12 +94,16 @@ platform_check_image() { error=1 } - if ! platform_check_image_trx "$1" 32; then + if ! otrx -c "$1" -o 32; then echo "No valid TRX firmware in the CyberTAN image" error=1 fi ;; "trx") + if ! otrx -c "$1"; then + echo "Invalid (corrupted?) TRX firmware" + error=1 + fi ;; *) echo "Invalid image type. Please use only .trx files" |