Patchwork [U-Boot] Print compiler and linker version with the version command

login
register
mail settings
Submitter Alexander Holler
Date Jan. 18, 2011, 11:24 p.m.
Message ID <1295393080-6510-1-git-send-email-holler@ahsoftware.de>
Download mbox | patch
Permalink /patch/79376/
State Accepted
Commit 89ffa8dbb5bd0552f5f3399f4430a4c97f4d50d4
Headers show

Comments

Alexander Holler - Jan. 18, 2011, 11:24 p.m.
After years of unsuccessful research I've finally shamelessly stolen other
peoples intellectual properties to present the all-new and world-changing
updated version command:
-
U-Boot>> version

U-Boot 2010.12-00014-g7435056-dirty (Jan 18 2011 - 23:19:38)
MyBoard
gcc (GCC) 0.42 (Distro foobar)
GNU ld (GNU Binutils) 0.314159265
-
May the toolchain bugs rest in peace.

Signed-off-by: Alexander Holler <holler@ahsoftware.de>
---
 Makefile             |    4 ++++
 common/cmd_version.c |    9 ++++++++-
 2 files changed, 12 insertions(+), 1 deletions(-)
Wolfgang Denk - Feb. 2, 2011, 8:56 p.m.
Dear Alexander Holler,

In message <1295393080-6510-1-git-send-email-holler@ahsoftware.de> you wrote:
> After years of unsuccessful research I've finally shamelessly stolen other
> peoples intellectual properties to present the all-new and world-changing
> updated version command:
> -
> U-Boot>> version
> 
> U-Boot 2010.12-00014-g7435056-dirty (Jan 18 2011 - 23:19:38)
> MyBoard
> gcc (GCC) 0.42 (Distro foobar)
> GNU ld (GNU Binutils) 0.314159265
> -
> May the toolchain bugs rest in peace.
> 
> Signed-off-by: Alexander Holler <holler@ahsoftware.de>
> ---
>  Makefile             |    4 ++++
>  common/cmd_version.c |    9 ++++++++-
>  2 files changed, 12 insertions(+), 1 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Patch

diff --git a/Makefile b/Makefile
index 9055028..b434212 100644
--- a/Makefile
+++ b/Makefile
@@ -416,6 +416,10 @@  $(U_BOOT_ONENAND):	$(ONENAND_IPL) $(obj)u-boot.bin
 $(VERSION_FILE):
 		@( printf '#define U_BOOT_VERSION "U-Boot %s%s"\n' "$(U_BOOT_VERSION)" \
 		 '$(shell $(TOPDIR)/tools/setlocalversion $(TOPDIR))' ) > $@.tmp
+		@( printf '#define CC_VERSION_STRING "%s"\n' \
+		 '$(shell $(CC) --version | head -n 1)' )>>  $@.tmp
+		@( printf '#define LD_VERSION_STRING "%s"\n' \
+		 '$(shell $(LD) -v | head -n 1)' )>>  $@.tmp
 		@cmp -s $@ $@.tmp && rm -f $@.tmp || mv -f $@.tmp $@
 
 $(TIMESTAMP_FILE):
diff --git a/common/cmd_version.c b/common/cmd_version.c
index 7d1b495..83cb11c 100644
--- a/common/cmd_version.c
+++ b/common/cmd_version.c
@@ -23,18 +23,25 @@ 
 
 #include <common.h>
 #include <command.h>
+#include <version.h>
 
 extern char version_string[];
 
 int do_version(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
 	printf("\n%s\n", version_string);
+#ifdef CC_VERSION_STRING
+	puts(CC_VERSION_STRING "\n");
+#endif
+#ifdef LD_VERSION_STRING
+	puts(LD_VERSION_STRING "\n");
+#endif
 
 	return 0;
 }
 
 U_BOOT_CMD(
 	version,	1,		1,	do_version,
-	"print monitor version",
+	"print monitor, compiler and linker version",
 	""
 );