mirror of
https://review.coreboot.org/flashrom.git
synced 2025-04-26 14:42:36 +02:00
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. Corresponding to flashrom svn r1680. Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at> Acked-by: Idwer Vollering <vidwer@gmail.com>
This commit is contained in:
parent
cecb2c56d0
commit
682122bce7
1
flash.h
1
flash.h
@ -27,6 +27,7 @@
|
|||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
#include <stdbool.h>
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#undef min
|
#undef min
|
||||||
|
@ -1310,6 +1310,7 @@ static int selfcheck_eraseblocks(const struct flashchip *chip)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool all_skipped = true;
|
||||||
static int erase_and_write_block_helper(struct flashctx *flash,
|
static int erase_and_write_block_helper(struct flashctx *flash,
|
||||||
unsigned int start, unsigned int len,
|
unsigned int start, unsigned int len,
|
||||||
uint8_t *curcontents,
|
uint8_t *curcontents,
|
||||||
@ -1357,6 +1358,8 @@ static int erase_and_write_block_helper(struct flashctx *flash,
|
|||||||
}
|
}
|
||||||
if (skip)
|
if (skip)
|
||||||
msg_cdbg("S");
|
msg_cdbg("S");
|
||||||
|
else
|
||||||
|
all_skipped = false;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1483,6 +1486,8 @@ int erase_and_write_flash(struct flashctx *flash, uint8_t *oldcontents,
|
|||||||
if (ret) {
|
if (ret) {
|
||||||
msg_cerr("FAILED!\n");
|
msg_cerr("FAILED!\n");
|
||||||
} else {
|
} else {
|
||||||
|
if (all_skipped)
|
||||||
|
msg_cinfo("\nWarning: Chip content is identical to the requested image.\n");
|
||||||
msg_cinfo("Erase/write done.\n");
|
msg_cinfo("Erase/write done.\n");
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user