aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSam Ravnborg <sam@mars.ravnborg.org>2006-07-03 17:30:54 -0400
committerSam Ravnborg <sam@mars.ravnborg.org>2006-07-03 17:30:54 -0400
commit63104eec234bdecb55fd9c15467ae00d0a3f42ac (patch)
treeaee8fd42c0904cbc8671a7c023a421277db1b16f
parent05668381140309088443bf5dc53add4104610fbb (diff)
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: Sam Ravnborg <sam@ravnborg.org>
-rw-r--r--Makefile30
-rw-r--r--arch/alpha/boot/bootp.c2
-rw-r--r--arch/alpha/boot/bootpz.c2
-rw-r--r--arch/alpha/boot/main.c2
-rw-r--r--arch/frv/kernel/setup.c2
-rw-r--r--arch/i386/boot/setup.S2
-rw-r--r--arch/powerpc/platforms/chrp/setup.c2
-rw-r--r--arch/powerpc/platforms/powermac/bootx_init.c2
-rw-r--r--arch/ppc/syslib/btext.c2
-rw-r--r--arch/x86_64/boot/setup.S2
-rw-r--r--drivers/net/wireless/bcm43xx/bcm43xx_ethtool.c2
-rw-r--r--include/linux/vermagic.h2
-rw-r--r--init/version.c1
-rwxr-xr-xscripts/checkversion.pl7
14 files changed, 33 insertions, 27 deletions
diff --git a/Makefile b/Makefile
index 1cc793ff42d4..b36aeb617bd2 100644
--- a/Makefile
+++ b/Makefile
@@ -812,8 +812,8 @@ endif
812# prepare2 creates a makefile if using a separate output directory 812# prepare2 creates a makefile if using a separate output directory
813prepare2: prepare3 outputmakefile 813prepare2: prepare3 outputmakefile
814 814
815prepare1: prepare2 include/linux/version.h include/asm \ 815prepare1: prepare2 include/linux/version.h include/linux/utsrelease.h \
816 include/config/auto.conf 816 include/asm include/config/auto.conf
817ifneq ($(KBUILD_MODULES),) 817ifneq ($(KBUILD_MODULES),)
818 $(Q)mkdir -p $(MODVERDIR) 818 $(Q)mkdir -p $(MODVERDIR)
819 $(Q)rm -f $(MODVERDIR)/* 819 $(Q)rm -f $(MODVERDIR)/*
@@ -848,21 +848,26 @@ include/asm:
848# needs to be updated, so this check is forced on all builds 848# needs to be updated, so this check is forced on all builds
849 849
850uts_len := 64 850uts_len := 64
851define filechk_utsrelease.h
852 if [ `echo -n "$(KERNELRELEASE)" | wc -c ` -gt $(uts_len) ]; then \
853 echo '"$(KERNELRELEASE)" exceeds $(uts_len) characters' >&2; \
854 exit 1; \
855 fi; \
856 (echo \#define UTS_RELEASE \"$(KERNELRELEASE)\";)
857endef
851 858
852define filechk_version.h 859define filechk_version.h
853 if [ `echo -n "$(KERNELRELEASE)" | wc -c ` -gt $(uts_len) ]; then \ 860 (echo \#define LINUX_VERSION_CODE $(shell \
854 echo '"$(KERNELRELEASE)" exceeds $(uts_len) characters' >&2; \ 861 expr $(VERSION) \* 65536 + $(PATCHLEVEL) \* 256 + $(SUBLEVEL)); \
855 exit 1; \ 862 echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))';)
856 fi; \
857 (echo \#define UTS_RELEASE \"$(KERNELRELEASE)\"; \
858 echo \#define LINUX_VERSION_CODE `expr $(VERSION) \\* 65536 + $(PATCHLEVEL) \\* 256 + $(SUBLEVEL)`; \
859 echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))'; \
860 )
861endef 863endef
862 864
863include/linux/version.h: $(srctree)/Makefile include/config/kernel.release FORCE 865include/linux/version.h: $(srctree)/Makefile FORCE
864 $(call filechk,version.h) 866 $(call filechk,version.h)
865 867
868include/linux/utsrelease.h: include/config/kernel.release FORCE
869 $(call filechk,utsrelease.h)
870
866# --------------------------------------------------------------------------- 871# ---------------------------------------------------------------------------
867 872
868PHONY += depend dep 873PHONY += depend dep
@@ -955,7 +960,8 @@ CLEAN_FILES += vmlinux System.map \
955# Directories & files removed with 'make mrproper' 960# Directories & files removed with 'make mrproper'
956MRPROPER_DIRS += include/config include2 961MRPROPER_DIRS += include/config include2
957MRPROPER_FILES += .config .config.old include/asm .version .old_version \ 962MRPROPER_FILES += .config .config.old include/asm .version .old_version \
958 include/linux/autoconf.h include/linux/version.h \ 963 include/linux/autoconf.h include/linux/version.h \
964 include/linux/utsrelease.h \
959 Module.symvers tags TAGS cscope* 965 Module.symvers tags TAGS cscope*
960 966
961# clean - Delete most, but leave enough to build external modules 967# clean - Delete most, but leave enough to build external modules
diff --git a/arch/alpha/boot/bootp.c b/arch/alpha/boot/bootp.c
index ec53c28e33de..3af21c789339 100644
--- a/arch/alpha/boot/bootp.c
+++ b/arch/alpha/boot/bootp.c
@@ -9,7 +9,7 @@
9 */ 9 */
10#include <linux/kernel.h> 10#include <linux/kernel.h>
11#include <linux/string.h> 11#include <linux/string.h>
12#include <linux/version.h> 12#include <linux/utsrelease.h>
13#include <linux/mm.h> 13#include <linux/mm.h>
14 14
15#include <asm/system.h> 15#include <asm/system.h>
diff --git a/arch/alpha/boot/bootpz.c b/arch/alpha/boot/bootpz.c
index a6657f2cf9bd..4307bde80a35 100644
--- a/arch/alpha/boot/bootpz.c
+++ b/arch/alpha/boot/bootpz.c
@@ -11,7 +11,7 @@
11 */ 11 */
12#include <linux/kernel.h> 12#include <linux/kernel.h>
13#include <linux/string.h> 13#include <linux/string.h>
14#include <linux/version.h> 14#include <linux/utsrelease.h>
15#include <linux/mm.h> 15#include <linux/mm.h>
16 16
17#include <asm/system.h> 17#include <asm/system.h>
diff --git a/arch/alpha/boot/main.c b/arch/alpha/boot/main.c
index 78c9b0b6eea7..90ed55b662a8 100644
--- a/arch/alpha/boot/main.c
+++ b/arch/alpha/boot/main.c
@@ -7,7 +7,7 @@
7 */ 7 */
8#include <linux/kernel.h> 8#include <linux/kernel.h>
9#include <linux/string.h> 9#include <linux/string.h>
10#include <linux/version.h> 10#include <linux/utsrelease.h>
11#include <linux/mm.h> 11#include <linux/mm.h>
12 12
13#include <asm/system.h> 13#include <asm/system.h>
diff --git a/arch/frv/kernel/setup.c b/arch/frv/kernel/setup.c
index 5db3d4eff909..af08ccd4ed6e 100644
--- a/arch/frv/kernel/setup.c
+++ b/arch/frv/kernel/setup.c
@@ -10,7 +10,7 @@
10 * 2 of the License, or (at your option) any later version. 10 * 2 of the License, or (at your option) any later version.
11 */ 11 */
12 12
13#include <linux/version.h> 13#include <linux/utsrelease.h>
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/sched.h> 15#include <linux/sched.h>
16#include <linux/delay.h> 16#include <linux/delay.h>
diff --git a/arch/i386/boot/setup.S b/arch/i386/boot/setup.S
index 0a5a3be6d69c..d2b684cd620a 100644
--- a/arch/i386/boot/setup.S
+++ b/arch/i386/boot/setup.S
@@ -47,7 +47,7 @@
47 */ 47 */
48 48
49#include <asm/segment.h> 49#include <asm/segment.h>
50#include <linux/version.h> 50#include <linux/utsrelease.h>
51#include <linux/compile.h> 51#include <linux/compile.h>
52#include <asm/boot.h> 52#include <asm/boot.h>
53#include <asm/e820.h> 53#include <asm/e820.h>
diff --git a/arch/powerpc/platforms/chrp/setup.c b/arch/powerpc/platforms/chrp/setup.c
index 1f1771b212b4..9df9f2079e9b 100644
--- a/arch/powerpc/platforms/chrp/setup.c
+++ b/arch/powerpc/platforms/chrp/setup.c
@@ -24,7 +24,7 @@
24#include <linux/reboot.h> 24#include <linux/reboot.h>
25#include <linux/init.h> 25#include <linux/init.h>
26#include <linux/pci.h> 26#include <linux/pci.h>
27#include <linux/version.h> 27#include <linux/utsrelease.h>
28#include <linux/adb.h> 28#include <linux/adb.h>
29#include <linux/module.h> 29#include <linux/module.h>
30#include <linux/delay.h> 30#include <linux/delay.h>
diff --git a/arch/powerpc/platforms/powermac/bootx_init.c b/arch/powerpc/platforms/powermac/bootx_init.c
index cb257aeb91f6..24f09e2a5775 100644
--- a/arch/powerpc/platforms/powermac/bootx_init.c
+++ b/arch/powerpc/platforms/powermac/bootx_init.c
@@ -12,7 +12,7 @@
12#include <linux/kernel.h> 12#include <linux/kernel.h>
13#include <linux/string.h> 13#include <linux/string.h>
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/version.h> 15#include <linux/utsrelease.h>
16#include <asm/sections.h> 16#include <asm/sections.h>
17#include <asm/prom.h> 17#include <asm/prom.h>
18#include <asm/page.h> 18#include <asm/page.h>
diff --git a/arch/ppc/syslib/btext.c b/arch/ppc/syslib/btext.c
index 51ab6e90fe25..d11667046f21 100644
--- a/arch/ppc/syslib/btext.c
+++ b/arch/ppc/syslib/btext.c
@@ -6,7 +6,7 @@
6#include <linux/kernel.h> 6#include <linux/kernel.h>
7#include <linux/string.h> 7#include <linux/string.h>
8#include <linux/init.h> 8#include <linux/init.h>
9#include <linux/version.h> 9#include <linux/utsrelease.h>
10 10
11#include <asm/sections.h> 11#include <asm/sections.h>
12#include <asm/bootx.h> 12#include <asm/bootx.h>
diff --git a/arch/x86_64/boot/setup.S b/arch/x86_64/boot/setup.S
index 7de8b8fd1685..a50b631f4d2b 100644
--- a/arch/x86_64/boot/setup.S
+++ b/arch/x86_64/boot/setup.S
@@ -46,7 +46,7 @@
46 */ 46 */
47 47
48#include <asm/segment.h> 48#include <asm/segment.h>
49#include <linux/version.h> 49#include <linux/utsrelease.h>
50#include <linux/compile.h> 50#include <linux/compile.h>
51#include <asm/boot.h> 51#include <asm/boot.h>
52#include <asm/e820.h> 52#include <asm/e820.h>
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_ethtool.c b/drivers/net/wireless/bcm43xx/bcm43xx_ethtool.c
index b3ffcf501311..e386dcc32e8c 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx_ethtool.c
+++ b/drivers/net/wireless/bcm43xx/bcm43xx_ethtool.c
@@ -32,7 +32,7 @@
32#include <linux/netdevice.h> 32#include <linux/netdevice.h>
33#include <linux/pci.h> 33#include <linux/pci.h>
34#include <linux/string.h> 34#include <linux/string.h>
35#include <linux/version.h> 35#include <linux/utsrelease.h>
36 36
37 37
38static void bcm43xx_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) 38static void bcm43xx_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
diff --git a/include/linux/vermagic.h b/include/linux/vermagic.h
index dc7c621e4647..46919f9f5eb3 100644
--- a/include/linux/vermagic.h
+++ b/include/linux/vermagic.h
@@ -1,4 +1,4 @@
1#include <linux/version.h> 1#include <linux/utsrelease.h>
2#include <linux/module.h> 2#include <linux/module.h>
3 3
4/* Simply sanity version stamp for modules. */ 4/* Simply sanity version stamp for modules. */
diff --git a/init/version.c b/init/version.c
index 3ddc3ceec2fe..e290802c6bd2 100644
--- a/init/version.c
+++ b/init/version.c
@@ -10,6 +10,7 @@
10#include <linux/module.h> 10#include <linux/module.h>
11#include <linux/uts.h> 11#include <linux/uts.h>
12#include <linux/utsname.h> 12#include <linux/utsname.h>
13#include <linux/utsrelease.h>
13#include <linux/version.h> 14#include <linux/version.h>
14 15
15#define version(a) Version_ ## a 16#define version(a) Version_ ## a
diff --git a/scripts/checkversion.pl b/scripts/checkversion.pl
index 9f84e562318d..ec7d21161bdc 100755
--- a/scripts/checkversion.pl
+++ b/scripts/checkversion.pl
@@ -1,7 +1,7 @@
1#! /usr/bin/perl 1#! /usr/bin/perl
2# 2#
3# checkversion find uses of LINUX_VERSION_CODE, KERNEL_VERSION, or 3# checkversion find uses of LINUX_VERSION_CODE or KERNEL_VERSION
4# UTS_RELEASE without including <linux/version.h>, or cases of 4# without including <linux/version.h>, or cases of
5# including <linux/version.h> that don't need it. 5# including <linux/version.h> that don't need it.
6# Copyright (C) 2003, Randy Dunlap <rdunlap@xenotime.net> 6# Copyright (C) 2003, Randy Dunlap <rdunlap@xenotime.net>
7 7
@@ -41,8 +41,7 @@ foreach $file (@ARGV)
41 } 41 }
42 42
43 # Look for uses: LINUX_VERSION_CODE, KERNEL_VERSION, UTS_RELEASE 43 # Look for uses: LINUX_VERSION_CODE, KERNEL_VERSION, UTS_RELEASE
44 if (($_ =~ /LINUX_VERSION_CODE/) || ($_ =~ /\WKERNEL_VERSION/) || 44 if (($_ =~ /LINUX_VERSION_CODE/) || ($_ =~ /\WKERNEL_VERSION/)) {
45 ($_ =~ /UTS_RELEASE/)) {
46 $fUseVersion = 1; 45 $fUseVersion = 1;
47 last LINE if $iLinuxVersion; 46 last LINE if $iLinuxVersion;
48 } 47 }