kernel: allow use without git submodule

This commit is contained in:
weishu
2023-02-06 15:30:58 +07:00
parent ad4d8e939e
commit c2ac548ac7
2 changed files with 4 additions and 8 deletions

View File

@@ -13,16 +13,11 @@ obj-y += kernel_compat.o
obj-y += selinux/ obj-y += selinux/
ifeq ($(shell test -d $(srctree)/$(src)/../.git; echo $$?),0)
# We must use the absolute path to git, otherwise the build will fail if git is not in the PATH # We must use the absolute path to git, otherwise the build will fail if git is not in the PATH
KSU_GIT_VERSION := $(shell cd $(srctree)/$(src);/usr/bin/git rev-list --count HEAD) KSU_GIT_VERSION := $(shell cd $(srctree)/$(src);/usr/bin/git rev-list --count HEAD)
ifeq ($(KSU_GIT_VERSION),)
$(error Get git version failed, please make sure git is installed in /usr/bin/git)
endif
ifeq ($(shell test $(KSU_GIT_VERSION) -gt 10000; echo $$?),0)
$(error The way you configure KernelSU is wrong, please use submodule and make sure it is a single git repo)
endif
ccflags-y += -DKSU_GIT_VERSION=$(KSU_GIT_VERSION) ccflags-y += -DKSU_GIT_VERSION=$(KSU_GIT_VERSION)
endif
ifndef EXPECTED_SIZE ifndef EXPECTED_SIZE
EXPECTED_SIZE := 0x033b EXPECTED_SIZE := 0x033b

View File

@@ -4,7 +4,8 @@
#include "linux/workqueue.h" #include "linux/workqueue.h"
#ifndef KSU_GIT_VERSION #ifndef KSU_GIT_VERSION
#error "KSU_GIT_VERSION not defined! Please check Makefile." #warning "KSU_GIT_VERSION not defined! It is better to make KernelSU a git submodule!"
#define KERNEL_SU_VERSION (16)
#else #else
#define KERNEL_SU_VERSION (10000 + KSU_GIT_VERSION + 200) // major * 10000 + git version + 200 for historical reasons #define KERNEL_SU_VERSION (10000 + KSU_GIT_VERSION + 200) // major * 10000 + git version + 200 for historical reasons
#endif #endif