* [PATCH] tegrarcm: Add version command
@ 2013-06-18 3:24 Allen Martin
[not found] ` <1371525867-2551-1-git-send-email-amartin-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: Allen Martin @ 2013-06-18 3:24 UTC (permalink / raw)
To: swarren-3lzwWm7+Weoh9ZMKESR00Q
Cc: linux-tegra-u79uwXL29TY76Z2rM5mHXA, Allen Martin
Add command line option "--version" that prints the version number and
exits.
Signed-off-by: Allen Martin <amartin-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
---
src/main.c | 11 +++++++++++
src/tegrarcm.1.in | 3 +++
2 files changed, 14 insertions(+)
diff --git a/src/main.c b/src/main.c
index bc81cd2..002d897 100644
--- a/src/main.c
+++ b/src/main.c
@@ -46,6 +46,7 @@
#include "aes-cmac.h"
#include "rcm.h"
#include "debug.h"
+#include "config.h"
// tegra20 miniloader
#include "tegra20-miniloader.h"
@@ -71,9 +72,15 @@ enum cmdline_opts {
OPT_LOADADDR,
OPT_ENTRYADDR,
OPT_HELP,
+ OPT_VERSION,
OPT_END,
};
+static void print_version(char *progname)
+{
+ fprintf(stderr, "%s %s\n", PACKAGE_NAME, PACKAGE_VERSION);
+}
+
static void usage(char *progname)
{
fprintf(stderr, "usage: %s --bct=bctfile --bootloader=blfile --loadaddr=<loadaddr> --entryaddr=<entryaddr>\n", progname);
@@ -111,6 +118,7 @@ int main(int argc, char **argv)
[OPT_LOADADDR] = {"loadaddr", 1, 0, 0},
[OPT_ENTRYADDR] = {"entryaddr", 1, 0, 0},
[OPT_HELP] = {"help", 0, 0, 0},
+ [OPT_VERSION] = {"version", 0, 0, 0},
[OPT_END] = {0, 0, 0, 0}
};
@@ -136,6 +144,9 @@ int main(int argc, char **argv)
case OPT_ENTRYADDR:
entryaddr = strtoul(optarg, NULL, 0);
break;
+ case OPT_VERSION:
+ print_version(argv[0]);
+ exit(0);
case OPT_HELP:
default:
usage(argv[0]);
diff --git a/src/tegrarcm.1.in b/src/tegrarcm.1.in
index 4d1e1d6..5264216 100644
--- a/src/tegrarcm.1.in
+++ b/src/tegrarcm.1.in
@@ -59,6 +59,9 @@ specified in hex and is typically 0x108000 for a Tegra20 device or
Specify the entry address that control will be passed to after the
firmware is loaded. This should be specified in hex. If this option
is omitted it is assumed to be the same as the load address.
+.TP
+.B \-\-version
+Print the version number and exit.
.SH EXAMPLE
To download u-boot firmware to a Tegra20 seaboard:
--
1.8.1.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-06-18 4:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-18 3:24 [PATCH] tegrarcm: Add version command Allen Martin
[not found] ` <1371525867-2551-1-git-send-email-amartin-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2013-06-18 3:58 ` Stephen Warren
[not found] ` <51BFDB01.6030606-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-06-18 4:40 ` Allen Martin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox