diff options
author | Sam Ravnborg <sam@neptun.ravnborg.org> | 2007-04-01 21:49:27 +0200 |
---|---|---|
committer | Sam Ravnborg <sam@ravnborg.org> | 2007-05-02 20:58:09 +0200 |
commit | 87c94bfb8ad354fb43d2caf870d7ca0b3f98dab3 (patch) | |
tree | 796c87da12f564e5ecb5a0c1d57ea94c9dd7604a /scripts/mkcompile_h | |
parent | b72e53f8bbbec8421316220291d8a8002a5562ba (diff) | |
download | linux-87c94bfb8ad354fb43d2caf870d7ca0b3f98dab3.tar.gz linux-87c94bfb8ad354fb43d2caf870d7ca0b3f98dab3.tar.bz2 linux-87c94bfb8ad354fb43d2caf870d7ca0b3f98dab3.zip |
kbuild: override build timestamp & version
Introduce KBUILD_BUILD_VERSION to make it
possible to override kernel build version
during build time.
Introduce KBUILD_BUILD_TIMESTAMP to make it
possible to override kernel build timestamp
during build time.
But variables are useful mainly by distros
that want to pass info from an SCM when
building the kernel. Timestamp could be last
checkin date for a file etc.
The idea came from Olaf Hering <olaf@aepfle.de>
Cc: Olaf Hering <olaf@aepfle.de>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Diffstat (limited to 'scripts/mkcompile_h')
-rwxr-xr-x | scripts/mkcompile_h | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/scripts/mkcompile_h b/scripts/mkcompile_h index 82d0af46f0ef..a8740df07b09 100755 --- a/scripts/mkcompile_h +++ b/scripts/mkcompile_h @@ -18,19 +18,32 @@ fi # Do not expand names set -f -if [ -r .version ]; then - VERSION=`cat .version` +# Fix the language to get consistent output +LC_ALL=C +export LC_ALL + +if [ -z "$KBUILD_BUILD_VERSION" ]; then + if [ -r .version ]; then + VERSION=`cat .version` + else + VERSION=0 + echo 0 > .version + fi else - VERSION=0 - echo 0 > .version + VERSION=$KBUILD_BUILD_VERSION fi +if [ -z "$KBUILD_BUILD_TIMESTAMP" ]; then + TIMESTAMP=`date` +else + TIMESTAMP=$KBUILD_BUILD_TIMESTAMP +fi 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`" +UTS_VERSION="$UTS_VERSION $CONFIG_FLAGS $TIMESTAMP" # Truncate to maximum length @@ -46,7 +59,7 @@ UTS_TRUNCATE="sed -e s/\(.\{1,$UTS_LEN\}\).*/\1/" echo \#define UTS_VERSION \"`echo $UTS_VERSION | $UTS_TRUNCATE`\" - echo \#define LINUX_COMPILE_TIME \"`LC_ALL=C LANG=C date +%T`\" + echo \#define LINUX_COMPILE_TIME \"`date +%T`\" echo \#define LINUX_COMPILE_BY \"`whoami`\" echo \#define LINUX_COMPILE_HOST \"`hostname | $UTS_TRUNCATE`\" @@ -58,7 +71,7 @@ UTS_TRUNCATE="sed -e s/\(.\{1,$UTS_LEN\}\).*/\1/" echo \#define LINUX_COMPILE_DOMAIN fi - echo \#define LINUX_COMPILER \"`LC_ALL=C LANG=C $CC -v 2>&1 | tail -n 1`\" + echo \#define LINUX_COMPILER \"`$CC -v 2>&1 | tail -n 1`\" ) > .tmpcompile # Only replace the real compile.h if the new one is different, |