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