1
0

kernel-version.mk 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. # Use the default kernel version if the Makefile doesn't override it
  2. LINUX_RELEASE?=1
  3. ifdef CONFIG_TESTING_KERNEL
  4. KERNEL_PATCHVER:=$(KERNEL_TESTING_PATCHVER)
  5. endif
  6. KERNEL_DETAILS_FILE=$(INCLUDE_DIR)/kernel-$(KERNEL_PATCHVER)
  7. ifeq ($(wildcard $(KERNEL_DETAILS_FILE)),)
  8. $(error Missing kernel version/hash file for $(KERNEL_PATCHVER). Please create $(KERNEL_DETAILS_FILE))
  9. endif
  10. include $(KERNEL_DETAILS_FILE)
  11. ifdef KERNEL_TESTING_PATCHVER
  12. KERNEL_TESTING_DETAILS_FILE=$(INCLUDE_DIR)/kernel-$(KERNEL_TESTING_PATCHVER)
  13. ifeq ($(wildcard $(KERNEL_TESTING_DETAILS_FILE)),)
  14. $(error Missing kernel version/hash file for $(KERNEL_TESTING_PATCHVER). Please create $(KERNEL_TESTING_DETAILS_FILE))
  15. endif
  16. include $(KERNEL_TESTING_DETAILS_FILE)
  17. endif
  18. remove_uri_prefix=$(subst git://,,$(subst http://,,$(subst https://,,$(1))))
  19. sanitize_uri=$(call qstrip,$(subst @,_,$(subst :,_,$(subst .,_,$(subst -,_,$(subst /,_,$(1)))))))
  20. ifneq ($(call qstrip,$(CONFIG_KERNEL_GIT_CLONE_URI)),)
  21. LINUX_VERSION:=$(call sanitize_uri,$(call remove_uri_prefix,$(CONFIG_KERNEL_GIT_CLONE_URI)))
  22. ifeq ($(call qstrip,$(CONFIG_KERNEL_GIT_REF)),)
  23. CONFIG_KERNEL_GIT_REF:=HEAD
  24. endif
  25. LINUX_VERSION:=$(LINUX_VERSION)-$(call sanitize_uri,$(CONFIG_KERNEL_GIT_REF))
  26. else
  27. ifdef KERNEL_PATCHVER
  28. LINUX_VERSION:=$(KERNEL_PATCHVER)$(strip $(LINUX_VERSION-$(KERNEL_PATCHVER)))
  29. endif
  30. ifdef KERNEL_TESTING_PATCHVER
  31. LINUX_TESTING_VERSION:=$(KERNEL_TESTING_PATCHVER)$(strip $(LINUX_VERSION-$(KERNEL_TESTING_PATCHVER)))
  32. endif
  33. endif
  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. # disable the md5sum check for unknown kernel versions
  40. LINUX_KERNEL_HASH:=$(LINUX_KERNEL_HASH-$(strip $(LINUX_VERSION)))
  41. LINUX_KERNEL_HASH?=x