diff mbox

[U-Boot,PATCH/RFC] unify version_string

Message ID 1308905261-3780-1-git-send-email-andreas.devel@googlemail.com
State Superseded
Headers show

Commit Message

Andreas Bießmann June 24, 2011, 8:47 a.m. UTC
This patch deletes the arch specific definitions of version_string in
favour of a single one in cmd_version module (which is always compiled
in).

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
CC: Mike Frysinger <vapier@gentoo.org>
CC: Peter Pan <pppeterpppan@gmail.com>
---
This is an RFC as discussed in
http://mid.gmane.org/201106162022.09802.vapier@gentoo.org

Dear Peter Pan,

I think it would be best to base your changes to remove
timestamp on this patch (or some modified version of it)

regards

Andreas Bießmann

 arch/arm/lib/board.c              |    8 --------
 arch/avr32/lib/board.c            |    4 ----
 arch/blackfin/lib/board.c         |    3 ---
 arch/m68k/cpu/mcf5227x/start.S    |   10 ----------
 arch/m68k/cpu/mcf523x/start.S     |   10 ----------
 arch/m68k/cpu/mcf52x2/start.S     |   10 ----------
 arch/m68k/cpu/mcf532x/start.S     |    9 ---------
 arch/m68k/cpu/mcf5445x/start.S    |   10 ----------
 arch/m68k/cpu/mcf547x_8x/start.S  |   10 ----------
 arch/microblaze/lib/board.c       |    3 ---
 arch/mips/lib/board.c             |    4 ----
 arch/nios2/cpu/start.S            |   13 -------------
 arch/powerpc/cpu/74xx_7xx/start.S |   10 ----------
 arch/powerpc/cpu/mpc512x/start.S  |   10 ----------
 arch/powerpc/cpu/mpc5xx/start.S   |   10 ----------
 arch/powerpc/cpu/mpc5xxx/start.S  |   15 ---------------
 arch/powerpc/cpu/mpc8220/start.S  |   15 ---------------
 arch/powerpc/cpu/mpc824x/start.S  |   10 ----------
 arch/powerpc/cpu/mpc8260/start.S  |   19 -------------------
 arch/powerpc/cpu/mpc83xx/start.S  |   11 -----------
 arch/powerpc/cpu/mpc85xx/start.S  |   10 ----------
 arch/powerpc/cpu/mpc86xx/start.S  |   10 ----------
 arch/powerpc/cpu/mpc8xx/start.S   |   10 ----------
 arch/powerpc/cpu/mpc8xx/video.c   |    1 -
 arch/powerpc/cpu/ppc4xx/start.S   |   10 ----------
 arch/sh/lib/board.c               |    3 ---
 arch/sparc/cpu/leon2/start.S      |   11 -----------
 arch/sparc/cpu/leon3/start.S      |    9 ---------
 arch/x86/lib/board.c              |    4 ----
 common/cmd_version.c              |    8 +++++++-
 include/version.h                 |    2 ++
 31 files changed, 9 insertions(+), 263 deletions(-)

Comments

Wolfgang Denk June 24, 2011, 12:18 p.m. UTC | #1
Dear =?UTF-8?q?Andreas=20Bie=C3=9Fmann?=,

In message <1308905261-3780-1-git-send-email-andreas.devel@googlemail.com> you wrote:
> This patch deletes the arch specific definitions of version_string in
> favour of a single one in cmd_version module (which is always compiled
> in).
> 
> Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
> CC: Mike Frysinger <vapier@gentoo.org>
> CC: Peter Pan <pppeterpppan@gmail.com>
> ---
> This is an RFC as discussed in
> http://mid.gmane.org/201106162022.09802.vapier@gentoo.org

Sorry, but NAK.  The idea is good, but the implementation is serioulsy
flawed.

...
> diff --git a/arch/powerpc/cpu/74xx_7xx/start.S b/arch/powerpc/cpu/74xx_7xx/start.S
> index f6011fc..5fea39d 100644
> --- a/arch/powerpc/cpu/74xx_7xx/start.S
> +++ b/arch/powerpc/cpu/74xx_7xx/start.S
...
>  	.text
>  	.long	0x27051956		/* U-Boot Magic Number		*/
> -	.globl	version_string
> -version_string:
> -	.ascii	U_BOOT_VERSION
> -	.ascii	" (", U_BOOT_DATE, " - ", U_BOOT_TIME, ")"
> -	.ascii	CONFIG_IDENT_STRING, "\0"

On PowerPC systems, the core is carefully consructed such that the
U-Boot image starts with the magic number, followed immediately by
the version string. That means, you can trivially identify any binary
image, be it as file on the host or on the target, or programmed into
flash, but just dumping the first bytes of it, for example:

On the host:

-> xd /tftpboot/tqm8560/u-boot.bin | head -5
       0  27051956 552d426f  6f742032 3031302e  |'  VU-Boot 2010.|
      10  31322d30 30313439  2d673662 31656632  |12-00149-g6b1ef2|
      20  612d6469 72747920  284d6179 20303420  |a-dirty (May 04 |
      30  32303131 202d2032  333a3439 3a343929  |2011 - 23:49:49)|
      40  00000000 00000000  00000000 00000000  |                |

On the target:

=> md FFFC0000 14
fffc0000: 27051956 552d426f 6f742032 3031302e    '..VU-Boot 2010.
fffc0010: 31322d30 30313439 2d673662 31656632    12-00149-g6b1ef2
fffc0020: 612d6469 72747920 284d6179 20303420    a-dirty (May 04 
fffc0030: 32303131 202d2032 333a3439 3a343929    2011 - 23:49:49)
fffc0040: 00000000 00000000 00000000 00000000    ................


