On 30.03.2010 05:25, Carl-Daniel Hailfinger wrote:
No, 0.9.2 is not yet out. This patch should be committed in r999 so that the 0.9.2 tag in svn will be r1000.
This goal is now unreachable. I hope we can at least commit the makefile change for 0.9.2 in r1000, the tag will be at least r1001.
Patches I want to get in before 0.9.2:
AT49F002(N)(T) eraseblock fix (needs re-review due to datasheet contradictions) http://patchwork.coreboot.org/patch/833/
drkaiser: MEM BAR fixes (needs update to fix gfxnvidia MEM BAR as well) http://patchwork.coreboot.org/patch/1077/
msg_* conversions (two patches, preferably as one commit, needs review) http://patchwork.coreboot.org/patch/1167/ http://patchwork.coreboot.org/patch/1166/
Suggestions for other patches? If I overlooked any of your patches, I'm sorry. Feel free to point me to them and/or push them for inclusion.
The patch below is a bit heavy, but I think a substantial part of it (especially the man page stuff) is really needed to release 0.9.2 without being ashamed of it.
While I'd prefer to have all of the changes below in 0.9.2, I will listen to reviews and kill/change parts of this patch where needed.
One thing still needs to be fixed, though. Do we want to print the command line arguments 1. always before parsing them regardless of verbosity (great for debugging, but clutters the output needlessly) 2. only after parsing them and only in verbose mode 3. only after parsing them regardless of verbosity 4. never The option "before parsing, but only in verbose mode" does not exist because we have to parse them to know if the user requested verbose mode.
Changelog: Fix assorted documentation and frontend bugs.
Signed-off-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net
Index: flashrom-0.9.2/flashrom.8 =================================================================== --- flashrom-0.9.2/flashrom.8 (revision 996) +++ flashrom-0.9.2/flashrom.8 (working copy) @@ -1,9 +1,13 @@ -.TH FLASHROM 8 "May 21, 2009" +.TH FLASHROM 8 "Apr 29, 2010" .SH NAME flashrom - detect, read, write, verify and erase flash chips .SH SYNOPSIS -.B flashrom \fR[\fB-VfLzhRn\fR] [\fB-E\fR|\fB-r\fR file|\fB-w\fR file|\fB-v\fR file] [\fB-c\fR chipname] - [\fB-m\fR [vendor:]part] [\fB-l\fR file] [\fB-i\fR image] [\fB-p\fR programmer] +.B flashrom \fR[\fB-n\fR] [\fB-V\fR] [\fB-f\fR] [\fB-h\fR|\fB-R\fR|\ +\fB-L\fR|\fB-z\fR|\fB-E\fR|\fB-r\fR <file>|\fB-w\fR <file>|\ +\fB-v\fR <file>] + [\fB-c\fR <chipname>] [\fB-m\fR [<vendor>:]<part>] \ +[\fB-l\fR <file>] + [\fB-i\fR <image>] [\fB-p\fR <programmername>[:<parameters>]] .SH DESCRIPTION .B flashrom is a utility for detecting, reading, writing, verifying and erasing flash @@ -20,9 +24,8 @@ flashrom 1.0. Do not use flashrom in scripts or other automated tools without checking that your flashrom version won't interpret options in a different way. .PP -You can specify one of -E, -r, -w, -v or no operation. -If no operation is specified, then all that happens -is that flash info is dumped and the flash chip is set to writable. It is +You can specify one of -h, -R, -L, -z, -E, -r, -w, -v or no operation. +If no operation is specified, flashrom will only probe for flash chips. It is recommended that if you try flashrom the first time on a system, you run it in probe only mode and check the output. Also you are advised to make a backup of your current ROM contents with -r before you try to write a new @@ -42,10 +45,11 @@ option is .B not recommended, you should only use it if you know what you are doing and you -feel that the time for verification takes too long. +feel that the time for verification takes too long. Please note that flashrom +will automatically verify all operations unless you specify --noverify. .sp Typical usage is: -.B "flashrom -wn file" +.B "flashrom -n -w file" .sp This option is only useful in combination with .BR --write . @@ -66,14 +70,14 @@ .B "flashrom -L" without the vendor name. Please note that the chip name is case sensitive. .TP -.B "-m, --mainboard" <[vendor:]part> +.B "-m, --mainboard" [<vendor>:]<part> Override mainboard settings. .sp flashrom reads the coreboot table to determine the current mainboard. If no coreboot table could be read or if you want to override these values, you can specify -m, e.g.: .sp -.B " flashrom -w --mainboard AGAMI:ARUMA agami_aruma.rom" +.B " flashrom --mainboard AGAMI:ARUMA -w agami_aruma.rom" .sp See the 'Supported mainboards' section in the output of 'flashrom -L' for a list of boards which require the specification of the board name, if no @@ -108,19 +112,15 @@ All addresses are offsets within the file, not absolute addresses! If you only want to update the normal image in a ROM you can say: .sp -.B " flashrom -w --layout rom.layout --image normal agami_aruma.rom" +.B " flashrom --layout rom.layout --image normal -w agami_aruma.rom" .sp To update normal and fallback but leave the VGA BIOS alone, say: .sp -.B " flashrom -w -l rom.layout -i normal " +.B " flashrom -l rom.layout -i normal " .br -.B " -i fallback agami_aruma.rom" +.B " -i fallback -w agami_aruma.rom" .sp Currently overlapping sections are not supported. -.sp -ROM layouts should replace the -s and -e option since they are more -flexible and they should lead to a ROM update file format with the -ROM layout and the ROM image in one file (cpio, zip or something?). .TP .B "-i, --image <name>" Only flash image @@ -141,7 +141,8 @@ Same as .BR --list-supported , but outputs the supported hardware in MediaWiki syntax, so that it can be -easily pasted into the wiki page at http://www.flashrom.org/. +easily pasted into the wiki page at http://www.flashrom.org/. Please note +that MediaWiki output is not compiled in by default. .TP .B "-p, --programmer <name>[:parameter[,parameter[,parameter]]]" Specify the programmer device. Currently supported are: @@ -237,6 +238,7 @@ .sp If your mainboard uses an ITE IT87 series Super I/O for LPC<->SPI flash bus translation, flashrom should autodetect that configuration. You can use +.sp .B "flashrom -p internal:it87spiport=portnum" syntax as explained in the .B it87spi @@ -382,6 +384,8 @@ .br Markus Boas ryven@ryven.de .br +Michael Karcher flashrom@mkarcher.dialup.fu-berlin.de +.br Nikolay Petukhov nikolay.petukhov@gmail.com .br Peter Stuge peter@stuge.se @@ -392,6 +396,8 @@ .br Ronald Hoogenboom ronald@zonnet.nl .br +Sean Nelson audiohacked@gmail.com +.br Stefan Reinauer stepan@coresystems.de .br Stefan Wildemann stefan.wildemann@kontron.com @@ -406,5 +412,6 @@ .br some others .PP -This manual page was written by Uwe Hermann uwe@hermann-uwe.de. +This manual page was written by Uwe Hermann uwe@hermann-uwe.de and Carl-Daniel +Hailfinger. It is licensed under the terms of the GNU GPL (version 2 or later). Index: flashrom-0.9.2/flash.h =================================================================== --- flashrom-0.9.2/flash.h (revision 996) +++ flashrom-0.9.2/flash.h (working copy) @@ -548,6 +548,7 @@ int need_erase(uint8_t *have, uint8_t *want, int len, enum write_granularity gran); char *strcat_realloc(char *dest, const char *src); void print_version(void); +void print_banner(void); int selfcheck(void); int doit(struct flashchip *flash, int force, char *filename, int read_it, int write_it, int erase_it, int verify_it);
Index: flashrom-0.9.2/Makefile =================================================================== --- flashrom-0.9.2/Makefile (revision 996) +++ flashrom-0.9.2/Makefile (working copy) @@ -71,9 +71,9 @@ # of the checked out flashrom files. # Note to packagers: Any tree exported with "make export" or "make tarball" # will not require subversion. The downloadable snapshots are already exported. -SVNVERSION := $(shell LC_ALL=C svnversion -cn . | sed -e "s/.*://" -e "s/([0-9]*).*/\1/" | grep "[0-9]" || LC_ALL=C svn info . | grep ^Revision | sed "s/.*[[:blank:]]+([0-9]*)[^0-9]*/\1/" | grep "[0-9]" || echo unknown) +SVNVERSION := $(shell LC_ALL=C svnversion -cn . 2>/dev/null | sed -e "s/.*://" -e "s/([0-9]*).*/\1/" | grep "[0-9]" || LC_ALL=C svn info . 2>/dev/null | awk '/^Revision:/ {print $2 }' | grep "[0-9]" || LC_ALL=C git svn info . 2>/dev/null | awk '/^Revision:/ {print $2 }' | grep "[0-9]" || echo unknown)
-RELEASE := 0.9.1 +RELEASE := 0.9.2 VERSION := $(RELEASE)-r$(SVNVERSION) RELEASENAME ?= $(VERSION)
Index: flashrom-0.9.2/cli_classic.c =================================================================== --- flashrom-0.9.2/cli_classic.c (revision 996) +++ flashrom-0.9.2/cli_classic.c (working copy) @@ -37,33 +37,53 @@ int remaining = 0; enum programmer p;
- printf("Usage: %s [-VfLzhR] [-E|-r file|-w file|-v file] [-c chipname]\n" - " [-m [vendor:]part] [-l file] [-i image] [-p programmer]\n\n", name); + printf( + "Usage: %s [-n] [-V] [-f] [-h|-R|-L|" +#if PRINT_WIKI_SUPPORT == 1 + "-z|" +#endif + "-E|-r <file>|-w <file>|-v <file>]\n" + " [-c <chipname>] [-m [<vendor>:]<part>] [-l <file>]\n" + " [-i <image>] [-p <programmername>[:<parameters>]]\n", + name);
- printf("Please note that the command line interface for flashrom will " - "change before\nflashrom 1.0. Do not use flashrom in scripts " - "or other automated tools without\nchecking that your flashrom" - " version won't interpret options in a different way.\n\n"); + printf("Please note that the command line interface for flashrom has " + "changed between\n" + "0.9.1 and 0.9.2 and will change again before flashrom 1.0.\n" + "Do not use flashrom in scripts or other automated tools " + "without checking\n" + "that your flashrom version won't interpret options in a " + "different way.\n\n");
- printf - (" -r | --read: read flash and save into file\n" - " -w | --write: write file into flash\n" - " -v | --verify: verify flash against file\n" - " -n | --noverify: don't verify flash against file\n" - " -E | --erase: erase flash device\n" - " -V | --verbose: more verbose output\n" - " -c | --chip <chipname>: probe only for specified flash chip\n" + printf(" -h | --help print this help text\n" + " -R | --version print version (release)\n" + " -r | --read <file> read flash and save to " + "file\n" + " -w | --write <file> write file to flash\n" + " -v | --verify <file> verify flash against " + "file\n" + " -E | --erase erase flash device\n" + " -V | --verbose more verbose output\n" + " -c | --chip <chipname> probe only for specified " + "flash chip\n" #if INTERNAL_SUPPORT == 1 - " -m | --mainboard <[vendor:]part>: override mainboard settings\n" + /* FIXME: --mainboard should be a programmer parameter */ + " -m | --mainboard <[vendor:]part> override mainboard " + "detection\n" #endif - " -f | --force: force write without checking image\n" - " -l | --layout <file.layout>: read ROM layout from file\n" - " -i | --image <name>: only flash image name from flash layout\n" - " -L | --list-supported: print supported devices\n" + " -f | --force force something\n" + " -n | --noverify don't auto-verify\n" + " -l | --layout <file> read ROM layout from " + "file\n" + " -i | --image <name> only flash image <name> " + "from flash layout\n" + " -L | --list-supported print supported devices\n" #if PRINT_WIKI_SUPPORT == 1 - " -z | --list-supported-wiki: print supported devices in wiki syntax\n" + " -z | --list-supported-wiki print supported devices " + "in wiki syntax\n" #endif - " -p | --programmer <name>: specify the programmer device"); + " -p | --programmer <name>[:<param>] specify the programmer " + "device");
for (p = 0; p < PROGRAMMER_INVALID; p++) { pname = programmer_table[p].name; @@ -89,11 +109,18 @@ } } - printf( - " -h | --help: print this help text\n" - " -R | --version: print the version (release)\n" - "\nYou can specify one of -E, -r, -w, -v or no operation. If no operation is\n" - "specified, then all that happens is that flash info is dumped.\n\n"); + printf("\nYou can specify one of -h, -R, -L, " +#if PRINT_WIKI_SUPPORT == 1 + "-z, " +#endif + "-E, -r, -w, -v or no operation.\n" + "If no operation is specified, flashrom will only probe for " + "flash chips.\n\n"); +} + +void cli_classic_abort_usage(const char *name) +{ + cli_classic_usage(name); exit(1); }
@@ -116,15 +143,15 @@ int i;
#if PRINT_WIKI_SUPPORT == 1 - const char *optstring = "rRwvnVEfc:m:l:i:p:Lzh"; + const char *optstring = "r:Rw:v:nVEfc:m:l:i:p:Lzh"; #else - const char *optstring = "rRwvnVEfc:m:l:i:p:Lh"; + const char *optstring = "r:Rw:v:nVEfc:m:l:i:p:Lh"; #endif static struct option long_options[] = { - {"read", 0, 0, 'r'}, - {"write", 0, 0, 'w'}, + {"read", 1, 0, 'r'}, + {"write", 1, 0, 'w'}, {"erase", 0, 0, 'E'}, - {"verify", 0, 0, 'v'}, + {"verify", 1, 0, 'v'}, {"noverify", 0, 0, 'n'}, {"chip", 1, 0, 'c'}, {"mainboard", 1, 0, 'm'}, @@ -147,7 +174,9 @@ char *tempstr = NULL;
print_version(); + print_banner();
+#warning This is broken. printf_debug is a no-op because verbose=0 at this point if (argc > 1) { /* Yes, print them. */ printf_debug("The arguments are:\n"); @@ -166,16 +195,18 @@ if (++operation_specified > 1) { fprintf(stderr, "More than one operation " "specified. Aborting.\n"); - exit(1); + cli_classic_abort_usage(argv[0]); } + filename = strdup(optarg); read_it = 1; break; case 'w': if (++operation_specified > 1) { fprintf(stderr, "More than one operation " "specified. Aborting.\n"); - exit(1); + cli_classic_abort_usage(argv[0]); } + filename = strdup(optarg); write_it = 1; break; case 'v': @@ -183,20 +214,21 @@ if (++operation_specified > 1) { fprintf(stderr, "More than one operation " "specified. Aborting.\n"); - exit(1); + cli_classic_abort_usage(argv[0]); } if (dont_verify_it) { fprintf(stderr, "--verify and --noverify are" "mutually exclusive. Aborting.\n"); - exit(1); + cli_classic_abort_usage(argv[0]); } + filename = strdup(optarg); verify_it = 1; break; case 'n': if (verify_it) { fprintf(stderr, "--verify and --noverify are" "mutually exclusive. Aborting.\n"); - exit(1); + cli_classic_abort_usage(argv[0]); } dont_verify_it = 1; break; @@ -210,7 +242,7 @@ if (++operation_specified > 1) { fprintf(stderr, "More than one operation " "specified. Aborting.\n"); - exit(1); + cli_classic_abort_usage(argv[0]); } erase_it = 1; break; @@ -226,6 +258,7 @@ case 'l': tempstr = strdup(optarg); if (read_romlayout(tempstr)) + /* FIXME: Print usage message here? */ exit(1); break; case 'i': @@ -233,10 +266,20 @@ find_romentry(tempstr); break; case 'L': + if (++operation_specified > 1) { + fprintf(stderr, "More than one operation " + "specified. Aborting.\n"); + cli_classic_abort_usage(argv[0]); + } list_supported = 1; break; #if PRINT_WIKI_SUPPORT == 1 case 'z': + if (++operation_specified > 1) { + fprintf(stderr, "More than one operation " + "specified. Aborting.\n"); + cli_classic_abort_usage(argv[0]); + } list_supported_wiki = 1; break; #endif @@ -268,17 +311,30 @@ } if (programmer == PROGRAMMER_INVALID) { printf("Error: Unknown programmer %s.\n", optarg); - exit(1); + cli_classic_abort_usage(argv[0]); } break; case 'R': /* print_version() is always called during startup. */ + if (++operation_specified > 1) { + fprintf(stderr, "More than one operation " + "specified. Aborting.\n"); + cli_classic_abort_usage(argv[0]); + } exit(0); break; case 'h': - default: + if (++operation_specified > 1) { + fprintf(stderr, "More than one operation " + "specified. Aborting.\n"); + cli_classic_abort_usage(argv[0]); + } cli_classic_usage(argv[0]); + exit(0); break; + default: + cli_classic_abort_usage(argv[0]); + break; } }
@@ -294,17 +350,9 @@ } #endif
- if (read_it && write_it) { - printf("Error: -r and -w are mutually exclusive.\n"); - cli_classic_usage(argv[0]); - } - - if (optind < argc) - filename = argv[optind++]; - if (optind < argc) { printf("Error: Extra parameter found.\n"); - cli_classic_usage(argv[0]); + cli_classic_abort_usage(argv[0]); }
if (chip_to_probe) { @@ -322,6 +370,8 @@ flash = NULL; } + msg_pdbg("Initializing %s programmer\n", + programmer_table[programmer].name); if (programmer_init()) { fprintf(stderr, "Error: Programmer initialization failed.\n"); exit(1); @@ -383,7 +433,7 @@ printf("No operations were specified.\n"); // FIXME: flash writes stay enabled! programmer_shutdown(); - exit(1); + exit(0); }
if (!filename && !erase_it) { Index: flashrom-0.9.2/flashrom.c =================================================================== --- flashrom-0.9.2/flashrom.c (revision 996) +++ flashrom-0.9.2/flashrom.c (working copy) @@ -1187,6 +1187,12 @@ print_sysinfo(); }
+void print_banner(void) +{ + printf("flashrom is free software, get the source code at " + "http://www.flashrom.org%5Cn"); +} + int selfcheck(void) { int ret = 0; @@ -1247,13 +1253,19 @@ printf("\n"); } /* FIXME: This message is designed towards CLI users. */ - printf("Please email a report to flashrom@flashrom.org if any " - "of the above operations\nwork correctly for you with " - "this flash part. Please include the flashrom\noutput " - "with the additional -V option for all operations you " - "tested (-V, -rV,\n-wV, -EV), and mention which " - "mainboard or programmer you tested.\nThanks for your " - "help!\n===\n"); + printf("The test status of this chip may have been updated in " + "the latest development\n" + "version of flashrom. If you are running the latest " + "development version,\n" + "please email a report to flashrom@flashrom.org if any " + "of the above operations\n" + "work correctly for you with this flash part. Please " + "include the flashrom\n" + "output with the additional -V option for all " + "operations you tested (-V, -Vr,\n" + "-Vw, -VE), and mention which mainboard or programmer " + "you tested.\n" + "Thanks for your help!\n===\n"); } }