ipq40xx: fix openmesh sysupgrade with tar content out of order
[openwrt/openwrt.git] / target / linux / ipq40xx / base-files / lib / upgrade / openmesh.sh
index 71ab247ead14140cd0446e7b03e348412f51d90c..7cc60c00e9c14fa27404dff6beda33c6a5266996 100644 (file)
@@ -47,6 +47,9 @@ platform_do_upgrade_openmesh() {
        openmesh,a42)
                primary_kernel_mtd=8
                ;;
+       openmesh,a62)
+               primary_kernel_mtd=10
+               ;;
        *)
                echo "failed to detect primary kernel mtd partition for board"
                return 1
@@ -73,9 +76,9 @@ platform_do_upgrade_openmesh() {
        # take care of restoring a saved config
        [ "$SAVE_CONFIG" -eq 1 ] && restore_backup="${MTD_CONFIG_ARGS} -j ${CONF_TAR}"
 
-       # write concatinated kernel + rootfs to flash
-       tar xf $tar_file ${board_dir}/kernel ${board_dir}/root -O | \
-               mtd $restore_backup write - $PART_NAME
+       mtd -q erase inactive
+       tar xf $tar_file ${board_dir}/root -O | mtd -n -p $kernel_length $restore_backup write - $PART_NAME
+       tar xf $tar_file ${board_dir}/kernel -O | mtd -n write - $PART_NAME
 
        # prepare new u-boot env
        if [ "$next_boot_part" = "1" ]; then