mkimage: add "-V" option to print version information
authorWolfgang Denk <wd@denx.de>
Sat, 12 Feb 2011 09:37:11 +0000 (10:37 +0100)
committerWolfgang Denk <wd@denx.de>
Tue, 12 Apr 2011 20:58:33 +0000 (22:58 +0200)
Signed-off-by: Wolfgang Denk <wd@denx.de>
Makefile
tools/mkimage.c

index 10a856a56246dbdaafd663eb5bbbe45a66fce242..1d571347a2737504a00c2f9c31231da97b5d91b9 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -413,8 +413,12 @@ $(obj)u-boot-onenand.bin:  onenand_ipl $(obj)u-boot.bin
                cat $(ONENAND_BIN) $(obj)u-boot.bin > $(obj)u-boot-onenand.bin
 
 $(VERSION_FILE):
-               @( printf '#define U_BOOT_VERSION "U-Boot %s%s"\n' "$(U_BOOT_VERSION)" \
-                '$(shell $(TOPDIR)/tools/setlocalversion $(TOPDIR))' ) > $@.tmp
+               @( localvers='$(shell $(TOPDIR)/tools/setlocalversion $(TOPDIR))' ; \
+                  printf '#define PLAIN_VERSION "%s%s"\n' \
+                       "$(U_BOOT_VERSION)" "$${localvers}" ; \
+                  printf '#define U_BOOT_VERSION "U-Boot %s%s"\n' \
+                       "$(U_BOOT_VERSION)" "$${localvers}" ; \
+               ) > $@.tmp
                @( printf '#define CC_VERSION_STRING "%s"\n' \
                 '$(shell $(CC) --version | head -n 1)' )>>  $@.tmp
                @( printf '#define LD_VERSION_STRING "%s"\n' \
index f5859d77642152a78751d4b7ce79255c485e6e5b..60f726303c4f356b4873b4b148f7ebc15f4024f9 100644 (file)
@@ -23,6 +23,7 @@
 
 #include "mkimage.h"
 #include <image.h>
+#include <version.h>
 
 static void copy_file(int, const char *, int);
 static void usage(void);
@@ -246,6 +247,9 @@ main (int argc, char **argv)
                        case 'v':
                                params.vflag++;
                                break;
+                       case 'V':
+                               printf("mkimage version %s\n", PLAIN_VERSION);
+                               exit(EXIT_SUCCESS);
                        case 'x':
                                params.xflag++;
                                break;
@@ -590,6 +594,8 @@ usage ()
                params.cmdname);
        fprintf (stderr, "       %s [-D dtc_options] -f fit-image.its fit-image\n",
                params.cmdname);
+       fprintf (stderr, "       %s -V ==> print version information and exit\n",
+               params.cmdname);
 
        exit (EXIT_FAILURE);
 }