[flashrom] [RFC] Kill --force
Carl-Daniel Hailfinger
c-d.hailfinger.devel.2006 at gmx.net
Mon Apr 12 09:37:41 CEST 2010
--force may have been a good idea back when only developers were using
flashrom, but over the last few months I've seen too many people who
incorrectly believed that --force would solve anything.
One of the problems is that --force has multiple meanings:
- Force chip read by faking probe success.
- Force writing even if cbtable tells us that this is the wrong image
for this board.
- Force chip access even if the chip is bigger than max decode size for
the flash bus.
- Force erase even if erase is known bad.
- Force write even if write is known bad.
We should kill --force and replace it with explicit --force-erase or
--force-cbtable-mismatch or similar stuff, maybe -p internal:ignore_cbtable.
First step:
- Remove any suggestions to use --force for probe/read from flashrom output.
- Don't talk about "success" or "Found chip" if the chip is forced.
Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006 at gmx.net>
Index: flashrom-forced_stupid/cli_classic.c
===================================================================
--- flashrom-forced_stupid/cli_classic.c (Revision 992)
+++ flashrom-forced_stupid/cli_classic.c (Arbeitskopie)
@@ -303,6 +303,18 @@
cli_classic_usage(argv[0]);
}
+ if (chip_to_probe) {
+ for (flash = flashchips; flash && flash->name; flash++)
+ if (!strcmp(flash->name, chip_to_probe))
+ break;
+ if (!flash || !flash->name) {
+ fprintf(stderr, "Error: Unknown chip specified.\n");
+ exit(1);
+ }
+ /* Clean up after the check. */
+ flash = NULL;
+ }
+
if (programmer_init()) {
fprintf(stderr, "Error: Programmer initialization failed.\n");
exit(1);
@@ -329,14 +341,10 @@
} else if (!flashes[0]) {
printf("No EEPROM/flash device found.\n");
if (!force || !chip_to_probe) {
- printf("If you know which flash chip you have, and if this version of flashrom\n");
- printf("supports a similar flash chip, you can try to force read your chip. Run:\n");
- printf("flashrom -f -r -c similar_supported_flash_chip filename\n");
- printf("\n");
- printf("Note: flashrom can never write when the flash chip isn't found automatically.\n");
+ printf("Note: flashrom can never write if the flash chip isn't found automatically.\n");
}
if (force && read_it && chip_to_probe) {
- printf("Force read (-f -r -c) requested, forcing chip probe success:\n");
+ printf("Force read (-f -r -c) requested, pretending the chip is there:\n");
flashes[0] = probe_flash(flashchips, 1);
if (!flashes[0]) {
printf("flashrom does not support a flash chip named '%s'.\n", chip_to_probe);
Index: flashrom-forced_stupid/flashrom.c
===================================================================
--- flashrom-forced_stupid/flashrom.c (Revision 992)
+++ flashrom-forced_stupid/flashrom.c (Arbeitskopie)
@@ -924,7 +924,8 @@
if (!flash || !flash->name)
return NULL;
- printf("Found chip \"%s %s\" (%d KB, %s) at physical address 0x%lx.\n",
+ printf("%s chip \"%s %s\" (%d KB, %s) at physical address 0x%lx.\n",
+ force ? "Assuming" : "Found",
flash->vendor, flash->name, flash->total_size,
flashbuses_to_text(flash->bustype), base);
--
http://www.hailfinger.org/
More information about the flashrom
mailing list