Author: rmilecki
Date: 2014-12-15 10:59:44 +0100 (Mon, 15 Dec 2014)
New Revision: 43714

Modified:
   trunk/target/linux/brcm47xx/base-files/lib/upgrade/platform.sh
Log:
brcm47xx: detect (and still reject for now) CyberTAN fw format

Signed-off-by: Rafa?\197?\130 Mi?\197?\130ecki <[email protected]>


Modified: trunk/target/linux/brcm47xx/base-files/lib/upgrade/platform.sh
===================================================================
--- trunk/target/linux/brcm47xx/base-files/lib/upgrade/platform.sh      
2014-12-15 09:51:35 UTC (rev 43713)
+++ trunk/target/linux/brcm47xx/base-files/lib/upgrade/platform.sh      
2014-12-15 09:59:44 UTC (rev 43714)
@@ -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 @@
                        ;;
        esac
 
+       magic=$(get_magic_long_at "$1" 14)
+       [ "$magic" = "55324e44" ] && {
+               echo "cybertan"
+               return
+       }
+
        echo "unknown"
 }
 
_______________________________________________
openwrt-commits mailing list
[email protected]
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-commits

Reply via email to