From 938e132d17a1068d9b1ad368f8b470ff0f880425 Mon Sep 17 00:00:00 2001 From: ShirkNeko <109797057+ShirkNeko@users.noreply.github.com> Date: Fri, 4 Apr 2025 15:38:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20Makefile=EF=BC=8C=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=20KSU=5FVERSION=20=E8=AE=A1=E7=AE=97=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E4=BB=A5=E8=8E=B7=E5=8F=96=20main=20=E5=88=86?= =?UTF-8?q?=E6=94=AF=E7=9A=84=E6=8F=90=E4=BA=A4=E6=95=B0=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel/Makefile | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/kernel/Makefile b/kernel/Makefile index 70a491c7..b91e19c3 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -47,20 +47,20 @@ endif obj-$(CONFIG_KSU) += kernelsu.o -KSU_MANUAL_VERSION := 12714 +#KSU_MANUAL_VERSION := 12714 ifeq ($(strip $(KSU_MANUAL_VERSION)),) ifeq ($(shell test -e $(srctree)/$(src)/../.git; echo $$?),0) $(shell cd $(srctree)/$(src); /usr/bin/env PATH="$$PATH":/usr/bin:/usr/local/bin [ -f ../.git/shallow ] && git fetch --unshallow) - KSU_GIT_VERSION := $(shell cd $(srctree)/$(src); /usr/bin/env PATH="$$PATH":/usr/bin:/usr/local/bin git rev-list --count HEAD) - # ksu_version: major * 10000 + git version + 500 for historical reasons - $(eval KSU_VERSION=$(shell expr 12000 + $(KSU_GIT_VERSION) + 500)) + # 获取 main 分支的提交数量 + KSU_GIT_VERSION := $(shell cd $(srctree)/$(src); /usr/bin/env PATH="$$PATH":/usr/bin:/usr/local/bin git rev-list --count main) + # 计算 KSU_VERSION + $(eval KSU_VERSION=$(shell expr 10000 + $(KSU_GIT_VERSION) + 606)) $(info -- KernelSU version (Git-based): $(KSU_VERSION)) ccflags-y += -DKSU_VERSION=$(KSU_VERSION) else - # .git is a text file while the module is imported by 'git submodule add'. $(warning "KSU_GIT_VERSION not defined! Using default version.") - KSU_VERSION := 12714 + KSU_VERSION := $(KSU_VERSION) $(info -- KernelSU version (Default): $(KSU_VERSION)) ccflags-y += -DKSU_VERSION=$(KSU_VERSION) endif