From ab1187492ae3fde728c6bba28b2e8c01b4508f68 Mon Sep 17 00:00:00 2001 From: rmilecki Date: Mon, 15 Dec 2014 09:59:44 +0000 Subject: [PATCH] brcm47xx: detect (and still reject for now) CyberTAN fw format MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Rafał Miłecki git-svn-id: svn://svn.openwrt.org/openwrt/trunk@43714 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/brcm47xx/base-files/lib/upgrade/platform.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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" } -- 2.11.0