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.
Signed-off-by: Michal Marek <[email protected]>
---
Documentation/kbuild/kbuild.txt | 12 ++++++++++++
scripts/mkcompile_h | 14 ++++++++++++--
2 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/Documentation/kbuild/kbuild.txt b/Documentation/kbuild/kbuild.txt
index 4a99031..27d7928 100644
--- a/Documentation/kbuild/kbuild.txt
+++ b/Documentation/kbuild/kbuild.txt
@@ -196,3 +196,15 @@ to be included in the databases, separated by blank space. E.g.:
To get all available archs you can also specify all. E.g.:
$ make ALLSOURCE_ARCHS=all tags
+
+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.
diff --git a/scripts/mkcompile_h b/scripts/mkcompile_h
index 82416a8..82c4e1d 100755
--- a/scripts/mkcompile_h
+++ b/scripts/mkcompile_h
@@ -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 $KBUILD_BUILD_USER | $UTS_TRUNCATE`\"
+ echo \#define LINUX_COMPILE_HOST \"`echo $KBUILD_BUILD_HOST | $UTS_TRUNCATE`\"
echo \#define LINUX_COMPILER \"`$CC -v 2>&1 | tail -n 1`\"
) > .tmpcompile
--
1.7.4.1
On 05/04/2011 15:58, Michal Marek wrote:
> - echo \#define LINUX_COMPILE_BY \"`whoami`\"
> - echo \#define LINUX_COMPILE_HOST \"`hostname | $UTS_TRUNCATE`\"
> + echo \#define LINUX_COMPILE_BY \"`echo $KBUILD_BUILD_USER | $UTS_TRUNCATE`\"
> + echo \#define LINUX_COMPILE_HOST \"`echo $KBUILD_BUILD_HOST | $UTS_TRUNCATE`\"
Shouldn't these be the variables defined above otherwise we get empty
LINUX_COMPILE_{BY,HOST} in the case the corresponding environment
variable is unset.
Thanks,
Jack
Dne 5.4.2011 17:52, Jack Stone napsal(a):
> On 05/04/2011 15:58, Michal Marek wrote:
>> - echo \#define LINUX_COMPILE_BY \"`whoami`\"
>> - echo \#define LINUX_COMPILE_HOST \"`hostname | $UTS_TRUNCATE`\"
>> + echo \#define LINUX_COMPILE_BY \"`echo $KBUILD_BUILD_USER | $UTS_TRUNCATE`\"
>> + echo \#define LINUX_COMPILE_HOST \"`echo $KBUILD_BUILD_HOST | $UTS_TRUNCATE`\"
>
> Shouldn't these be the variables defined above otherwise we get empty
> LINUX_COMPILE_{BY,HOST} in the case the corresponding environment
> variable is unset.
Good catch. I'll fix it.
Thanks for the review.
Michal
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.
Signed-off-by: Michal Marek <[email protected]>
---
Documentation/kbuild/kbuild.txt | 12 ++++++++++++
scripts/mkcompile_h | 14 ++++++++++++--
2 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/Documentation/kbuild/kbuild.txt b/Documentation/kbuild/kbuild.txt
index 4a99031..27d7928 100644
--- a/Documentation/kbuild/kbuild.txt
+++ b/Documentation/kbuild/kbuild.txt
@@ -196,3 +196,15 @@ to be included in the databases, separated by blank space. E.g.:
To get all available archs you can also specify all. E.g.:
$ make ALLSOURCE_ARCHS=all tags
+
+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.
diff --git a/scripts/mkcompile_h b/scripts/mkcompile_h
index 82416a8..7ad6bf7 100755
--- a/scripts/mkcompile_h
+++ b/scripts/mkcompile_h
@@ -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
--
1.7.4.1
On Mon, 11 Apr 2011 17:04:49 +0200, Michal Marek said:
> 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.
> +
> +KBUILD_BUILD_TIMESTAMP
Changelog section doesn't match actual patch. Other than that, I'm OK on this.
On 12.4.2011 05:25, [email protected] wrote:
> On Mon, 11 Apr 2011 17:04:49 +0200, Michal Marek said:
>> 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.
>
>> +
>> +KBUILD_BUILD_TIMESTAMP
>
> Changelog section doesn't match actual patch. Other than that, I'm OK on this.
I changed it to
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.
Michal
On Tue, Apr 12, 2011 at 11:01:43AM +0200, Michal Marek wrote:
> On 12.4.2011 05:25, [email protected] wrote:
> > On Mon, 11 Apr 2011 17:04:49 +0200, Michal Marek said:
> >> 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.
> >
> >> +
> >> +KBUILD_BUILD_TIMESTAMP
> >
> > Changelog section doesn't match actual patch. Other than that, I'm OK on this.
>
> I changed it to
>
> 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.
Pushed to kbuild-2.6.git#kbuild.
Michal