summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllen Martin <amartin@nvidia.com>2013-05-20 13:39:32 -0700
committerAllen Martin <amartin@nvidia.com>2013-06-17 22:48:35 -0700
commit44025f90a390cb290de3d95370b313826185db43 (patch)
tree89991e92f04b937eb8c33a2148886bb32bf79510
parentf172469db73ef978fb4afd2a77e32cd4c4030a3b (diff)
downloadtegrarcm-44025f90a390cb290de3d95370b313826185db43.tar.gz
tegrarcm: Add version command
Add command line option "--version" that prints the version number and exits. Signed-off-by: Allen Martin <amartin@nvidia.com> Acked-by: Stephen Warren <swarren@nvidia.com>
-rw-r--r--src/main.c11
-rw-r--r--src/tegrarcm.1.in3
2 files changed, 14 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c
index bc81cd2..e3f0d5a 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)
+{
+ printf("%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: