Re: [PATCH] override build timestamp

Previous thread: Re: 2.6.20-ck1 by Edouard Gomez on Friday, February 16, 2007 - 2:45 pm. (1 message)

Next thread: [PATCH] workqueue: introduce wq_per_cpu() helper by Oleg Nesterov on Friday, February 16, 2007 - 3:05 pm. (1 message)
From: Olaf Hering
Date: Friday, February 16, 2007 - 2:52 pm

Pass a timestamp to kbuild via an enviroment variable.

    TZ=UTC BUILD_TIMESTAMP=2007-01-01 make -kj O=../O vmlinux

This can be used when the kernel source is in a SCM and uname -v
is supposed to give the commit date and not the package build time.

Signed-off-by: Olaf Hering <olaf@aepfle.de>

---
 scripts/mkcompile_h |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Index: linux-2.6/scripts/mkcompile_h
===================================================================
--- linux-2.6.orig/scripts/mkcompile_h
+++ linux-2.6/scripts/mkcompile_h
@@ -30,7 +30,12 @@ UTS_VERSION="#$VERSION"
 CONFIG_FLAGS=""
 if [ -n "$SMP" ] ; then CONFIG_FLAGS="SMP"; fi
 if [ -n "$PREEMPT" ] ; then CONFIG_FLAGS="$CONFIG_FLAGS PREEMPT"; fi
-UTS_VERSION="$UTS_VERSION $CONFIG_FLAGS `LC_ALL=C LANG=C date`"
+if [ -n "$BUILD_TIMESTAMP" ]; then
+  TIMESTAMP="`LC_ALL=C LANG=C date -d "$BUILD_TIMESTAMP"`"
+else
+  TIMESTAMP="`LC_ALL=C LANG=C date`"
+fi
+UTS_VERSION="$UTS_VERSION $CONFIG_FLAGS $TIMESTAMP"
 
 # Truncate to maximum length
 
-

From: Oleg Verych
Date: Friday, February 16, 2007 - 8:27 pm

While adding this functionality must be decided by kbuild developers,
could you make separate patch with exporting 'LANG=C' on the very
beginning and delete all other occurrences of it? It's a C header file
generation and afaik, it must be ASCII.

-

From: Olaf Hering
Date: Saturday, February 17, 2007 - 4:51 am

That makes sense.
But we better build the whole kernel with LC_ALL=C LANG=C.
-

From: Andreas Schwab
Date: Saturday, February 17, 2007 - 5:15 am

If you have LC_ALL=C you don't need LANG=C.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."
-

From: Roman Zippel
Date: Saturday, February 17, 2007 - 6:57 pm

Hi,


Bad idea, most user output should be localized (even if it's only utf-8) 
and some kconfig targets have explicit locale support.

bye, Roman
-

From: Oleg Verych
Date: Saturday, February 17, 2007 - 8:57 pm

Ok, then maybe this one

<http://marc.theaimsgroup.com/?l=linux-mm-commits&m=116720464804613&w=2>

can be fixed as well? I used same reasoning to comment on it (that
particular patch was dropped).
____
-

From: Roman Zippel
Date: Saturday, February 17, 2007 - 7:04 pm

Hi,


Is this really necessary? I don't really see the point of this.

bye, Roman
-

From: Olaf Hering
Date: Sunday, February 18, 2007 - 1:12 am

The package/kernel buildtime does not mean much, but the commit date
gives you a way to restore the source state for a given binary.
-

From: Roman Zippel
Date: Sunday, February 18, 2007 - 9:24 am

Hi,


This information could also be added to the version string like 
CONFIG_LOCALVERSION_AUTO does. OTOH rather than abusing the build date 
(which may not mean much, but it nevertheless has a meaning), I'd rather 
add the possibility to add extra information.

bye, ROman
-

From: Olaf Hering
Date: Monday, February 19, 2007 - 6:14 am

What exactly do you have in mind, how to provide the extra info?
-

Previous thread: Re: 2.6.20-ck1 by Edouard Gomez on Friday, February 16, 2007 - 2:45 pm. (1 message)

Next thread: [PATCH] workqueue: introduce wq_per_cpu() helper by Oleg Nesterov on Friday, February 16, 2007 - 3:05 pm. (1 message)