I consider this a very useful property and am not willing to give it
up.

Best regards,

Wolfgang Denk
Mike Frysinger June 24, 2011, 5:43 p.m. UTC | #2
On Fri, Jun 24, 2011 at 08:18, Wolfgang Denk wrote:
>> --- a/arch/powerpc/cpu/74xx_7xx/start.S
>> +++ b/arch/powerpc/cpu/74xx_7xx/start.S
> ...
>>       .text
>>       .long   0x27051956              /* U-Boot Magic Number          */
>> -     .globl  version_string
>> -version_string:
>> -     .ascii  U_BOOT_VERSION
>> -     .ascii  " (", U_BOOT_DATE, " - ", U_BOOT_TIME, ")"
>> -     .ascii  CONFIG_IDENT_STRING, "\0"
>
> On PowerPC systems, the core is carefully consructed such that the
> U-Boot image starts with the magic number, followed immediately by
> the version string. That means, you can trivially identify any binary
> image, be it as file on the host or on the target, or programmed into
> flash, but just dumping the first bytes of it, for example:

cant you do this with a linker script update ?
-mike
Andreas Bießmann June 24, 2011, 7:48 p.m. UTC | #3
Dear Mike Freysinger,

Am 24.06.2011 um 19:43 schrieb Mike Frysinger:

> On Fri, Jun 24, 2011 at 08:18, Wolfgang Denk wrote:
>>> --- a/arch/powerpc/cpu/74xx_7xx/start.S
>>> +++ b/arch/powerpc/cpu/74xx_7xx/start.S
>> ...
>>>       .text
>>>       .long   0x27051956              /* U-Boot Magic Number          */
>>> -     .globl  version_string
>>> -version_string:
>>> -     .ascii  U_BOOT_VERSION
>>> -     .ascii  " (", U_BOOT_DATE, " - ", U_BOOT_TIME, ")"
>>> -     .ascii  CONFIG_IDENT_STRING, "\0"
>> 
>> On PowerPC systems, the core is carefully consructed such that the
>> U-Boot image starts with the magic number, followed immediately by
>> the version string. That means, you can trivially identify any binary
>> image, be it as file on the host or on the target, or programmed into
>> flash, but just dumping the first bytes of it, for example:
> 
> cant you do this with a linker script update ?


that would be great. But I need help for that cause I do not have a ppc toolchain nor a ppc target to test it.

Some thoughts about a link time solution:
We need a blob containing just the version_string, another blob
containing the ppc magic number and some linker tweaks to get them both placed before the start.S stuff.
Then we need also some make-level distinction to have the version_string blob in some common library
for all other architectures.

regards

Andreas Bießmann
Wolfgang Denk June 24, 2011, 8:07 p.m. UTC | #4
Dear Mike Frysinger,

In message <BANLkTim-gWWs+5ktKPTR+08uoQM-oZuwEw@mail.gmail.com> you wrote:
>
> > On PowerPC systems, the core is carefully consructed such that the

s/core/code/, s/consructed/constructed/

> > U-Boot image starts with the magic number, followed immediately by
> > the version string. That means, you can trivially identify any binary
> > image, be it as file on the host or on the target, or programmed into
> > flash, but just dumping the first bytes of it, for example:
> 
> cant you do this with a linker script update ?

Insert strings in the middle of code?  Sonds more complicated that
what it's worth.

I don't see the real problem.  I mean, we can provide the definition
of the string in some common header file, and then just use it where
needed.

Best regards,

Wolfgang Denk
Wolfgang Denk June 24, 2011, 8:10 p.m. UTC | #5
Dear =?iso-8859-1?Q?Andreas_Bie=DFmann?=,

In message <7A8565DE-76B0-43A8-9BCD-167B2D117650@googlemail.com> you wrote:
> 
> We need a blob containing just the version_string, another blob
> containing the ppc magic number and some linker tweaks to get them both
> placed before the start.S stuff.
> Then we need also some make-level distinction to have the version_string
> blob in some common library
> for all other architectures.

A lot of effort just to insert a simple string. This doesn't make
sense to me.  Leave the code as is, and just move the definition of
the string to a common place.

Best regards,

Wolfgang Denk
Mike Frysinger June 24, 2011, 8:52 p.m. UTC | #6
On Fri, Jun 24, 2011 at 16:07, Wolfgang Denk wrote:
> Mike Frysinger wrote:
>> > U-Boot image starts with the magic number, followed immediately by
>> > the version string. That means, you can trivially identify any binary
>> > image, be it as file on the host or on the target, or programmed into
>> > flash, but just dumping the first bytes of it, for example:
>>
>> cant you do this with a linker script update ?
>
> Insert strings in the middle of code?

you arent inserting it into the middle of code, you're inserting it at
the head of the link.  should be pretty easy to do.  atm, you're
relying on the start.S file always producing code as laid out in the
file, and the linker picking up start.o first.

> I don't see the real problem.  I mean, we can provide the definition
> of the string in some common header file, and then just use it where
> needed.

cmd_version.c could still have a common version_string definition and
mark it weak.  then any arches doing whatever crazy thing they want
can override it with a non-weak symbol.
-mike
diff mbox

Patch

diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c
index 169dfeb..2401a04 100644
--- a/arch/arm/lib/board.c
+++ b/arch/arm/lib/board.c
@@ -42,7 +42,6 @@ 
 #include <command.h>
 #include <malloc.h>
 #include <stdio_dev.h>
