summaryrefslogtreecommitdiff
path: root/flashrom.c
diff options
context:
space:
mode:
authorstefanct <stefanct@2b7e53f0-3cfb-0310-b3e9-8179ed1497e1>2013-06-23 22:15:39 +0000
committerstefanct <stefanct@2b7e53f0-3cfb-0310-b3e9-8179ed1497e1>2013-06-23 22:15:39 +0000
commit4aec1ce53fa7643f812fcef92483480a8a8a0562 (patch)
tree026de7f194bea13e2792bdd28e5edb8242bc93c1 /flashrom.c
parentfe5df163872932bb527e9d0d407a36a828c91ee8 (diff)
downloadflashrom-4aec1ce53fa7643f812fcef92483480a8a8a0562.tar.gz
Warn if we skipped all blocks while writing.
Quick hack to print a warning if we skip all blocks in a write process because they are already equal to the requested image. We want something like this to make users aware... and some developers who regularly fall for this too *coughcough*. There might be more elegant solutions for this... patches welcome. This does not work for erasing because we do that unconditionally. Signed-off-by: Stefan Tauner <stefan.tauner@student.tuwien.ac.at> Acked-by: Idwer Vollering <vidwer@gmail.com> git-svn-id: https://code.coreboot.org/svn/flashrom/trunk@1680 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'flashrom.c')
-rw-r--r--flashrom.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/flashrom.c b/flashrom.c
index c11f723..6ab72a0 100644
--- a/flashrom.c
+++ b/flashrom.c
@@ -1310,6 +1310,7 @@ static int selfcheck_eraseblocks(const struct flashchip *chip)
return ret;
}
+static bool all_skipped = true;
static int erase_and_write_block_helper(struct flashctx *flash,
unsigned int start, unsigned int len,
uint8_t *curcontents,
@@ -1357,6 +1358,8 @@ static int erase_and_write_block_helper(struct flashctx *flash,
}
if (skip)
msg_cdbg("S");
+ else
+ all_skipped = false;
return ret;
}
@@ -1483,6 +1486,8 @@ int erase_and_write_flash(struct flashctx *flash, uint8_t *oldcontents,
if (ret) {
msg_cerr("FAILED!\n");
} else {
+ if (all_skipped)
+ msg_cinfo("\nWarning: Chip content is identical to the requested image.\n");
msg_cinfo("Erase/write done.\n");
}
return ret;