1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-04-29 07:53:44 +02:00

cli_classic: Add option (-N, --noverify-all)

This option specifies to verify included regions only after a write.
It also reduces the data read before the write.

v2: o Changed short option name to `-N`.
    o Added section in the manual page.

Change-Id: I40b5983f56d62821d17b827b88b73d1d41a30bd7
Signed-off-by: Nico Huber <nico.huber@secunet.com>
Reviewed-on: https://review.coreboot.org/17950
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
This commit is contained in:
Nico Huber 2016-05-02 16:54:24 +02:00 committed by Nico Huber
parent 70eed9ff60
commit 99d1595329
2 changed files with 26 additions and 5 deletions

View File

@ -42,7 +42,7 @@ static void cli_classic_usage(const char *name)
"-z|" "-z|"
#endif #endif
"-p <programmername>[:<parameters>] [-c <chipname>]\n" "-p <programmername>[:<parameters>] [-c <chipname>]\n"
"[-E|(-r|-w|-v) <file>] [-l <layoutfile> [-i <imagename>]...] [-n] [-f]]\n" "[-E|(-r|-w|-v) <file>] [-l <layoutfile> [-i <imagename>]...] [-n] [-N] [-f]]\n"
"[-V[V[V]]] [-o <logfile>]\n\n", name); "[-V[V[V]]] [-o <logfile>]\n\n", name);
printf(" -h | --help print this help text\n" printf(" -h | --help print this help text\n"
@ -55,6 +55,7 @@ static void cli_classic_usage(const char *name)
" -c | --chip <chipname> probe only for specified flash chip\n" " -c | --chip <chipname> probe only for specified flash chip\n"
" -f | --force force specific operations (see man page)\n" " -f | --force force specific operations (see man page)\n"
" -n | --noverify don't auto-verify\n" " -n | --noverify don't auto-verify\n"
" -N | --noverify-all verify included regions only (cf. -i)\n"
" -l | --layout <layoutfile> read ROM layout from <layoutfile>\n" " -l | --layout <layoutfile> read ROM layout from <layoutfile>\n"
" -i | --image <name> only flash image <name> from flash layout\n" " -i | --image <name> only flash image <name> from flash layout\n"
" -o | --output <logfile> log output to <logfile>\n" " -o | --output <logfile> log output to <logfile>\n"
@ -103,17 +104,18 @@ int main(int argc, char *argv[])
int list_supported_wiki = 0; int list_supported_wiki = 0;
#endif #endif
int read_it = 0, write_it = 0, erase_it = 0, verify_it = 0; int read_it = 0, write_it = 0, erase_it = 0, verify_it = 0;
int dont_verify_it = 0, list_supported = 0, operation_specified = 0; int dont_verify_it = 0, dont_verify_all = 0, list_supported = 0, operation_specified = 0;
enum programmer prog = PROGRAMMER_INVALID; enum programmer prog = PROGRAMMER_INVALID;
int ret = 0; int ret = 0;
static const char optstring[] = "r:Rw:v:nVEfc:l:i:p:Lzho:"; static const char optstring[] = "r:Rw:v:nNVEfc:l:i:p:Lzho:";
static const struct option long_options[] = { static const struct option long_options[] = {
{"read", 1, NULL, 'r'}, {"read", 1, NULL, 'r'},
{"write", 1, NULL, 'w'}, {"write", 1, NULL, 'w'},
{"erase", 0, NULL, 'E'}, {"erase", 0, NULL, 'E'},
{"verify", 1, NULL, 'v'}, {"verify", 1, NULL, 'v'},
{"noverify", 0, NULL, 'n'}, {"noverify", 0, NULL, 'n'},
{"noverify-all", 0, NULL, 'N'},
{"chip", 1, NULL, 'c'}, {"chip", 1, NULL, 'c'},
{"verbose", 0, NULL, 'V'}, {"verbose", 0, NULL, 'V'},
{"force", 0, NULL, 'f'}, {"force", 0, NULL, 'f'},
@ -190,6 +192,9 @@ int main(int argc, char *argv[])
} }
dont_verify_it = 1; dont_verify_it = 1;
break; break;
case 'N':
dont_verify_all = 1;
break;
case 'c': case 'c':
chip_to_probe = strdup(optarg); chip_to_probe = strdup(optarg);
break; break;
@ -536,7 +541,7 @@ int main(int argc, char *argv[])
flashrom_flag_set(fill_flash, FLASHROM_FLAG_FORCE, !!force); flashrom_flag_set(fill_flash, FLASHROM_FLAG_FORCE, !!force);
flashrom_flag_set(fill_flash, FLASHROM_FLAG_FORCE_BOARDMISMATCH, !!force_boardmismatch); flashrom_flag_set(fill_flash, FLASHROM_FLAG_FORCE_BOARDMISMATCH, !!force_boardmismatch);
flashrom_flag_set(fill_flash, FLASHROM_FLAG_VERIFY_AFTER_WRITE, !dont_verify_it); flashrom_flag_set(fill_flash, FLASHROM_FLAG_VERIFY_AFTER_WRITE, !dont_verify_it);
flashrom_flag_set(fill_flash, FLASHROM_FLAG_VERIFY_WHOLE_CHIP, true); flashrom_flag_set(fill_flash, FLASHROM_FLAG_VERIFY_WHOLE_CHIP, !dont_verify_all);
/* FIXME: We should issue an unconditional chip reset here. This can be /* FIXME: We should issue an unconditional chip reset here. This can be
* done once we have a .reset function in struct flashchip. * done once we have a .reset function in struct flashchip.

View File

@ -48,7 +48,8 @@ flashrom \- detect, read, write, verify and erase flash chips
\fB\-p\fR <programmername>[:<parameters>] \fB\-p\fR <programmername>[:<parameters>]
[\fB\-E\fR|\fB\-r\fR <file>|\fB\-w\fR <file>|\fB\-v\fR <file>] \ [\fB\-E\fR|\fB\-r\fR <file>|\fB\-w\fR <file>|\fB\-v\fR <file>] \
[\fB\-c\fR <chipname>] [\fB\-c\fR <chipname>]
[\fB\-l\fR <file> [\fB\-i\fR <image>]] [\fB\-n\fR] [\fB\-f\fR]] [\fB\-l\fR <file> [\fB\-i\fR <image>]] [\fB\-n\fR] [\fB\-N\fR] \
[\fB\-f\fR]]
[\fB\-V\fR[\fBV\fR[\fBV\fR]]] [\fB-o\fR <logfile>] [\fB\-V\fR[\fBV\fR[\fBV\fR]]] [\fB-o\fR <logfile>]
.SH DESCRIPTION .SH DESCRIPTION
.B flashrom .B flashrom
@ -112,6 +113,21 @@ Typical usage is:
This option is only useful in combination with This option is only useful in combination with
.BR \-\-write . .BR \-\-write .
.TP .TP
.B "\-N, \-\-noverify-all"
Skip not included regions during automatic verification after writing (cf.
.BR "\-l " "and " "\-i" ).
You should only use this option if you are sure that communication with
the flash chip is reliable (e.g. when using the
.BR internal
programmer). Even if flashrom is instructed not to touch parts of the
flash chip, their contents could be damaged (e.g. due to misunderstood
erase commands).
.sp
This option is required to flash an Intel system with locked ME flash
region using the
.BR internal
programmer. It may be enabled by default in this case in the future.
.TP
.B "\-v, \-\-verify <file>" .B "\-v, \-\-verify <file>"
Verify the flash ROM contents against the given Verify the flash ROM contents against the given
.BR <file> . .BR <file> .