diff options
| author | Kai Germaschewski <kai@tp1.ruhr-uni-bochum.de> | 2002-06-06 00:09:52 -0500 |
|---|---|---|
| committer | Kai Germaschewski <kai@tp1.ruhr-uni-bochum.de> | 2002-06-06 00:09:52 -0500 |
| commit | 561e79b059e0a06dea7bc216641626fdfad099fb (patch) | |
| tree | d79902a82fb7b31eb512ce75eefe76668d4c4eef /scripts | |
| parent | 053cf0e6f510251a6fd6ffaf58c1f0b1d32ce08a (diff) | |
kbuild: Enforce UTS limit, use LANG=C for date/time
Patch by Keith Owens, ported to 2.5.
If the length of $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
exceeds 64 characters it silently corrupts the utsname data, resulting
in garbage for uname -r and problems running the kernel and modules.
Abort if KERNELRELEASE is too long. Truncation is not good enough, it
results in ambiguous /lib/modules/`uname -r` contents.
Ensure that the date/time in uname are always in LANG=C. Users with
other languages report that 8 bit values cause the boot messages to go
haywire.
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/mkcompile_h | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/scripts/mkcompile_h b/scripts/mkcompile_h index e18fc4f263e3..6313db961724 100755 --- a/scripts/mkcompile_h +++ b/scripts/mkcompile_h @@ -10,24 +10,32 @@ else echo 0 > ../.version fi + +UTS_VERSION="#$VERSION" +if [ -n "$SMP" ] ; then UTS_VERSION="$UTS_VERSION SMP"; fi +UTS_VERSION="$UTS_VERSION `LANG=C date`" + +# Truncate to maximum length + +UTS_LEN=64 +UTS_TRUNCATE="sed -e s/\(.\{1,$UTS_LEN\}\).*/\1/" + # Generate a temporary compile.h ( echo /\* This file is auto generated, version $VERSION \*/ echo \#define UTS_MACHINE \"$ARCH\" - echo -n \#define UTS_VERSION \"\#$VERSION - if [ -n "$SMP" ] ; then echo -n " SMP"; fi - echo ' '`date`'"' + echo \#define UTS_VERSION \"`echo $UTS_VERSION | $UTS_TRUNCATE`\" - echo \#define LINUX_COMPILE_TIME \"`date +%T`\" + echo \#define LINUX_COMPILE_TIME \"`LANG=C date +%T`\" echo \#define LINUX_COMPILE_BY \"`whoami`\" - echo \#define LINUX_COMPILE_HOST \"`hostname`\" + echo \#define LINUX_COMPILE_HOST \"`hostname | $UTS_TRUNCATE`\" if [ -x /bin/dnsdomainname ]; then - echo \#define LINUX_COMPILE_DOMAIN \"`dnsdomainname`\" + echo \#define LINUX_COMPILE_DOMAIN \"`dnsdomainname | $UTS_TRUNCATE`\" elif [ -x /bin/domainname ]; then - echo \#define LINUX_COMPILE_DOMAIN \"`domainname`\" + echo \#define LINUX_COMPILE_DOMAIN \"`domainname | $UTS_TRUNCATE`\" else echo \#define LINUX_COMPILE_DOMAIN fi @@ -48,10 +56,10 @@ if [ -r $TARGET ] && \ grep -v 'UTS_VERSION\|LINUX_COMPILE_TIME' $TARGET > .tmpver.1 && \ grep -v 'UTS_VERSION\|LINUX_COMPILE_TIME' .tmpcompile > .tmpver.2 && \ cmp -s .tmpver.1 .tmpver.2; then - echo $TARGET was not updated; + echo ' (unchanged)' rm -f .tmpcompile else - echo $TARGET was updated + echo ' (updated)' mv -f .tmpcompile $TARGET fi rm -f .tmpver.1 .tmpver.2 |