-#include <timestamp.h>
 #include <version.h>
 #include <net.h>
 #include <serial.h>
@@ -70,13 +69,6 @@  extern int  AT91F_DataflashInit(void);
 extern void dataflash_print_info(void);
 #endif
 
-#ifndef CONFIG_IDENT_STRING
-#define CONFIG_IDENT_STRING ""
-#endif
-
-const char version_string[] =
-	U_BOOT_VERSION" (" U_BOOT_DATE " - " U_BOOT_TIME ")"CONFIG_IDENT_STRING;
-
 #ifdef CONFIG_DRIVER_RTL8019
 extern void rtl8019_get_enetaddr (uchar * addr);
 #endif
diff --git a/arch/avr32/lib/board.c b/arch/avr32/lib/board.c
index 5edef8f..e69f8d1 100644
--- a/arch/avr32/lib/board.c
+++ b/arch/avr32/lib/board.c
@@ -23,7 +23,6 @@ 
 #include <command.h>
 #include <malloc.h>
 #include <stdio_dev.h>
-#include <timestamp.h>
 #include <version.h>
 #include <net.h>
 
@@ -41,9 +40,6 @@ 
 
 DECLARE_GLOBAL_DATA_PTR;
 
-const char version_string[] =
-	U_BOOT_VERSION " ("U_BOOT_DATE" - "U_BOOT_TIME") " CONFIG_IDENT_STRING;
-
 unsigned long monitor_flash_len;
 
 /* Weak aliases for optional board functions */
diff --git a/arch/blackfin/lib/board.c b/arch/blackfin/lib/board.c
index 362b8c4..7c33893 100644
--- a/arch/blackfin/lib/board.c
+++ b/arch/blackfin/lib/board.c
@@ -16,7 +16,6 @@ 
 #include <malloc.h>
 #include <mmc.h>
 #include <net.h>
-#include <timestamp.h>
 #include <status_led.h>
 #include <version.h>
 
@@ -39,8 +38,6 @@  int post_flag;
 
 DECLARE_GLOBAL_DATA_PTR;
 
