summaryrefslogtreecommitdiff
path: root/target/linux/brcm47xx
diff options
context:
space:
mode:
authorRafał Miłecki <zajec5@gmail.com>2014-12-30 17:19:36 +0000
committerRafał Miłecki <zajec5@gmail.com>2014-12-30 17:19:36 +0000
commit81b8d95f2c66a1a80039bdd5bab2c4bb795ca024 (patch)
tree522403dd0defd87ca7eff6547c026eab59c37494 /target/linux/brcm47xx
parentcca3990b160906f02521f20d5ffcb8d610880a39 (diff)
downloadmtk-20170518-81b8d95f2c66a1a80039bdd5bab2c4bb795ca024.zip
mtk-20170518-81b8d95f2c66a1a80039bdd5bab2c4bb795ca024.tar.gz
mtk-20170518-81b8d95f2c66a1a80039bdd5bab2c4bb795ca024.tar.bz2
brcm47xx: support for flashing CHK and CyberTAN images
This will allow simple sysupgrade-s including simpler reverting to the original firmware. Signed-off-by: Rafał Miłecki <zajec5@gmail.com> SVN-Revision: 43799
Diffstat (limited to 'target/linux/brcm47xx')
-rw-r--r--target/linux/brcm47xx/base-files/lib/upgrade/platform.sh33
1 files changed, 28 insertions, 5 deletions
diff --git a/target/linux/brcm47xx/base-files/lib/upgrade/platform.sh b/target/linux/brcm47xx/base-files/lib/upgrade/platform.sh
index 0a09da5..f96935b 100644
--- a/target/linux/brcm47xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/brcm47xx/base-files/lib/upgrade/platform.sh
@@ -49,8 +49,7 @@ platform_check_image() {
return 1
}
- echo "Flashing CHK images in unsupported. Please use only .trx files."
- return 1
+ return 0
;;
"cybertan")
magic=$(dd if="$1" bs=1 count=4 2>/dev/null | hexdump -v -e '1/1 "%c"')
@@ -62,8 +61,7 @@ platform_check_image() {
return 1
}
- echo "Flashing CyberTAN images in unsupported. Please use only .trx files."
- return 1
+ return 0
;;
"trx")
return 0
@@ -75,4 +73,29 @@ platform_check_image() {
esac
}
-# use default for platform_do_upgrade()
+platform_do_upgrade_chk() {
+ local header_len=$((0x$(get_magic_long_at "$1" 4)))
+ local trx="/tmp/$1.trx"
+
+ dd if="$1" of="$trx" bs=$header_len skip=1
+ shift
+ default_do_upgrade "$trx" "$@"
+}
+
+platform_do_upgrade_cybertan() {
+ local trx="/tmp/$1.trx"
+
+ dd if="$1" of="$trx" bs=32 skip=1
+ shift
+ default_do_upgrade "$trx" "$@"
+}
+
+platform_do_upgrade() {
+ local file_type=$(brcm47xx_identify "$1")
+
+ case "$file_type" in
+ "chk") platform_do_upgrade_chk "$ARGV";;
+ "cybertan") platform_do_upgrade_cybertan "$ARGV";;
+ *) default_do_upgrade "$ARGV";;
+ esac
+}