Remembering the old days, where we had floppy-drives?
Now we have MTD. sad but true, in case of any error during
sysupgrade regarding mtd, there are no further checks
and we are f*cked:
###
Performing system upgrade...
Unlocking linux ...
Writing from <stdin> to linux ... [e]MTD do_erase_oneblock():
software
timeout
Failed to erase block
Upgrade completed
Rebooting system...
SQUASHFS error: lzma returned unexpected result 0x1
SQUASHFS error: Unable to read fragment cache block [933aa]
SQUASHFS error: Unable to read page, block 933aa, size 39b4
...
###
This patch does an infinite loop when an error occurs,
and will never go further until it works fine. if we will not
do this, we have an b0rken box anyway.
The above log from serial console shows that this case
can happen. this box works fine in our laboratory with
an 100 Euro power-supply without any problems.
(meaning: this is not a brick, was just a random mtd-error)
Some things to discuss:
* built 'verify'-option into mtd for fearful poeple
* does mtd really throws an exitcode != 0 in case of an error?
Signed-off-by: Bastian Bittorf <[email protected]>
From c9d4e7a8c4f6befcc13e4dc329adb7c5646fee76 Mon Sep 17 00:00:00 2001
From: Bastian Bittorf <[email protected]>
Date: Sat, 25 Feb 2012 15:56:02 +0100
Subject: [PATCH] sysupgrade/mtd: try to write in an infinite loop, still everything was fine
---
package/base-files/files/lib/upgrade/common.sh | 46 ++++++++++++++++--------
1 files changed, 31 insertions(+), 15 deletions(-)
diff --git a/package/base-files/files/lib/upgrade/common.sh b/package/base-files/files/lib/upgrade/common.sh
index e97958b..e8c1724 100644
--- a/package/base-files/files/lib/upgrade/common.sh
+++ b/package/base-files/files/lib/upgrade/common.sh
@@ -196,25 +196,41 @@ default_do_upgrade() {
do_upgrade() {
v "Performing system upgrade..."
- if type 'platform_do_upgrade' >/dev/null 2>/dev/null; then
- platform_do_upgrade "$ARGV"
- else
- default_do_upgrade "$ARGV"
- fi
- [ "$SAVE_CONFIG" -eq 1 -a -n "$USE_REFRESH" ] && {
- v "Refreshing partitions"
- if type 'platform_refresh_partitions' >/dev/null 2>/dev/null; then
- platform_refresh_partitions
+ while true; do
+ if type 'platform_do_upgrade' >/dev/null 2>/dev/null; then
+ platform_do_upgrade "$ARGV" && break
else
- refresh_mtd_partitions
- fi
- if type 'platform_copy_config' >/dev/null 2>/dev/null; then
- platform_copy_config
- else
- jffs2_copy_config
+ default_do_upgrade "$ARGV" && break
fi
+
+ v "do_upgrade failed, trying again"
+ done
+
+ [ "$SAVE_CONFIG" -eq 1 -a -n "$USE_REFRESH" ] && {
+ v "Refreshing partitions"
+
+ while true; do
+ if type 'platform_refresh_partitions' >/dev/null 2>/dev/null; then
+ platform_refresh_partitions && break
+ else
+ refresh_mtd_partitions && break
+ fi
+
+ v "refresh_partitions failed, trying again"
+ done
+
+ while true; do
+ if type 'platform_copy_config' >/dev/null 2>/dev/null; then
+ platform_copy_config && break
+ else
+ jffs2_copy_config && break
+ fi
+
+ v "copy_config failed, trying again"
+ done
}
+
v "Upgrade completed"
[ -n "$DELAY" ] && sleep "$DELAY"
ask_bool 1 "Reboot" && {
--
1.7.0.4_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/mailman/listinfo/openwrt-devel