Signed-off-by: Wolfgang Denk <w...@denx.de>
---
v2: fix missing argument to printf() call.
v3: explain the magic "+ 7" offset into the version string
v3: avoid offset into U_BOOT_VERSION string completely and define
    a new PLAIN_VERSION variable instead; this has the benefit that it
    can be used in other places as well where such version information
    might be needed (fw_{set,print}env etc. comes to mind).

 Makefile        |    8 ++++++--
 tools/mkimage.c |    6 ++++++
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 05b404d..8721b59 100644
--- a/Makefile
+++ b/Makefile
@@ -414,8 +414,12 @@ $(U_BOOT_ONENAND): $(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' \
diff --git a/tools/mkimage.c b/tools/mkimage.c
index f5859d7..60f7263 100644
--- a/tools/mkimage.c
+++ b/tools/mkimage.c
@@ -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);
 }
-- 
1.7.4

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to