b8efdeb9907057ea2a8c154b12b8e2ccd74302f8
[librecmc/librecmc.git] / include / kernel-version.mk
1 # Use the default kernel version if the Makefile doesn't override it
2
3 LINUX_RELEASE?=1
4
5 ifdef CONFIG_TESTING_KERNEL
6   KERNEL_PATCHVER:=$(KERNEL_TESTING_PATCHVER)
7 endif
8
9 LINUX_VERSION-4.14 = .273
10 LIBRE_REV = 1
11
12 LINUX_KERNEL_HASH-4.14.273 = 100ac3b4b0023c2e7f4e47234497ab96c8188e0a563805aede5afc7326e496db
13
14 remove_uri_prefix=$(subst git://,,$(subst http://,,$(subst https://,,$(1))))
15 sanitize_uri=$(call qstrip,$(subst @,_,$(subst :,_,$(subst .,_,$(subst -,_,$(subst /,_,$(1)))))))
16
17 ifneq ($(call qstrip,$(CONFIG_KERNEL_GIT_CLONE_URI)),)
18   LINUX_VERSION:=$(call sanitize_uri,$(call remove_uri_prefix,$(CONFIG_KERNEL_GIT_CLONE_URI)))
19   ifeq ($(call qstrip,$(CONFIG_KERNEL_GIT_REF)),)
20     CONFIG_KERNEL_GIT_REF:=HEAD
21   endif
22   LINUX_VERSION:=$(LINUX_VERSION)-$(call sanitize_uri,$(CONFIG_KERNEL_GIT_REF))
23 else
24 ifdef KERNEL_PATCHVER
25   LINUX_VERSION:=$(KERNEL_PATCHVER)$(strip $(LINUX_VERSION-$(KERNEL_PATCHVER)))
26 endif
27 ifdef KERNEL_TESTING_PATCHVER
28   LINUX_TESTING_VERSION:=$(KERNEL_TESTING_PATCHVER)$(strip $(LINUX_VERSION-$(KERNEL_TESTING_PATCHVER)))
29 endif
30 endif
31
32 split_version=$(subst ., ,$(1))
33 merge_version=$(subst $(space),.,$(1))
34 KERNEL_BASE=$(firstword $(subst -, ,$(LINUX_VERSION)))
35 KERNEL=$(call merge_version,$(wordlist 1,2,$(call split_version,$(KERNEL_BASE))))
36 KERNEL_PATCHVER ?= $(KERNEL)
37
38 # disable the md5sum check for unknown kernel versions
39 LINUX_KERNEL_HASH:=$(LINUX_KERNEL_HASH-$(strip $(LINUX_VERSION)))
40 LINUX_KERNEL_HASH?=x