summaryrefslogtreecommitdiff
path: root/target/linux
diff options
context:
space:
mode:
authorRafał Miłecki <zajec5@gmail.com>2016-06-10 14:30:57 +0200
committerRafał Miłecki <zajec5@gmail.com>2016-06-13 22:52:04 +0200
commitcb0de9a68e926cf7e8cf4a6d74ee32bd0f1fed16 (patch)
tree651f93af4fc4da182aae90fa71019dbb9cba5cdf /target/linux
parent1beb5bec6453abb220c5be4ddb9e6dc02d08d735 (diff)
downloadmtk-20170518-cb0de9a68e926cf7e8cf4a6d74ee32bd0f1fed16.zip
mtk-20170518-cb0de9a68e926cf7e8cf4a6d74ee32bd0f1fed16.tar.gz
mtk-20170518-cb0de9a68e926cf7e8cf4a6d74ee32bd0f1fed16.tar.bz2
bcm53xx: sysupgrade: move TRX specific code to separated function
This will allow adding support for other formats (e.g. Seama) in a clean way. Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Diffstat (limited to 'target/linux')
-rw-r--r--target/linux/bcm53xx/base-files/lib/upgrade/platform.sh34
1 files changed, 20 insertions, 14 deletions
diff --git a/target/linux/bcm53xx/base-files/lib/upgrade/platform.sh b/target/linux/bcm53xx/base-files/lib/upgrade/platform.sh
index 51ad041..d613595 100644
--- a/target/linux/bcm53xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/bcm53xx/base-files/lib/upgrade/platform.sh
@@ -132,22 +132,12 @@ platform_check_image() {
return $error
}
-platform_pre_upgrade() {
- export RAMFS_COPY_BIN="${RAMFS_COPY_BIN} /usr/bin/oseama /bin/sed"
-
- local file_type=$(platform_identify "$1")
+# $(1): image for upgrade (with possible extra header)
+# $(2): offset of trx in image
+platform_pre_upgrade_trx() {
local dir="/tmp/sysupgrade-bcm53xx"
local trx="$1"
- local offset
-
- [ "$(platform_flash_type)" != "nand" ] && return
-
- # Find trx offset
- case "$file_type" in
- "chk") offset=$((0x$(get_magic_long_at "$1" 4)));;
- "cybertan") offset=32;;
- "seama") return;;
- esac
+ local offset="$2"
# Extract partitions from trx
rm -fR $dir
@@ -207,6 +197,22 @@ platform_pre_upgrade() {
nand_do_upgrade /tmp/root.ubi
}
+platform_pre_upgrade() {
+ export RAMFS_COPY_BIN="${RAMFS_COPY_BIN} /usr/bin/oseama /bin/sed"
+
+ local file_type=$(platform_identify "$1")
+
+ [ "$(platform_flash_type)" != "nand" ] && return
+
+ # Find trx offset
+ case "$file_type" in
+ "chk") platform_pre_upgrade_trx "$1" $((0x$(get_magic_long_at "$1" 4)));;
+ "cybertan") platform_pre_upgrade_trx "$1" 32;;
+ "seama") return;;
+ "trx") platform_pre_upgrade_trx "$1";;
+ esac
+}
+
platform_trx_from_chk_cmd() {
local header_len=$((0x$(get_magic_long_at "$1" 4)))