summaryrefslogtreecommitdiff
path: root/util/flashrom/flashrom.c
diff options
context:
space:
mode:
authorBernhard Walle <bernhard.walle@gmx.de>2008-01-21 15:24:22 +0000
committerUwe Hermann <uwe@hermann-uwe.de>2008-01-21 15:24:22 +0000
commit679c62c083d4e4edbc292160d441dbfe6ae3cd40 (patch)
tree160f77d972437c32697c9e30a3ea7161ce77158e /util/flashrom/flashrom.c
parent8ce4a19b20f22f74573a93566d4a202e58f00758 (diff)
This patch adds version information to flashrom. Because 'v' and 'V'
are already in use, the patch uses 'R' (for release) and, of course, '--version'. Signed-off-by: Bernhard Walle <bernhard.walle@gmx.de> Acked-by: Ulf Jordan <jordan@chalmers.se> Acked-by: Uwe Hermann <uwe@hermann-uwe.de> git-svn-id: svn://svn.coreboot.org/coreboot/trunk@3067 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'util/flashrom/flashrom.c')
-rw-r--r--util/flashrom/flashrom.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/util/flashrom/flashrom.c b/util/flashrom/flashrom.c
index 9fde57d9ef..5446fc5fc7 100644
--- a/util/flashrom/flashrom.c
+++ b/util/flashrom/flashrom.c
@@ -191,7 +191,7 @@ int verify_flash(struct flashchip *flash, uint8_t *buf)
void usage(const char *name)
{
- printf("usage: %s [-rwvEVfh] [-c chipname] [-s exclude_start]\n", name);
+ printf("usage: %s [-rwvEVfhR] [-c chipname] [-s exclude_start]\n", name);
printf(" [-e exclude_end] [-m vendor:part] [-l file.layout] [-i imagename] [file]\n");
printf
(" -r | --read: read flash and save into file\n"
@@ -206,11 +206,17 @@ void usage(const char *name)
" -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"
+ " -R | --version: print the version (release)\n"
"\n" " If no file is specified, then all that happens"
" is that flash info is dumped.\n\n");
exit(1);
}
+void print_version(void)
+{
+ printf("flashrom r%s\n", FLASHROM_VERSION);
+}
+
int main(int argc, char *argv[])
{
uint8_t *buf;
@@ -236,6 +242,7 @@ int main(int argc, char *argv[])
{"layout", 1, 0, 'l'},
{"image", 1, 0, 'i'},
{"help", 0, 0, 'h'},
+ {"version", 0, 0, 'R'},
{0, 0, 0, 0}
};
@@ -253,7 +260,7 @@ int main(int argc, char *argv[])
}
setbuf(stdout, NULL);
- while ((opt = getopt_long(argc, argv, "rwvVEfc:s:e:m:l:i:h",
+ while ((opt = getopt_long(argc, argv, "rRwvVEfc:s:e:m:l:i:h",
long_options, &option_index)) != EOF) {
switch (opt) {
case 'r':
@@ -306,6 +313,10 @@ int main(int argc, char *argv[])
tempstr = strdup(optarg);
find_romentry(tempstr);
break;
+ case 'R':
+ print_version();
+ exit(0);
+ break;
case 'h':
default:
usage(argv[0]);