kbuild: Allow to override LINUX_COMPILE_BY and LINUX_COMPILE_HOST macros
authorMichal Marek <mmarek@suse.cz>
Tue, 5 Apr 2011 12:32:30 +0000 (14:32 +0200)
committerMichal Marek <mmarek@suse.cz>
Mon, 18 Apr 2011 12:26:55 +0000 (14:26 +0200)
Make it possible to override the user@host string displayed during boot
and in /proc/version by the environment variables KBUILD_BUILD_USER and
KBUILD_BUILD_HOST. Several distributions patch scripts/mkcompile_h to
achieve this, so let's provide an official way. Also, document the
KBUILD_BUILD_TIMESTAMP variable while at it.

Signed-off-by: Michal Marek <mmarek@suse.cz>
Documentation/kbuild/kbuild.txt
scripts/mkcompile_h

index f1431d099fce31371aa74f63efed4f7ce5f9b64b..f11ebb33e4a6eea15a80dd49873619c4d2ee9253 100644 (file)
@@ -201,3 +201,15 @@ KBUILD_ENABLE_EXTRA_GCC_CHECKS
 --------------------------------------------------
 If enabled over the make command line with "W=1", it turns on additional
 gcc -W... options for more extensive build-time checking.
+
+KBUILD_BUILD_TIMESTAMP
+--------------------------------------------------
+Setting this to a date string overrides the timestamp used in the
+UTS_VERSION definition (uname -v in the running kernel). The default value
+is the output of the date command at one point during build.
+
+KBUILD_BUILD_USER, KBUILD_BUILD_HOST
+--------------------------------------------------
+These two variables allow to override the user@host string displayed during
+boot and in /proc/version. The default value is the output of the commands
+whoami and host, respectively.
index 82416a81df5e14d8022f3e70a7b7c4b2fc32c511..7ad6bf7a09ff3ae3250c144c500636ddfbac75ee 100755 (executable)
@@ -42,6 +42,16 @@ if [ -z "$KBUILD_BUILD_TIMESTAMP" ]; then
 else
        TIMESTAMP=$KBUILD_BUILD_TIMESTAMP
 fi
+if test -z "$KBUILD_BUILD_USER"; then
+       LINUX_COMPILE_BY=`whoami`
+else
+       LINUX_COMPILE_BY=$KBUILD_BUILD_USER
+fi
+if test -z "$KBUILD_BUILD_HOST"; then
+       LINUX_COMPILE_HOST=`hostname`
+else
+       LINUX_COMPILE_HOST=$KBUILD_BUILD_HOST
+fi
 
 UTS_VERSION="#$VERSION"
 CONFIG_FLAGS=""
@@ -63,8 +73,8 @@ UTS_TRUNCATE="cut -b -$UTS_LEN"
 
   echo \#define UTS_VERSION \"`echo $UTS_VERSION | $UTS_TRUNCATE`\"
 
-  echo \#define LINUX_COMPILE_BY \"`whoami`\"
-  echo \#define LINUX_COMPILE_HOST \"`hostname | $UTS_TRUNCATE`\"
+  echo \#define LINUX_COMPILE_BY \"`echo $LINUX_COMPILE_BY | $UTS_TRUNCATE`\"
+  echo \#define LINUX_COMPILE_HOST \"`echo $LINUX_COMPILE_HOST | $UTS_TRUNCATE`\"
 
   echo \#define LINUX_COMPILER \"`$CC -v 2>&1 | tail -n 1`\"
 ) > .tmpcompile