aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorDavid Rientjes <rientjes@google.com>2010-01-13 16:01:05 -0500
committerMichal Marek <mmarek@suse.cz>2010-02-02 08:33:55 -0500
commit85a256d8e0116c8f5ad276730830f5d4d473344d (patch)
treee0342929cdf91434af1f1736d5eee7907c4f48ef /Makefile
parent68c16edddf41044410fab59d4c179c023cb25afb (diff)
kbuild: improve version string logic
The LOCALVERSION= string passed to "make" will now always be appended to the kernel version after CONFIG_LOCALVERSION, if it exists, regardless of whether CONFIG_LOCALVERSION_AUTO is set or not. This allows users to uniquely identify their kernel builds with a string. If CONFIG_LOCALVERSION_AUTO is enabled, the unique SCM tag reported by setlocalversion (or .scmversion) is appended to the kernel version, if it exists. When CONFIG_LOCALVERSION_AUTO is not enabled, a `+' is appended to the kernel version to represent that the kernel has been revised since the last release unless "make LOCALVERSION=" was used to uniquely identify the build. The end result is this: - when LOCALVERSION= is passed to "make", it is appended to the kernel version, - when CONFIG_LOCALVERSION_AUTO is enabled, a unique SCM identifier is appended if the respository has been revised beyond a tagged commit, and - when CONFIG_LOCALVERSION_AUTO is disabled, a `+' is appended if the repository has been revised beyond a tagged commit and LOCALVERSION= was not passed to "make". Examples: With CONFIG_LOCALVERSION_AUTO: "make" results in v2.6.32-rc4-00149-ga3ccf63. If there are uncommited changes to the respository, it results in v2.6.32-rc4-00149-ga3ccf63-dirty. If "make LOCALVERSION=kbuild" were used, it results in v2.6.32-rc4-kbuild-00149-ga3ccf63-dirty. Without CONFIG_LOCALVERSION_AUTO, "make" results in v2.6.32-rc4+ unless the repository is at the Linux v2.6.32-rc4 commit (in which case the version would be v2.6.32-rc4). If "make LOCALVERSION=kbuild" were used, it results in v2.6.32-rc4-kbuild. Also renames variables such as localver-auto and _localver-auto to more accurately describe what they represent: localver-extra and scm-identifier, respectively. Signed-off-by: David Rientjes <rientjes@google.com> Signed-off-by: Michal Marek <mmarek@suse.cz>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile43
1 files changed, 27 insertions, 16 deletions
diff --git a/Makefile b/Makefile
index f9dc25cd9b2..faa320a67bf 100644
--- a/Makefile
+++ b/Makefile
@@ -910,14 +910,19 @@ endif
910# $(localver) 910# $(localver)
911# localversion* (files without backups, containing '~') 911# localversion* (files without backups, containing '~')
912# $(CONFIG_LOCALVERSION) (from kernel config setting) 912# $(CONFIG_LOCALVERSION) (from kernel config setting)
913# $(localver-auto) (only if CONFIG_LOCALVERSION_AUTO is set) 913# $(LOCALVERSION) (from make command line, if provided)
914# ./scripts/setlocalversion (SCM tag, if one exists) 914# $(localver-extra)
915# $(LOCALVERSION) (from make command line if provided) 915# $(scm-identifier) (unique SCM tag, if one exists)
916# ./scripts/setlocalversion (only with CONFIG_LOCALVERSION_AUTO)
917# .scmversion (only with CONFIG_LOCALVERSION_AUTO)
918# + (only without CONFIG_LOCALVERSION_AUTO
919# and without LOCALVERSION= and
920# repository is at non-tagged commit)
916# 921#
917# Note how the final $(localver-auto) string is included *only* if the 922# For kernels without CONFIG_LOCALVERSION_AUTO compiled from an SCM that has
918# kernel config option CONFIG_LOCALVERSION_AUTO is selected. Also, at the 923# been revised beyond a tagged commit, `+' is appended to the version string
919# moment, only git is supported but other SCMs can edit the script 924# when not overridden by using "make LOCALVERSION=". This indicates that the
920# scripts/setlocalversion and add the appropriate checks as needed. 925# kernel is not a vanilla release version and has been modified.
921 926
922pattern = ".*/localversion[^~]*" 927pattern = ".*/localversion[^~]*"
923string = $(shell cat /dev/null \ 928string = $(shell cat /dev/null \
@@ -926,26 +931,32 @@ string = $(shell cat /dev/null \
926localver = $(subst $(space),, $(string) \ 931localver = $(subst $(space),, $(string) \
927 $(patsubst "%",%,$(CONFIG_LOCALVERSION))) 932 $(patsubst "%",%,$(CONFIG_LOCALVERSION)))
928 933
929# If CONFIG_LOCALVERSION_AUTO is set scripts/setlocalversion is called 934# scripts/setlocalversion is called to create a unique identifier if the source
930# and if the SCM is know a tag from the SCM is appended. 935# is managed by a known SCM and the repository has been revised since the last
931# The appended tag is determined by the SCM used. 936# tagged (release) commit. The format of the identifier is determined by the
937# SCM's implementation.
932# 938#
933# .scmversion is used when generating rpm packages so we do not loose 939# .scmversion is used when generating rpm packages so we do not loose
934# the version information from the SCM when we do the build of the kernel 940# the version information from the SCM when we do the build of the kernel
935# from the copied source 941# from the copied source
936ifdef CONFIG_LOCALVERSION_AUTO
937
938ifeq ($(wildcard .scmversion),) 942ifeq ($(wildcard .scmversion),)
939 _localver-auto = $(shell $(CONFIG_SHELL) \ 943 scm-identifier = $(shell $(CONFIG_SHELL) \
940 $(srctree)/scripts/setlocalversion $(srctree)) 944 $(srctree)/scripts/setlocalversion $(srctree))
941else 945else
942 _localver-auto = $(shell cat .scmversion 2> /dev/null) 946 scm-identifier = $(shell cat .scmversion 2> /dev/null)
943endif 947endif
944 948
945 localver-auto = $(LOCALVERSION)$(_localver-auto) 949ifdef CONFIG_LOCALVERSION_AUTO
950 localver-extra = $(scm-identifier)
951else
952 ifneq ($scm-identifier,)
953 ifeq ($(LOCALVERSION),)
954 localver-extra = +
955 endif
956 endif
946endif 957endif
947 958
948localver-full = $(localver)$(localver-auto) 959localver-full = $(localver)$(LOCALVERSION)$(localver-extra)
949 960
950# Store (new) KERNELRELASE string in include/config/kernel.release 961# Store (new) KERNELRELASE string in include/config/kernel.release
951kernelrelease = $(KERNELVERSION)$(localver-full) 962kernelrelease = $(KERNELVERSION)$(localver-full)