From: Alexandru Ardelean Date: Mon, 15 Jan 2018 14:50:38 +0000 (+0200) Subject: kernel.mk: update LINUX_VERSION filename for cloned repo X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=953bf6b43d50492a96a9bac692f4d99dd804b31f;p=openwrt%2Fstaging%2Fnbd.git kernel.mk: update LINUX_VERSION filename for cloned repo In case there is an external git repo specified, it could overwrite the kernel tarball that was downloaded from kernel.org. The only identifier for such a file is the KERNEL_GIT_CLONE_URI & KERNEL_GIT_REF symbols, so if we have to download it we'll use that information [after some sanitization] to create a different filename for the kernel tarball. If KERNEL_GIT_REF symbol is empty, HEAD will be used as mentioned in the description of KERNEL_GIT_REF. Signed-off-by: Alexandru Ardelean --- diff --git a/include/kernel-version.mk b/include/kernel-version.mk index 6103cee63a..05b7a0d9c6 100644 --- a/include/kernel-version.mk +++ b/include/kernel-version.mk @@ -12,9 +12,20 @@ LINUX_KERNEL_HASH-4.4.112 = 544b42cbeed022896115c76a18fc97b4507d5b41d7ac0ce1dce9 LINUX_KERNEL_HASH-4.9.77 = 7c29bc3fb96f1e23d98f664e786dddd53a1599f56431b9b7fdfba402a4b3705c LINUX_KERNEL_HASH-4.14.14 = 8b96362eb55ae152555980e7193fe2585b487176fb936cc69b8947d7dd32044a +remove_uri_prefix=$(subst git://,,$(subst http://,,$(subst https://,,$(1)))) +sanitize_uri=$(call qstrip,$(subst @,_,$(subst :,_,$(subst .,_,$(subst -,_,$(subst /,_,$(1))))))) + +ifneq ($(call qstrip,$(CONFIG_KERNEL_GIT_CLONE_URI)),) + LINUX_VERSION:=$(call sanitize_uri,$(call remove_uri_prefix,$(CONFIG_KERNEL_GIT_CLONE_URI))) + ifeq ($(call qstrip,$(CONFIG_KERNEL_GIT_REF)),) + CONFIG_KERNEL_GIT_REF:=HEAD + endif + LINUX_VERSION:=$(LINUX_VERSION)-$(call sanitize_uri,$(CONFIG_KERNEL_GIT_REF)) +else ifdef KERNEL_PATCHVER LINUX_VERSION:=$(KERNEL_PATCHVER)$(strip $(LINUX_VERSION-$(KERNEL_PATCHVER))) endif +endif split_version=$(subst ., ,$(1)) merge_version=$(subst $(space),.,$(1))