[U-Boot] [PATCH v4] Update U-Boot's build timestamp on every compile

Peter Tyser ptyser at xes-inc.com
Mon Nov 3 16:24:29 CET 2008


On Sat, 2008-11-01 at 03:26 -0700, Trent Piepho wrote:
> On Fri, 31 Oct 2008, Peter Tyser wrote:
> > +$(TIMESTAMP_FILE):
> > +		@( printf '#define U_BOOT_DATE "%s"\n' '$(shell date +"%b %d %C%y")' \
> > +		 ) > $@
> > +		@( printf '#define U_BOOT_TIME "%s"\n' '$(shell date +"%T")' \
> > +		 ) >> $@
> 
> You could do this:
> 
>  	@date +'#define U_BOOT_DATE "%b %d %C%y"' > $@
>  	@date +'#define U_BOOT_TIME "%T"' >> $@
> 
> Somewhat shorter and simpler.

Good idea.

> > diff --git a/cpu/mpc8xx/video.c b/cpu/mpc8xx/video.c
> > index 2e6a22a..aa47df7 100644
> > --- a/cpu/mpc8xx/video.c
> > +++ b/cpu/mpc8xx/video.c
> > @@ -32,6 +32,7 @@
> > #include <stdarg.h>
> > #include <common.h>
> > #include <config.h>
> > +#include <timestamp.h>
> > #include <version.h>
> > #include <i2c.h>
> > #include <linux/types.h>
> > @@ -1174,7 +1175,8 @@ static void *video_logo (void)
> > 	easylogo_plot (VIDEO_LOGO_ADDR, screen, width, 0, 0);
> >
> > #ifdef VIDEO_INFO
> > -	sprintf (info, "%s (%s - %s) ", U_BOOT_VERSION, __DATE__, __TIME__);
> > +	sprintf (info, "%s (%s - %s) ",
> > +		 U_BOOT_VERSION, U_BOOT_DATE, U_BOOT_TIME);
> > 	video_drawstring (VIDEO_INFO_X, VIDEO_INFO_Y, info);
> 
> If the include of timestamp.h is inside the VIDEO_INFO ifdef, then video.c
> won't gain a timestamp.h dependency when VIDEO_INFO isn't on.  This would
> prevent the file from getting rebuilt on each build if it doesn't need it.

I was following the lead of version.h, which has the same issue you
spotted.  I'll fix both in the next rev.

> > diff --git a/include/configs/NETPHONE.h b/include/configs/NETPHONE.h
> > index a147aff..34de947 100644
> > --- a/include/configs/NETPHONE.h
> > +++ b/include/configs/NETPHONE.h
> > @@ -799,7 +799,7 @@ typedef unsigned int led_id_t;
> > #define CONFIG_CDP_DEVICE_ID_PREFIX	"NP"	/* netphone */
> > #define CONFIG_CDP_PORT_ID		"eth%d"
> > #define CONFIG_CDP_CAPABILITIES		0x00000010
> > -#define CONFIG_CDP_VERSION		"u-boot" " " __DATE__ " " __TIME__
> > +#define CONFIG_CDP_VERSION		"u-boot" " " U_BOOT_DATE " " U_BOOT_TIME
> 
> This means any file that uses CONFIG_CDP_VERSION will need to include
> timestamp.h, which it didn't before.  You added the includes where needed?

Yes, it is only used in net.c which was updated with:
+#if defined(CONFIG_CDP_VERSION)
+#include <timestamp.h>
+#endif

Thanks for the comments Trent.  I'll resubmit v5 shortly.
Peter




More information about the U-Boot mailing list