mirror of
https://github.com/openwrt/openwrt.git
synced 2025-02-22 10:01:03 +00:00
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> SVN-Revision: 45320
This commit is contained in:
parent
c6f9582116
commit
2198db252c
@ -23,7 +23,7 @@ endef
|
|||||||
|
|
||||||
KERNELNAME:=zImage dtbs
|
KERNELNAME:=zImage dtbs
|
||||||
|
|
||||||
DEFAULT_PACKAGES += swconfig wpad-mini nvram \
|
DEFAULT_PACKAGES += swconfig wpad-mini nvram otrx \
|
||||||
kmod-gpio-button-hotplug \
|
kmod-gpio-button-hotplug \
|
||||||
kmod-leds-gpio kmod-ledtrig-default-on kmod-ledtrig-timer
|
kmod-leds-gpio kmod-ledtrig-default-on kmod-ledtrig-timer
|
||||||
|
|
||||||
|
@ -54,20 +54,6 @@ platform_identify() {
|
|||||||
echo "unknown"
|
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() {
|
platform_check_image() {
|
||||||
[ "$#" -gt 1 ] && return 1
|
[ "$#" -gt 1 ] && return 1
|
||||||
|
|
||||||
@ -93,7 +79,7 @@ platform_check_image() {
|
|||||||
error=1
|
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"
|
echo "No valid TRX firmware in the CHK image"
|
||||||
error=1
|
error=1
|
||||||
fi
|
fi
|
||||||
@ -108,12 +94,16 @@ platform_check_image() {
|
|||||||
error=1
|
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"
|
echo "No valid TRX firmware in the CyberTAN image"
|
||||||
error=1
|
error=1
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
"trx")
|
"trx")
|
||||||
|
if ! otrx -c "$1"; then
|
||||||
|
echo "Invalid (corrupted?) TRX firmware"
|
||||||
|
error=1
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Invalid image type. Please use only .trx files"
|
echo "Invalid image type. Please use only .trx files"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user