From 067b533c9e25ad0e767d8b60d3c9965e382ce256 Mon Sep 17 00:00:00 2001 From: Tomaz Zaman Date: Mon, 10 Aug 2026 13:50:50 +0200 Subject: [PATCH 01/72] build: allow targets to name a git-cloned kernel With CONFIG_KERNEL_GIT_CLONE_URI, LINUX_VERSION is derived by sanitizing the URI and ref. The result is not a valid apk package version (it does not start with a digit), so the kernel and every kmod package fail at mkpkg. Let a target set KERNEL_GIT_LINUX_VERSION to the real kernel version; fall back to the sanitized string as before. Co-Authored-By: Claude Fable 5 --- include/kernel-version.mk | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/include/kernel-version.mk b/include/kernel-version.mk index 5e2bff4542..52dc1a6a4d 100644 --- a/include/kernel-version.mk +++ b/include/kernel-version.mk @@ -26,11 +26,19 @@ 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 + # A target may set KERNEL_GIT_LINUX_VERSION to a real kernel version to + # use instead of the sanitized URI+ref. The sanitized fallback is not a + # valid apk package version (must start with a digit), so any target + # using a git kernel with apk packaging needs this set. + ifneq ($(KERNEL_GIT_LINUX_VERSION),) + LINUX_VERSION:=$(KERNEL_GIT_LINUX_VERSION) + else + 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)) 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))) -- 2.47.3