diff --git a/kernel/Makefile b/kernel/Makefile index 6ef4262d..15b9a3f1 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -78,6 +78,8 @@ $(info -- KernelSU Manager signature size: $(KSU_EXPECTED_SIZE)) $(info -- KernelSU Manager signature hash: $(KSU_EXPECTED_HASH)) $(info -- Supported Unofficial Manager: 5ec1cff (GKI) rsuntk (Non-GKI) ShirkNeko udochina (GKI and non-GKI and KPM)) KERNEL_VERSION := $(VERSION).$(PATCHLEVEL) + +# 检查KPM是否开启 $(info -- KERNEL_VERSION: $(KERNEL_VERSION)) ifeq ($(CONFIG_KPM),y) $(info -- KPM is enabled) @@ -85,6 +87,16 @@ else $(info -- KPM is disabled) endif +# 检查原子函数 +ifeq ($(shell grep -q "atomic_inc_not_zero" $(srctree)/kernel/cred.c; echo $$?),0) +ATOMIC_INC_FUNC = atomic_inc_not_zero +else ifeq ($(shell grep -q "atomic_long_inc_not_zero" $(srctree)/kernel/cred.c; echo $$?),0) +ATOMIC_INC_FUNC = atomic_long_inc_not_zero +else +$(info -- KSU_SUSFS: Neither atomic_inc_not_zero nor atomic_long_inc_not_zero found in kernel/cred.c) +endif + +# 写入签名 ccflags-y += -DEXPECTED_SIZE=$(KSU_EXPECTED_SIZE) ccflags-y += -DEXPECTED_HASH=\"$(KSU_EXPECTED_HASH)\" @@ -127,14 +139,6 @@ ifeq ($(shell grep -q "CONFIG_KDP_CRED" $(srctree)/kernel/cred.c; echo $$?),0) ccflags-y += -DSAMSUNG_UH_DRIVER_EXIST endif -# 检查原子函数 -ifeq ($(shell grep -q "atomic_inc_not_zero" $(srctree)/kernel/cred.c; echo $$?),0) -ATOMIC_INC_FUNC = atomic_inc_not_zero -else ifeq ($(shell grep -q "atomic_long_inc_not_zero" $(srctree)/kernel/cred.c; echo $$?),0) -ATOMIC_INC_FUNC = atomic_long_inc_not_zero -else -$(info -- KSU_SUSFS: Neither atomic_inc_not_zero nor atomic_long_inc_not_zero found in kernel/cred.c) -endif # 添加 get_cred_rcu 函数 ifneq ($(shell grep -Eq "^static inline const struct cred \*get_cred_rcu" $(srctree)/include/linux/cred.h; echo $$?),0)