aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/mkcompile_h
diff options
context:
space:
mode:
authorSam Ravnborg <sam@neptun.ravnborg.org>2007-04-01 15:49:27 -0400
committerSam Ravnborg <sam@ravnborg.org>2007-05-02 14:58:09 -0400
commit87c94bfb8ad354fb43d2caf870d7ca0b3f98dab3 (patch)
tree796c87da12f564e5ecb5a0c1d57ea94c9dd7604a /scripts/mkcompile_h
parentb72e53f8bbbec8421316220291d8a8002a5562ba (diff)
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-xscripts/mkcompile_h27
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
18# Do not expand names 18# Do not expand names
19set -f 19set -f
20 20
21if [ -r .version ]; then 21# Fix the language to get consistent output
22 VERSION=`cat .version` 22LC_ALL=C
23export LC_ALL
24
25if [ -z "$KBUILD_BUILD_VERSION" ]; then
26 if [ -r .version ]; then
27 VERSION=`cat .version`
28 else
29 VERSION=0
30 echo 0 > .version
31 fi
23else 32else
24 VERSION=0 33 VERSION=$KBUILD_BUILD_VERSION
25 echo 0 > .version
26fi 34fi
27 35
36if [ -z "$KBUILD_BUILD_TIMESTAMP" ]; then
37 TIMESTAMP=`date`
38else
39 TIMESTAMP=$KBUILD_BUILD_TIMESTAMP
40fi
28 41
29UTS_VERSION="#$VERSION" 42UTS_VERSION="#$VERSION"
30CONFIG_FLAGS="" 43CONFIG_FLAGS=""
31if [ -n "$SMP" ] ; then CONFIG_FLAGS="SMP"; fi 44if [ -n "$SMP" ] ; then CONFIG_FLAGS="SMP"; fi
32if [ -n "$PREEMPT" ] ; then CONFIG_FLAGS="$CONFIG_FLAGS PREEMPT"; fi 45if [ -n "$PREEMPT" ] ; then CONFIG_FLAGS="$CONFIG_FLAGS PREEMPT"; fi
33UTS_VERSION="$UTS_VERSION $CONFIG_FLAGS `LC_ALL=C LANG=C date`" 46UTS_VERSION="$UTS_VERSION $CONFIG_FLAGS $TIMESTAMP"
34 47
35# Truncate to maximum length 48# Truncate to maximum length
36 49
@@ -46,7 +59,7 @@ UTS_TRUNCATE="sed -e s/\(.\{1,$UTS_LEN\}\).*/\1/"
46 59
47 echo \#define UTS_VERSION \"`echo $UTS_VERSION | $UTS_TRUNCATE`\" 60 echo \#define UTS_VERSION \"`echo $UTS_VERSION | $UTS_TRUNCATE`\"
48 61
49 echo \#define LINUX_COMPILE_TIME \"`LC_ALL=C LANG=C date +%T`\" 62 echo \#define LINUX_COMPILE_TIME \"`date +%T`\"
50 echo \#define LINUX_COMPILE_BY \"`whoami`\" 63 echo \#define LINUX_COMPILE_BY \"`whoami`\"
51 echo \#define LINUX_COMPILE_HOST \"`hostname | $UTS_TRUNCATE`\" 64 echo \#define LINUX_COMPILE_HOST \"`hostname | $UTS_TRUNCATE`\"
52 65
@@ -58,7 +71,7 @@ UTS_TRUNCATE="sed -e s/\(.\{1,$UTS_LEN\}\).*/\1/"
58 echo \#define LINUX_COMPILE_DOMAIN 71 echo \#define LINUX_COMPILE_DOMAIN
59 fi 72 fi
60 73
61 echo \#define LINUX_COMPILER \"`LC_ALL=C LANG=C $CC -v 2>&1 | tail -n 1`\" 74 echo \#define LINUX_COMPILER \"`$CC -v 2>&1 | tail -n 1`\"
62) > .tmpcompile 75) > .tmpcompile
63 76
64# Only replace the real compile.h if the new one is different, 77# Only replace the real compile.h if the new one is different,