File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,11 @@ case "$CONFIG_FLASH_OPTIONS" in
2121esac
2222
2323flash_rom () {
24- ROM=$1
24+ # backup firmware to rollback into in all failed attempts
25+ $CONFIG_FLASH_OPTIONS -r /tmp/${CONFIG_BOARD} _bak.rom
26+
27+ ROM=$1 # ROM file to flash
28+
2529 if [ " $READ " -eq 1 ]; then
2630 $CONFIG_FLASH_OPTIONS -r " ${ROM} " \
2731 || recovery " Backup to $ROM failed"
@@ -47,9 +51,10 @@ flash_rom() {
4751 dd if=/tmp/pchstrp9.bin bs=1 count=4 seek=292 of=/tmp/${CONFIG_BOARD} .rom conv=notrunc > /dev/null 2>&1
4852 fi
4953
50- warn " Do not power off computer. Updating firmware, this will take a few minutes"
54+ warn " Do not power off computer. Updating firmware, this could take a few minutes"
5155 $CONFIG_FLASH_OPTIONS -w /tmp/${CONFIG_BOARD} .rom 2>&1 \
52- || recovery " $ROM : Flash failed"
56+ || $CONFIG_FLASH_OPTIONS -w /tmp/${CONFIG_BOARD} _bak.rom \
57+ && recovery " $ROM : Flash failed, restored previous known good firmware state" \
5358 fi
5459}
5560
104109flash_rom $ROM
105110
106111# don't leave temporary files lying around
107- rm -f /tmp/flash.sh.bak
112+ rm -f /tmp/flash.sh.bak /tmp/ ${CONFIG_BOARD} _bak.rom
108113
109114exit 0
You can’t perform that action at this time.
0 commit comments