Commit 63104eec authored by Sam Ravnborg's avatar Sam Ravnborg

kbuild: introduce utsrelease.h

include/linux/version.h contained both actual KERNEL version
and UTS_RELEASE that contains a subset from git SHA1 for when
kernel was compiled as part of a git repository.
This had the unfortunate side-effect that all files including version.h
would be recompiled when some git changes was made due to changes SHA1.
Split it out so we keep independent parts in separate files.

Also update checkversion.pl script to no longer check for UTS_RELEASE.
Signed-off-by: default avatarSam Ravnborg <sam@ravnborg.org>
parent 05668381
...@@ -812,8 +812,8 @@ endif ...@@ -812,8 +812,8 @@ endif
# prepare2 creates a makefile if using a separate output directory # prepare2 creates a makefile if using a separate output directory
prepare2: prepare3 outputmakefile prepare2: prepare3 outputmakefile
prepare1: prepare2 include/linux/version.h include/asm \ prepare1: prepare2 include/linux/version.h include/linux/utsrelease.h \
include/config/auto.conf include/asm include/config/auto.conf
ifneq ($(KBUILD_MODULES),) ifneq ($(KBUILD_MODULES),)
$(Q)mkdir -p $(MODVERDIR) $(Q)mkdir -p $(MODVERDIR)
$(Q)rm -f $(MODVERDIR)/* $(Q)rm -f $(MODVERDIR)/*
...@@ -848,21 +848,26 @@ include/asm: ...@@ -848,21 +848,26 @@ include/asm:
# needs to be updated, so this check is forced on all builds # needs to be updated, so this check is forced on all builds
uts_len := 64 uts_len := 64
define filechk_utsrelease.h
if [ `echo -n "$(KERNELRELEASE)" | wc -c ` -gt $(uts_len) ]; then \
echo '"$(KERNELRELEASE)" exceeds $(uts_len) characters' >&2; \
exit 1; \
fi; \
(echo \#define UTS_RELEASE \"$(KERNELRELEASE)\";)
endef
define filechk_version.h define filechk_version.h
if [ `echo -n "$(KERNELRELEASE)" | wc -c ` -gt $(uts_len) ]; then \ (echo \#define LINUX_VERSION_CODE $(shell \
echo '"$(KERNELRELEASE)" exceeds $(uts_len) characters' >&2; \ expr $(VERSION) \* 65536 + $(PATCHLEVEL) \* 256 + $(SUBLEVEL)); \
exit 1; \ echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))';)
fi; \
(echo \#define UTS_RELEASE \"$(KERNELRELEASE)\"; \
echo \#define LINUX_VERSION_CODE `expr $(VERSION) \\* 65536 + $(PATCHLEVEL) \\* 256 + $(SUBLEVEL)`; \
echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))'; \
)
endef endef
include/linux/version.h: $(srctree)/Makefile include/config/kernel.release FORCE include/linux/version.h: $(srctree)/Makefile FORCE
$(call filechk,version.h) $(call filechk,version.h)
include/linux/utsrelease.h: include/config/kernel.release FORCE
$(call filechk,utsrelease.h)
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
PHONY += depend dep PHONY += depend dep
...@@ -955,7 +960,8 @@ CLEAN_FILES += vmlinux System.map \ ...@@ -955,7 +960,8 @@ CLEAN_FILES += vmlinux System.map \
# Directories & files removed with 'make mrproper' # Directories & files removed with 'make mrproper'
MRPROPER_DIRS += include/config include2 MRPROPER_DIRS += include/config include2
MRPROPER_FILES += .config .config.old include/asm .version .old_version \ MRPROPER_FILES += .config .config.old include/asm .version .old_version \
include/linux/autoconf.h include/linux/version.h \ include/linux/autoconf.h include/linux/version.h \
include/linux/utsrelease.h \
Module.symvers tags TAGS cscope* Module.symvers tags TAGS cscope*
# clean - Delete most, but leave enough to build external modules # clean - Delete most, but leave enough to build external modules
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
*/ */
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/string.h> #include <linux/string.h>
#include <linux/version.h> #include <linux/utsrelease.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <asm/system.h> #include <asm/system.h>
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
*/ */
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/string.h> #include <linux/string.h>
#include <linux/version.h> #include <linux/utsrelease.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <asm/system.h> #include <asm/system.h>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
*/ */
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/string.h> #include <linux/string.h>
#include <linux/version.h> #include <linux/utsrelease.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <asm/system.h> #include <asm/system.h>
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* 2 of the License, or (at your option) any later version. * 2 of the License, or (at your option) any later version.
*/ */
#include <linux/version.h> #include <linux/utsrelease.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/delay.h> #include <linux/delay.h>
......
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
*/ */
#include <asm/segment.h> #include <asm/segment.h>
#include <linux/version.h> #include <linux/utsrelease.h>
#include <linux/compile.h> #include <linux/compile.h>
#include <asm/boot.h> #include <asm/boot.h>
#include <asm/e820.h> #include <asm/e820.h>
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#include <linux/reboot.h> #include <linux/reboot.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/version.h> #include <linux/utsrelease.h>
#include <linux/adb.h> #include <linux/adb.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/delay.h> #include <linux/delay.h>
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/string.h> #include <linux/string.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/version.h> #include <linux/utsrelease.h>
#include <asm/sections.h> #include <asm/sections.h>
#include <asm/prom.h> #include <asm/prom.h>
#include <asm/page.h> #include <asm/page.h>
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/string.h> #include <linux/string.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/version.h> #include <linux/utsrelease.h>
#include <asm/sections.h> #include <asm/sections.h>
#include <asm/bootx.h> #include <asm/bootx.h>
......
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
*/ */
#include <asm/segment.h> #include <asm/segment.h>
#include <linux/version.h> #include <linux/utsrelease.h>
#include <linux/compile.h> #include <linux/compile.h>
#include <asm/boot.h> #include <asm/boot.h>
#include <asm/e820.h> #include <asm/e820.h>
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
#include <linux/netdevice.h> #include <linux/netdevice.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/string.h> #include <linux/string.h>
#include <linux/version.h> #include <linux/utsrelease.h>
static void bcm43xx_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) static void bcm43xx_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
......
#include <linux/version.h> #include <linux/utsrelease.h>
#include <linux/module.h> #include <linux/module.h>
/* Simply sanity version stamp for modules. */ /* Simply sanity version stamp for modules. */
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/uts.h> #include <linux/uts.h>
#include <linux/utsname.h> #include <linux/utsname.h>
#include <linux/utsrelease.h>
#include <linux/version.h> #include <linux/version.h>
#define version(a) Version_ ## a #define version(a) Version_ ## a
......
#! /usr/bin/perl #! /usr/bin/perl
# #
# checkversion find uses of LINUX_VERSION_CODE, KERNEL_VERSION, or # checkversion find uses of LINUX_VERSION_CODE or KERNEL_VERSION
# UTS_RELEASE without including <linux/version.h>, or cases of # without including <linux/version.h>, or cases of
# including <linux/version.h> that don't need it. # including <linux/version.h> that don't need it.
# Copyright (C) 2003, Randy Dunlap <rdunlap@xenotime.net> # Copyright (C) 2003, Randy Dunlap <rdunlap@xenotime.net>
...@@ -41,8 +41,7 @@ foreach $file (@ARGV) ...@@ -41,8 +41,7 @@ foreach $file (@ARGV)
} }
# Look for uses: LINUX_VERSION_CODE, KERNEL_VERSION, UTS_RELEASE # Look for uses: LINUX_VERSION_CODE, KERNEL_VERSION, UTS_RELEASE
if (($_ =~ /LINUX_VERSION_CODE/) || ($_ =~ /\WKERNEL_VERSION/) || if (($_ =~ /LINUX_VERSION_CODE/) || ($_ =~ /\WKERNEL_VERSION/)) {
($_ =~ /UTS_RELEASE/)) {
$fUseVersion = 1; $fUseVersion = 1;
last LINE if $iLinuxVersion; last LINE if $iLinuxVersion;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment