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
This commit is contained in:
Bernhard Walle 2008-01-21 15:24:22 +00:00 committed by Uwe Hermann
parent 8ce4a19b20
commit 679c62c083
3 changed files with 23 additions and 6 deletions

View File

@ -28,6 +28,12 @@ OBJS = chipset_enable.o board_enable.o udelay.o jedec.o sst28sf040.o \
all: pciutils dep $(PROGRAM) all: pciutils dep $(PROGRAM)
# Set the flashrom version string from the highest revision number
# of the checked out flashrom files.
SVNDEF := -D'FLASHROM_VERSION="$(shell svnversion -cn . \
| sed -e "s/.*://" -e "s/\([0-9]*\).*/\1/")"'
CFLAGS += $(SVNDEF)
$(PROGRAM): $(OBJS) $(PROGRAM): $(OBJS)
$(CC) -o $(PROGRAM) $(OBJS) $(LDFLAGS) $(CC) -o $(PROGRAM) $(OBJS) $(LDFLAGS)
$(STRIP) $(STRIP_ARGS) $(PROGRAM) $(STRIP) $(STRIP_ARGS) $(PROGRAM)

View File

@ -2,7 +2,7 @@
.SH NAME .SH NAME
flashrom \- a universal BIOS/ROM/flash programming utility flashrom \- a universal BIOS/ROM/flash programming utility
.SH SYNOPSIS .SH SYNOPSIS
.B flashrom \fR[\fB\-rwvEVfh\fR] [\fB\-c\fR chipname] [\fB\-s\fR exclude_start] [\fB\-e\fR exclude_end] .B flashrom \fR[\fB\-rwvEVfhR\fR] [\fB\-c\fR chipname] [\fB\-s\fR exclude_start] [\fB\-e\fR exclude_end]
[\fB-m\fR vendor:part] [\fB-l\fR file.layout] [\fB-i\fR image_name] [file] [\fB-m\fR vendor:part] [\fB-l\fR file.layout] [\fB-i\fR image_name] [file]
.SH DESCRIPTION .SH DESCRIPTION
.B flashrom .B flashrom
@ -63,9 +63,9 @@ from flash layout.
.TP .TP
.B "\-h, \-\-help" .B "\-h, \-\-help"
Show a help text and exit. Show a help text and exit.
.\".TP .TP
.\".B "\-\-version" .B "\-R, \-\-version"
.\"Show version information and exit. Show version information and exit.
.SH BUGS .SH BUGS
Please report any bugs at Please report any bugs at
.BR http://tracker.coreboot.org/trac/coreboot/newticket "," .BR http://tracker.coreboot.org/trac/coreboot/newticket ","

View File

@ -191,7 +191,7 @@ int verify_flash(struct flashchip *flash, uint8_t *buf)
void usage(const char *name) 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(" [-e exclude_end] [-m vendor:part] [-l file.layout] [-i imagename] [file]\n");
printf printf
(" -r | --read: read flash and save into file\n" (" -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" " -f | --force: force write without checking image\n"
" -l | --layout <file.layout>: read rom layout from file\n" " -l | --layout <file.layout>: read rom layout from file\n"
" -i | --image <name>: only flash image name from flash layout\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" "\n" " If no file is specified, then all that happens"
" is that flash info is dumped.\n\n"); " is that flash info is dumped.\n\n");
exit(1); exit(1);
} }
void print_version(void)
{
printf("flashrom r%s\n", FLASHROM_VERSION);
}
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
uint8_t *buf; uint8_t *buf;
@ -236,6 +242,7 @@ int main(int argc, char *argv[])
{"layout", 1, 0, 'l'}, {"layout", 1, 0, 'l'},
{"image", 1, 0, 'i'}, {"image", 1, 0, 'i'},
{"help", 0, 0, 'h'}, {"help", 0, 0, 'h'},
{"version", 0, 0, 'R'},
{0, 0, 0, 0} {0, 0, 0, 0}
}; };
@ -253,7 +260,7 @@ int main(int argc, char *argv[])
} }
setbuf(stdout, NULL); 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) { long_options, &option_index)) != EOF) {
switch (opt) { switch (opt) {
case 'r': case 'r':
@ -306,6 +313,10 @@ int main(int argc, char *argv[])
tempstr = strdup(optarg); tempstr = strdup(optarg);
find_romentry(tempstr); find_romentry(tempstr);
break; break;
case 'R':
print_version();
exit(0);
break;
case 'h': case 'h':
default: default:
usage(argv[0]); usage(argv[0]);