aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/brcm47xx/base-files/lib/upgrade
diff options
context:
space:
mode:
authorRafał Miłecki <zajec5@gmail.com>2014-12-15 09:59:44 +0000
committerRafał Miłecki <zajec5@gmail.com>2014-12-15 09:59:44 +0000
commita5b6b7e41943fec0eb28593ce92b0713990c8d23 (patch)
tree84d69f02cd15437fcb683d63ff79a9ce7994af22 /target/linux/brcm47xx/base-files/lib/upgrade
parentf310e02ab36d1ac083c5c5daa5a0efe8a07fbf53 (diff)
downloadupstream-a5b6b7e41943fec0eb28593ce92b0713990c8d23.tar.gz
upstream-a5b6b7e41943fec0eb28593ce92b0713990c8d23.tar.bz2
upstream-a5b6b7e41943fec0eb28593ce92b0713990c8d23.zip
brcm47xx: detect (and still reject for now) CyberTAN fw format
Signed-off-by: Rafał Miłecki <zajec5@gmail.com> SVN-Revision: 43714
Diffstat (limited to 'target/linux/brcm47xx/base-files/lib/upgrade')
-rw-r--r--target/linux/brcm47xx/base-files/lib/upgrade/platform.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/target/linux/brcm47xx/base-files/lib/upgrade/platform.sh b/target/linux/brcm47xx/base-files/lib/upgrade/platform.sh
index d216ca4d04..412d6daaff 100644
--- a/target/linux/brcm47xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/brcm47xx/base-files/lib/upgrade/platform.sh
@@ -1,5 +1,11 @@
PART_NAME=firmware
+# $(1): file to read magic from
+# $(2): offset in bytes
+get_magic_long_at() {
+ dd if="$1" skip=$2 bs=1 count=4 2>/dev/null | hexdump -v -n 4 -e '1/1 "%02x"'
+}
+
brcm47xx_identify() {
local magic
@@ -15,6 +21,12 @@ brcm47xx_identify() {
;;
esac
+ magic=$(get_magic_long_at "$1" 14)
+ [ "$magic" = "55324e44" ] && {
+ echo "cybertan"
+ return
+ }
+
echo "unknown"
}