summaryrefslogtreecommitdiff
path: root/target/linux/ipq806x
diff options
context:
space:
mode:
authorAdrian Panella <ianchi74@outlook.com>2016-12-08 02:41:58 -0600
committerJohn Crispin <john@phrozen.org>2016-12-20 09:35:37 +0100
commitd700c120bffe806aa23442cbbcce30e1c1886b79 (patch)
tree9988e0c9052ba09879b68cd8ef1c28a148e6fc72 /target/linux/ipq806x
parent96a7ee3c80dec5cd86a25f6c72852928370e57b4 (diff)
downloadmtk-20170518-d700c120bffe806aa23442cbbcce30e1c1886b79.zip
mtk-20170518-d700c120bffe806aa23442cbbcce30e1c1886b79.tar.gz
mtk-20170518-d700c120bffe806aa23442cbbcce30e1c1886b79.tar.bz2
ipq806x: EA8500 fix sysupgrade over stock firmware
When running sysupgrade for the first time over the second partition (that still had stock firmware) the rootfs wasn't flashed as there wasn't enough space. This happend because stock also uses UBI, but the volume name wasn't recognised and wasn't deleted before flashing. Signed-off-by: Adrian Panella <ianchi74@outlook.com>
Diffstat (limited to 'target/linux/ipq806x')
-rw-r--r--target/linux/ipq806x/base-files/lib/upgrade/linksys.sh30
1 files changed, 26 insertions, 4 deletions
diff --git a/target/linux/ipq806x/base-files/lib/upgrade/linksys.sh b/target/linux/ipq806x/base-files/lib/upgrade/linksys.sh
index ca5161a..12f25ef 100644
--- a/target/linux/ipq806x/base-files/lib/upgrade/linksys.sh
+++ b/target/linux/ipq806x/base-files/lib/upgrade/linksys.sh
@@ -55,11 +55,36 @@ platform_do_upgrade_linksys() {
CI_UBIPART="rootfs2"
fi
+
+ # remove "squashfs" vol (in case we are flashing over a stock image, which is also UBI)
+
+ local mtdnum="$( find_mtd_index "$CI_UBIPART" )"
+ if [ ! "$mtdnum" ]; then
+ echo "cannot find ubi mtd partition $CI_UBIPART"
+ return 1
+ fi
+
+ local ubidev="$( nand_find_ubi "$CI_UBIPART" )"
+ if [ ! "$ubidev" ]; then
+ ubiattach -m "$mtdnum"
+ sync
+ ubidev="$( nand_find_ubi "$CI_UBIPART" )"
+ fi
+
+ if [ "$ubidev" ]; then
+
+ local squash_ubivol="$( nand_find_volume $ubidev squashfs )"
+
+ # kill volume
+ [ "$squash_ubivol" ] && ubirmvol /dev/$ubidev -N squashfs || true
+ fi
+
+
+ # complete std upgrade
nand_upgrade_tar "$1"
}
[ "$magic_long" = "27051956" ] && {
# check firmwares' rootfs types
- local target_mtd=$(find_mtd_part $part_label)
local oldroot="$(linksys_get_root_magic $target_mtd)"
local newroot="$(linksys_get_root_magic "$1")"
@@ -80,9 +105,6 @@ linksys_preupgrade() {
export RAMFS_COPY_BIN="${RAMFS_COPY_BIN} /bin/mkdir /bin/touch"
export RAMFS_COPY_DATA="${RAMFS_COPY_DATA} /etc/fw_env.config /var/lock/fw_printenv.lock"
- [ -f /tmp/sysupgrade.tgz ] && {
- cp /tmp/sysupgrade.tgz /tmp/syscfg/sysupgrade.tgz
- }
}
append sysupgrade_pre_upgrade linksys_preupgrade