0a09da51a4313e09cc7632aa16f6af671f79bcc4
3 # $(1): file to read magic from
4 # $(2): offset in bytes
6 dd if="$1" skip
=$2 bs
=1 count
=4 2>/dev
/null |
hexdump -v -n 4 -e '1/1 "%02x"'
12 magic
=$
(get_magic_long
"$1")
24 magic
=$
(get_magic_long_at
"$1" 14)
25 [ "$magic" = "55324e44" ] && {
33 platform_check_image
() {
34 [ "$#" -gt 1 ] && return 1
36 local file_type
=$
(brcm47xx_identify
"$1")
41 local header_len
=$
((0x$
(get_magic_long_at
"$1" 4)))
42 local board_id_len
=$
(($header_len - 40))
43 local board_id
=$
(dd if="$1" skip
=40 bs
=1 count
=$board_id_len 2>/dev
/null |
hexdump -v -e '1/1 "%c"')
44 echo "Found CHK image with device board_id $board_id"
46 magic
=$
(get_magic_long_at
"$1" "$header_len")
47 [ "$magic" != "48445230" ] && {
48 echo "No valid TRX firmware in the CHK image"
52 echo "Flashing CHK images in unsupported. Please use only .trx files."
56 magic
=$
(dd if="$1" bs
=1 count
=4 2>/dev
/null |
hexdump -v -e '1/1 "%c"')
57 echo "Found CyberTAN image with device magic: $magic"
59 magic
=$
(get_magic_long_at
"$1" 32)
60 [ "$magic" != "48445230" ] && {
61 echo "No valid TRX firmware in the CyberTAN image"
65 echo "Flashing CyberTAN images in unsupported. Please use only .trx files."
72 echo "Invalid image type. Please use only .trx files"
78 # use default for platform_do_upgrade()