-const char version_string[] = U_BOOT_VERSION " ("U_BOOT_DATE" - "U_BOOT_TIME")";
-
 __attribute__((always_inline))
 static inline void serial_early_puts(const char *s)
 {
diff --git a/arch/m68k/cpu/mcf5227x/start.S b/arch/m68k/cpu/mcf5227x/start.S
index d09d492..5740f94 100644
--- a/arch/m68k/cpu/mcf5227x/start.S
+++ b/arch/m68k/cpu/mcf5227x/start.S
@@ -23,7 +23,6 @@ 
 
 #include <asm-offsets.h>
 #include <config.h>
-#include <timestamp.h>
 #include "version.h"
 #include <asm/cache.h>
 
@@ -503,12 +502,3 @@  _int_handler:
 	bsr int_handler
 	addql	#4,%sp
 	RESTORE_ALL
-
-/*------------------------------------------------------------------------------*/
-
-	.globl	version_string
-version_string:
-	.ascii U_BOOT_VERSION
-	.ascii " (", U_BOOT_DATE, " - ", U_BOOT_TIME, ")"
-	.ascii CONFIG_IDENT_STRING, "\0"
-	.align 4
diff --git a/arch/m68k/cpu/mcf523x/start.S b/arch/m68k/cpu/mcf523x/start.S
index a726b59..1df0082 100644
--- a/arch/m68k/cpu/mcf523x/start.S
+++ b/arch/m68k/cpu/mcf523x/start.S
@@ -23,7 +23,6 @@ 
 
 #include <asm-offsets.h>
 #include <config.h>
-#include <timestamp.h>
 #include "version.h"
 #include <asm/cache.h>
 
@@ -265,12 +264,3 @@  _int_handler:
 	bsr int_handler
 	addql	#4,%sp
 	RESTORE_ALL
-
-/*------------------------------------------------------------------------------*/
-
-	.globl	version_string
-version_string:
-	.ascii U_BOOT_VERSION
-	.ascii " (", U_BOOT_DATE, " - ", U_BOOT_TIME, ")"
-	.ascii CONFIG_IDENT_STRING, "\0"
-	.align 4
diff --git a/arch/m68k/cpu/mcf52x2/start.S b/arch/m68k/cpu/mcf52x2/start.S
index f0cfa6f..70d6800 100644
--- a/arch/m68k/cpu/mcf52x2/start.S
+++ b/arch/m68k/cpu/mcf52x2/start.S
@@ -23,7 +23,6 @@ 
 
 #include <asm-offsets.h>
 #include <config.h>
-#include <timestamp.h>
 #include "version.h"
 #include <asm/cache.h>
 
@@ -325,12 +324,3 @@  _int_handler:
 	bsr int_handler
 	addql	#4,%sp
 	RESTORE_ALL
-
-/*------------------------------------------------------------------------------*/
-
-	.globl	version_string
-version_string:
-	.ascii U_BOOT_VERSION
-	.ascii " (", U_BOOT_DATE, " - ", U_BOOT_TIME, ")"
-	.ascii CONFIG_IDENT_STRING, "\0"
-	.align 4
diff --git a/arch/m68k/cpu/mcf532x/start.S b/arch/m68k/cpu/mcf532x/start.S
index 53ac471..a196c31 100644
--- a/arch/m68k/cpu/mcf532x/start.S
+++ b/arch/m68k/cpu/mcf532x/start.S
@@ -26,7 +26,6 @@ 
 
 #include <asm-offsets.h>
 #include <config.h>
-#include <timestamp.h>
 #include "version.h"
 #include <asm/cache.h>
 
@@ -279,11 +278,3 @@  _int_handler:
 	bsr int_handler
 	addql	#4,%sp
 	RESTORE_ALL
-
-/*------------------------------------------------------------------------------*/
-	.globl	version_string
-version_string:
-	.ascii U_BOOT_VERSION
-	.ascii " (", U_BOOT_DATE, " - ", U_BOOT_TIME, ")"
-	.ascii CONFIG_IDENT_STRING, "\0"
-	.align 4
diff --git a/arch/m68k/cpu/mcf5445x/start.S b/arch/m68k/cpu/mcf5445x/start.S
index 5255f37..424f94f 100644
--- a/arch/m68k/cpu/mcf5445x/start.S
+++ b/arch/m68k/cpu/mcf5445x/start.S
@@ -23,7 +23,6 @@ 
 
 #include <asm-offsets.h>
 #include <config.h>
-#include <timestamp.h>
 #include "version.h"
 #include <asm/cache.h>
 
@@ -535,12 +534,3 @@  _int_handler:
 	bsr int_handler
 	addql	#4,%sp
 	RESTORE_ALL
-
-/*------------------------------------------------------------------------------*/
-
-	.globl	version_string
-version_string:
-	.ascii U_BOOT_VERSION
-	.ascii " (", U_BOOT_DATE, " - ", U_BOOT_TIME, ")"
-	.ascii CONFIG_IDENT_STRING, "\0"
-	.align 4
diff --git a/arch/m68k/cpu/mcf547x_8x/start.S b/arch/m68k/cpu/mcf547x_8x/start.S
index e30923f..c5a9346 100644
--- a/arch/m68k/cpu/mcf547x_8x/start.S
+++ b/arch/m68k/cpu/mcf547x_8x/start.S
@@ -23,7 +23,6 @@ 
 
 #include <asm-offsets.h>
 #include <config.h>
-#include <timestamp.h>
 #include "version.h"
 #include <asm/cache.h>
 
@@ -272,12 +271,3 @@  _int_handler:
 	bsr int_handler
 	addql	#4,%sp
 	RESTORE_ALL
-
-/*------------------------------------------------------------------------------*/
-
-	.globl	version_string
-version_string:
-	.ascii U_BOOT_VERSION
-	.ascii " (", U_BOOT_DATE, " - ", U_BOOT_TIME, ")"
-	.ascii CONFIG_IDENT_STRING, "\0"
-	.align 4
diff --git a/arch/microblaze/lib/board.c b/arch/microblaze/lib/board.c
index c5f7ac4..d97543b 100644
--- a/arch/microblaze/lib/board.c
+++ b/arch/microblaze/lib/board.c
@@ -27,7 +27,6 @@ 
 #include <common.h>
 #include <command.h>
 #include <malloc.h>
-#include <timestamp.h>
 #include <version.h>
 #include <watchdog.h>
 #include <stdio_dev.h>
@@ -35,8 +34,6 @@ 
 
 DECLARE_GLOBAL_DATA_PTR;
 
-const char version_string[] = U_BOOT_VERSION " ("U_BOOT_DATE" - "U_BOOT_TIME")";
-
 #ifdef CONFIG_SYS_GPIO_0
 extern int gpio_init (void);
 #endif
diff --git a/arch/mips/lib/board.c b/arch/mips/lib/board.c
index 623c4d7..4f85bbd 100644
--- a/arch/mips/lib/board.c
+++ b/arch/mips/lib/board.c
@@ -25,7 +25,6 @@ 
 #include <command.h>
 #include <malloc.h>
 #include <stdio_dev.h>
-#include <timestamp.h>
 #include <version.h>
 #include <net.h>
 #include <environment.h>
@@ -50,9 +49,6 @@  extern ulong uboot_end;
 
 ulong monitor_flash_len;
 
-const char version_string[] =
-	U_BOOT_VERSION" (" U_BOOT_DATE " - " U_BOOT_TIME ")";
-
 static char *failed = "*** failed ***\n";
 
 /*
diff --git a/arch/nios2/cpu/start.S b/arch/nios2/cpu/start.S
index bf5d672..411c8b2 100644
--- a/arch/nios2/cpu/start.S
+++ b/arch/nios2/cpu/start.S
@@ -23,7 +23,6 @@ 
 
 #include <asm-offsets.h>
 #include <config.h>
-#include <timestamp.h>
 #include <version.h>
 
 /*************************************************************************
@@ -195,15 +194,3 @@  dly_clks:
 #endif
 	bge	r4, r0, dly_clks
 	ret
-
-
-#if !defined(CONFIG_IDENT_STRING)
-#define CONFIG_IDENT_STRING ""
-#endif
-	.data
-	.globl	version_string
-
-version_string:
-	.ascii U_BOOT_VERSION
-	.ascii " (", U_BOOT_DATE, " - ", U_BOOT_TIME, ")"
-	.ascii CONFIG_IDENT_STRING, "\0"
diff --git a/arch/powerpc/cpu/74xx_7xx/start.S b/arch/powerpc/cpu/74xx_7xx/start.S
index f6011fc..5fea39d 100644
--- a/arch/powerpc/cpu/74xx_7xx/start.S
+++ b/arch/powerpc/cpu/74xx_7xx/start.S
@@ -35,7 +35,6 @@ 
 #include <asm-offsets.h>
 #include <config.h>
 #include <74xx_7xx.h>
-#include <timestamp.h>
 #include <version.h>
 
 #include <ppc_asm.tmpl>
@@ -52,10 +51,6 @@ 
 #include <galileo/gt64260R.h>
 #endif
 
-#ifndef  CONFIG_IDENT_STRING
-#define  CONFIG_IDENT_STRING ""
-#endif
-
 /* We don't want the  MMU yet.
 */
 #undef	MSR_KERNEL
@@ -87,11 +82,6 @@ 
  */
 	.text
 	.long	0x27051956		/* U-Boot Magic Number		*/
-	.globl	version_string
-version_string:
-	.ascii	U_BOOT_VERSION
-	.ascii	" (", U_BOOT_DATE, " - ", U_BOOT_TIME, ")"
-	.ascii	CONFIG_IDENT_STRING, "\0"
 
 	. = EXC_OFF_SYS_RESET
 	.globl	_start
diff --git a/arch/powerpc/cpu/mpc512x/start.S b/arch/powerpc/cpu/mpc512x/start.S
index 9c2e488..a275cf3 100644
--- a/arch/powerpc/cpu/mpc512x/start.S
+++ b/arch/powerpc/cpu/mpc512x/start.S
@@ -31,7 +31,6 @@ 
 
 #include <asm-offsets.h>
 #include <config.h>
-#include <timestamp.h>
 #include <version.h>
 
 #define CONFIG_521X	1		/* needed for Linux kernel header files*/
@@ -46,10 +45,6 @@ 
 #include <asm/mmu.h>
 #include <asm/u-boot.h>
 
-#ifndef  CONFIG_IDENT_STRING
-#define  CONFIG_IDENT_STRING "MPC512X"
-#endif
-
 /*
  * Floating Point enable, Machine Check and Recoverable Interr.
  */
@@ -87,11 +82,6 @@ 
  * Magic number and version string
  */
 	.long	0x27051956		/* U-Boot Magic Number */
-	.globl	version_string
-version_string:
-	.ascii U_BOOT_VERSION
-	.ascii " (", U_BOOT_DATE, " - ", U_BOOT_TIME, ")"
-	.ascii " ", CONFIG_IDENT_STRING, "\0"
 
 /*
  * Vector Table
diff --git a/arch/powerpc/cpu/mpc5xx/start.S b/arch/powerpc/cpu/mpc5xx/start.S
index cc11c8f..c83d8b1 100644
--- a/arch/powerpc/cpu/mpc5xx/start.S
+++ b/arch/powerpc/cpu/mpc5xx/start.S
@@ -33,7 +33,6 @@ 
 #include <asm-offsets.h>
 #include <config.h>
 #include <mpc5xx.h>
-#include <timestamp.h>
 #include <version.h>
 
 #define CONFIG_5xx 1		/* needed for Linux kernel header files */
@@ -46,10 +45,6 @@ 
 #include <asm/processor.h>
 #include <asm/u-boot.h>
 
-#ifndef  CONFIG_IDENT_STRING
-#define  CONFIG_IDENT_STRING ""
-#endif
-
 /* We don't have a MMU.
 */
 #undef	MSR_KERNEL
@@ -80,11 +75,6 @@ 
  */
 	.text
 	.long	0x27051956			/* U-Boot Magic Number */
-	.globl	version_string
-version_string:
-	.ascii U_BOOT_VERSION
-	.ascii " (", U_BOOT_DATE, " - ", U_BOOT_TIME, ")"
-	.ascii CONFIG_IDENT_STRING, "\0"
 
 	. = EXC_OFF_SYS_RESET
 	.globl	_start
diff --git a/arch/powerpc/cpu/mpc5xxx/start.S b/arch/powerpc/cpu/mpc5xxx/start.S
index 192aa50..2adba06 100644
--- a/arch/powerpc/cpu/mpc5xxx/start.S
+++ b/arch/powerpc/cpu/mpc5xxx/start.S
@@ -28,7 +28,6 @@ 
 #include <asm-offsets.h>
 #include <config.h>
 #include <mpc5xxx.h>
-#include <timestamp.h>
 #include <version.h>
 
 #define CONFIG_MPC5xxx 1	/* needed for Linux kernel header files */
@@ -41,10 +40,6 @@ 
 #include <asm/mmu.h>
 #include <asm/u-boot.h>
 
-#ifndef  CONFIG_IDENT_STRING
-#define  CONFIG_IDENT_STRING ""
-#endif
-
 /* We don't want the  MMU yet.
 */
 #undef	MSR_KERNEL
@@ -75,16 +70,6 @@ 
 	END_GOT
 
 /*
- * Version string
- */
-	.data
-	.globl	version_string
-version_string:
-	.ascii U_BOOT_VERSION
-	.ascii " (", U_BOOT_DATE, " - ", U_BOOT_TIME, ")"
-	.ascii CONFIG_IDENT_STRING, "\0"
-
-/*
  * Exception vectors
  */
 	.text
diff --git a/arch/powerpc/cpu/mpc8220/start.S b/arch/powerpc/cpu/mpc8220/start.S
index 300b35c..9f41c5b 100644
--- a/arch/powerpc/cpu/mpc8220/start.S
+++ b/arch/powerpc/cpu/mpc8220/start.S
@@ -28,7 +28,6 @@ 
 #include <asm-offsets.h>
 #include <config.h>
 #include <mpc8220.h>
-#include <timestamp.h>
 #include <version.h>
 
 #define _LINUX_CONFIG_H 1   /* avoid reading Linux autoconf.h file  */
@@ -40,10 +39,6 @@ 
 #include <asm/mmu.h>
 #include <asm/u-boot.h>
 
-#ifndef	 CONFIG_IDENT_STRING
-#define	 CONFIG_IDENT_STRING ""
-#endif
-
 /* We don't want the  MMU yet.
 */
 #undef	MSR_KERNEL
@@ -74,16 +69,6 @@ 
 	END_GOT
 
 /*
- * Version string
- */
-	.data
-	.globl	version_string
-version_string:
-	.ascii U_BOOT_VERSION
-	.ascii " (", U_BOOT_DATE, " - ", U_BOOT_TIME, ")"
-	.ascii CONFIG_IDENT_STRING, "\0"
-
-/*
  * Exception vectors
  */
 	.text
diff --git a/arch/powerpc/cpu/mpc824x/start.S b/arch/powerpc/cpu/mpc824x/start.S
index fc4e922..84bd2ce 100644
--- a/arch/powerpc/cpu/mpc824x/start.S
+++ b/arch/powerpc/cpu/mpc824x/start.S
@@ -40,7 +40,6 @@ 
 #include <asm-offsets.h>
 #include <config.h>
 #include <mpc824x.h>
-#include <timestamp.h>
 #include <version.h>
 
 #define _LINUX_CONFIG_H 1	/* avoid reading Linux autoconf.h file	*/
@@ -52,10 +51,6 @@ 
 #include <asm/mmu.h>
 #include <asm/u-boot.h>
 
-#ifndef CONFIG_IDENT_STRING
-#define CONFIG_IDENT_STRING ""
-#endif
-
 /* We don't want the MMU yet.
 */
 #undef	MSR_KERNEL
@@ -90,11 +85,6 @@ 
  */
 	.text
 	.long	0x27051956		/* U-Boot Magic Number			*/
-	.globl	version_string
-version_string:
-	.ascii U_BOOT_VERSION
-	.ascii " (", U_BOOT_DATE, " - ", U_BOOT_TIME, ")"
-	.ascii CONFIG_IDENT_STRING, "\0"
 
 	. = EXC_OFF_SYS_RESET
 	.globl	_start
diff --git a/arch/powerpc/cpu/mpc8260/start.S b/arch/powerpc/cpu/mpc8260/start.S
index 702546e..a7b58ab 100644
--- a/arch/powerpc/cpu/mpc8260/start.S
+++ b/arch/powerpc/cpu/mpc8260/start.S
@@ -28,7 +28,6 @@ 
 #include <asm-offsets.h>
 #include <config.h>
 #include <mpc8260.h>
-#include <timestamp.h>
 #include <version.h>
 
 #define CONFIG_8260 1		/* needed for Linux kernel header files */
@@ -41,10 +40,6 @@ 
 #include <asm/mmu.h>
 #include <asm/u-boot.h>
 
-#ifndef  CONFIG_IDENT_STRING
-#define  CONFIG_IDENT_STRING ""
-#endif
-
 /* We don't want the  MMU yet.
 */
 #undef	MSR_KERNEL
@@ -78,20 +73,6 @@ 
 	END_GOT
 
 /*
- * Version string - must be in data segment because MPC8260 uses the first
- * 256 bytes for the Hard Reset Configuration Word table (see below).
- * Similarly, can't have the U-Boot Magic Number as the first thing in
- * the image - don't know how this will affect the image tools, but I guess
- * I'll find out soon
- */
-	.data
-	.globl	version_string
-version_string:
-	.ascii U_BOOT_VERSION
-	.ascii " (", U_BOOT_DATE, " - ", U_BOOT_TIME, ")"
-	.ascii CONFIG_IDENT_STRING, "\0"
-
-/*
  *  Hard Reset Configuration Word (HRCW) table
  *
  *  The Hard Reset Configuration Word (HRCW) sets a number of useful things
diff --git a/arch/powerpc/cpu/mpc83xx/start.S b/arch/powerpc/cpu/mpc83xx/start.S
index 7e60315..ed4eb36 100644
--- a/arch/powerpc/cpu/mpc83xx/start.S
+++ b/arch/powerpc/cpu/mpc83xx/start.S
@@ -30,7 +30,6 @@ 
 #include <asm-offsets.h>
 #include <config.h>
 #include <mpc83xx.h>
-#include <timestamp.h>
 #include <version.h>
 
 #define CONFIG_83XX	1		/* needed for Linux kernel header files*/
@@ -43,10 +42,6 @@ 
 #include <asm/mmu.h>
 #include <asm/u-boot.h>
 
-#ifndef  CONFIG_IDENT_STRING
-#define  CONFIG_IDENT_STRING "MPC83XX"
-#endif
-
 /* We don't want the  MMU yet.
  */
 #undef	MSR_KERNEL
@@ -105,12 +100,6 @@ 
  */
 	.long	0x27051956		/* U-Boot Magic Number */
 
-	.globl	version_string
-version_string:
-	.ascii U_BOOT_VERSION
-	.ascii " (", U_BOOT_DATE, " - ", U_BOOT_TIME, ")"
-	.ascii " ", CONFIG_IDENT_STRING, "\0"
-
 	.align 2
 
 	.globl enable_addr_trans
diff --git a/arch/powerpc/cpu/mpc85xx/start.S b/arch/powerpc/cpu/mpc85xx/start.S
index 5777493..b0e9670 100644
--- a/arch/powerpc/cpu/mpc85xx/start.S
+++ b/arch/powerpc/cpu/mpc85xx/start.S
@@ -31,7 +31,6 @@ 
 #include <asm-offsets.h>
 #include <config.h>
 #include <mpc85xx.h>
-#include <timestamp.h>
 #include <version.h>
 
 #define _LINUX_CONFIG_H 1	/* avoid reading Linux autoconf.h file	*/
@@ -42,10 +41,6 @@ 
 #include <asm/cache.h>
 #include <asm/mmu.h>
 
-#ifndef	 CONFIG_IDENT_STRING
-#define	 CONFIG_IDENT_STRING ""
-#endif
-
 #undef	MSR_KERNEL
 #define MSR_KERNEL ( MSR_ME )	/* Machine Check */
 
@@ -397,11 +392,6 @@  switch_as:
 	.globl	_start
 _start:
 	.long	0x27051956		/* U-BOOT Magic Number */
-	.globl	version_string
-version_string:
-	.ascii U_BOOT_VERSION
-	.ascii " (", U_BOOT_DATE, " - ", U_BOOT_TIME, ")"
-	.ascii CONFIG_IDENT_STRING, "\0"
 
 	.align	4
 	.globl	_start_cont
diff --git a/arch/powerpc/cpu/mpc86xx/start.S b/arch/powerpc/cpu/mpc86xx/start.S
index 3e3c21e..7c521f0 100644
--- a/arch/powerpc/cpu/mpc86xx/start.S
+++ b/arch/powerpc/cpu/mpc86xx/start.S
@@ -33,7 +33,6 @@ 
 #include <asm-offsets.h>
 #include <config.h>
 #include <mpc86xx.h>
-#include <timestamp.h>
 #include <version.h>
 
 #include <ppc_asm.tmpl>
@@ -43,10 +42,6 @@ 
 #include <asm/mmu.h>
 #include <asm/u-boot.h>
 
-#ifndef	CONFIG_IDENT_STRING
-#define CONFIG_IDENT_STRING ""
-#endif
-
 /*
  * Need MSR_DR | MSR_IR enabled to access I/O (printf) in exceptions
  */
@@ -76,11 +71,6 @@ 
  */
 	.text
 	.long	0x27051956		/* U-Boot Magic Number */
-	.globl	version_string
-version_string:
-	.ascii	U_BOOT_VERSION
-	.ascii	" (", U_BOOT_DATE, " - ", U_BOOT_TIME, ")"
-	.ascii	CONFIG_IDENT_STRING, "\0"
 
 	. = EXC_OFF_SYS_RESET
 	.globl	_start
diff --git a/arch/powerpc/cpu/mpc8xx/start.S b/arch/powerpc/cpu/mpc8xx/start.S
index fe3daa2..63444eb 100644
--- a/arch/powerpc/cpu/mpc8xx/start.S
+++ b/arch/powerpc/cpu/mpc8xx/start.S
@@ -40,7 +40,6 @@ 
 #include <asm-offsets.h>
 #include <config.h>
 #include <mpc8xx.h>
-#include <timestamp.h>
 #include <version.h>
 
 #define CONFIG_8xx 1		/* needed for Linux kernel header files */
@@ -53,10 +52,6 @@ 
 #include <asm/mmu.h>
 #include <asm/u-boot.h>
 
-#ifndef  CONFIG_IDENT_STRING
-#define  CONFIG_IDENT_STRING ""
-#endif
-
 /* We don't want the  MMU yet.
 */
 #undef	MSR_KERNEL
@@ -87,11 +82,6 @@ 
  */
 	.text
 	.long	0x27051956		/* U-Boot Magic Number			*/
-	.globl	version_string
-version_string:
-	.ascii U_BOOT_VERSION
-	.ascii " (", U_BOOT_DATE, " - ", U_BOOT_TIME, ")"
-	.ascii CONFIG_IDENT_STRING, "\0"
 
 	. = EXC_OFF_SYS_RESET
 	.globl	_start
diff --git a/arch/powerpc/cpu/mpc8xx/video.c b/arch/powerpc/cpu/mpc8xx/video.c
index c79c499..7725c67 100644
--- a/arch/powerpc/cpu/mpc8xx/video.c
+++ b/arch/powerpc/cpu/mpc8xx/video.c
@@ -33,7 +33,6 @@ 
 #include <common.h>
 #include <config.h>
 #include <version.h>
-#include <timestamp.h>
 #include <i2c.h>
 #include <linux/types.h>
 #include <stdio_dev.h>
diff --git a/arch/powerpc/cpu/ppc4xx/start.S b/arch/powerpc/cpu/ppc4xx/start.S
index b43e22c..6de8b00 100644
--- a/arch/powerpc/cpu/ppc4xx/start.S
+++ b/arch/powerpc/cpu/ppc4xx/start.S
@@ -68,7 +68,6 @@ 
 #include <asm-offsets.h>
 #include <config.h>
 #include <asm/ppc4xx.h>
-#include <timestamp.h>
 #include <version.h>
 
 #define _LINUX_CONFIG_H 1	/* avoid reading Linux autoconf.h file	*/
@@ -80,10 +79,6 @@ 
 #include <asm/mmu.h>
 #include <asm/ppc4xx-isram.h>
 
-#ifndef	 CONFIG_IDENT_STRING
-#define	 CONFIG_IDENT_STRING ""
-#endif
-
 #ifdef CONFIG_SYS_INIT_DCACHE_CS
 # if (CONFIG_SYS_INIT_DCACHE_CS == 0)
 #  define PBxAP PB1AP
@@ -547,11 +542,6 @@  tlbnx2:	addi	r4,r4,1		/* Next TLB */
 #ifndef CONFIG_NAND_SPL
 	.text
 	.long	0x27051956		/* U-Boot Magic Number			*/
-	.globl	version_string
-version_string:
-	.ascii U_BOOT_VERSION
-	.ascii " (", U_BOOT_DATE, " - ", U_BOOT_TIME, ")"
-	.ascii CONFIG_IDENT_STRING, "\0"
 
 	. = EXC_OFF_SYS_RESET
 	.globl	_start_of_vectors
diff --git a/arch/sh/lib/board.c b/arch/sh/lib/board.c
index ed91643..90fe796 100644
--- a/arch/sh/lib/board.c
+++ b/arch/sh/lib/board.c
@@ -22,7 +22,6 @@ 
 #include <command.h>
 #include <malloc.h>
 #include <stdio_dev.h>
-#include <timestamp.h>
 #include <version.h>
 #include <watchdog.h>
 #include <net.h>
@@ -39,8 +38,6 @@  extern int board_init(void);
 extern int dram_init(void);
 extern int timer_init(void);
 
-const char version_string[] = U_BOOT_VERSION" ("U_BOOT_DATE" - "U_BOOT_TIME")";
-
 unsigned long monitor_flash_len = CONFIG_SYS_MONITOR_LEN;
 
 #ifndef CONFIG_SYS_NO_FLASH
diff --git a/arch/sparc/cpu/leon2/start.S b/arch/sparc/cpu/leon2/start.S
index f22fb7e..d430f61 100644
--- a/arch/sparc/cpu/leon2/start.S
+++ b/arch/sparc/cpu/leon2/start.S
@@ -28,7 +28,6 @@ 
 #include <asm/psr.h>
 #include <asm/stack.h>
 #include <asm/leon.h>
-#include <timestamp.h>
 #include <version.h>
 
 /* Entry for traps which jump to a programmer-specified trap handler.  */
@@ -193,16 +192,6 @@  _trap_table:
 	SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; SOFT_TRAP;	! f4-f7
 	SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; SOFT_TRAP;	! f8-fb
 	SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; SOFT_TRAP;	! fc-ff
-/*
- * Version string
- */
-
-	.data
-	.globl	version_string
-version_string:
-	.ascii U_BOOT_VERSION
-	.ascii " (", U_BOOT_DATE, " - ", U_BOOT_TIME, ")"
-	.ascii CONFIG_IDENT_STRING, "\0"
 
 	.section	".text"
 	.align 4
diff --git a/arch/sparc/cpu/leon3/start.S b/arch/sparc/cpu/leon3/start.S
index 56ae88d..ce381ae 100644
--- a/arch/sparc/cpu/leon3/start.S
+++ b/arch/sparc/cpu/leon3/start.S
@@ -28,7 +28,6 @@ 
 #include <asm/psr.h>
 #include <asm/stack.h>
 #include <asm/leon.h>
-#include <timestamp.h>
 #include <version.h>
 
 /* Entry for traps which jump to a programmer-specified trap handler.  */
@@ -193,17 +192,9 @@  _trap_table:
 	SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; SOFT_TRAP;	! f4-f7
 	SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; SOFT_TRAP;	! f8-fb
 	SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; SOFT_TRAP;	! fc-ff
-/*
- * Version string
- */
 
 	.data
 	.extern leon3_snooping_avail
-	.globl	version_string
-version_string:
-	.ascii U_BOOT_VERSION
-	.ascii " (", U_BOOT_DATE, " - ", U_BOOT_TIME, ")"
-	.ascii CONFIG_IDENT_STRING, "\0"
 
 	.section	".text"
 	.align 4
diff --git a/arch/x86/lib/board.c b/arch/x86/lib/board.c
index df54222..ebb6ced 100644
--- a/arch/x86/lib/board.c
+++ b/arch/x86/lib/board.c
@@ -35,7 +35,6 @@ 
 #include <watchdog.h>
 #include <command.h>
 #include <stdio_dev.h>
-#include <timestamp.h>
 #include <version.h>
 #include <malloc.h>
 #include <net.h>
@@ -66,9 +65,6 @@  extern ulong __rel_dyn_end;
 extern ulong __bss_start;
 extern ulong __bss_end;
 
-const char version_string[] =
-	U_BOOT_VERSION" (" U_BOOT_DATE " - " U_BOOT_TIME ")";
-
 /************************************************************************
  * Init Utilities							*
  ************************************************************************
diff --git a/common/cmd_version.c b/common/cmd_version.c
index 83cb11c..4b78b66 100644
--- a/common/cmd_version.c
+++ b/common/cmd_version.c
@@ -23,9 +23,15 @@ 
 
 #include <common.h>
 #include <command.h>
+#include <timestamp.h>
 #include <version.h>
 
-extern char version_string[];
+#ifndef CONFIG_IDENT_STRING
+#define CONFIG_IDENT_STRING ""
+#endif
+
+const char * const version_string = U_BOOT_VERSION " (" U_BOOT_DATE " - "
+	U_BOOT_TIME ")" CONFIG_IDENT_STRING;
 
 int do_version(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
diff --git a/include/version.h b/include/version.h
index a34291a..6dc18d6 100644
--- a/include/version.h
+++ b/include/version.h
@@ -28,4 +28,6 @@ 
 #include "version_autogenerated.h"
 #endif
 
+extern const char * const version_string;
+
 #endif	/* __VERSION_H__ */