|
| 1 | +kernelsu-objs := ksu.o |
| 2 | +kernelsu-objs += allowlist.o |
| 3 | +kernelsu-objs += apk_sign.o |
| 4 | +kernelsu-objs += sucompat.o |
| 5 | +kernelsu-objs += throne_tracker.o |
| 6 | +kernelsu-objs += core_hook.o |
| 7 | +kernelsu-objs += ksud.o |
| 8 | +kernelsu-objs += embed_ksud.o |
| 9 | +kernelsu-objs += kernel_compat.o |
| 10 | + |
| 11 | +kernelsu-objs += selinux/selinux.o |
| 12 | +kernelsu-objs += selinux/sepolicy.o |
| 13 | +kernelsu-objs += selinux/rules.o |
| 14 | +ccflags-y += -I$(srctree)/security/selinux -I$(srctree)/security/selinux/include |
| 15 | +ccflags-y += -I$(objtree)/security/selinux -include $(srctree)/include/uapi/asm-generic/errno.h |
| 16 | + |
| 17 | +obj-$(CONFIG_KSU) += kernelsu.o |
| 18 | + |
| 19 | +# .git is a text file while the module is imported by 'git submodule add'. |
| 20 | +ifeq ($(shell test -e $(srctree)/$(src)/../.git; echo $$?),0) |
| 21 | +$(shell cd $(srctree)/$(src); /usr/bin/env PATH="$$PATH":/usr/bin:/usr/local/bin [ -f ../.git/shallow ] && git fetch --unshallow) |
| 22 | +KSU_GIT_VERSION := $(shell cd $(srctree)/$(src); /usr/bin/env PATH="$$PATH":/usr/bin:/usr/local/bin git rev-list --count HEAD) |
| 23 | +# ksu_version: major * 10000 + git version + 200 for historical reasons |
| 24 | +$(eval KSU_VERSION=$(shell expr 10000 + $(KSU_GIT_VERSION) + 200)) |
| 25 | +$(info -- KernelSU version: $(KSU_VERSION)) |
| 26 | +else # If there is no .git file, the default version will be passed. |
| 27 | +endif |
| 28 | + |
| 29 | +ifeq ($(shell grep -q " current_sid(void)" $(srctree)/security/selinux/include/objsec.h; echo $$?),0) |
| 30 | +ccflags-y += -DKSU_COMPAT_HAS_CURRENT_SID |
| 31 | +endif |
| 32 | + |
| 33 | +ifeq ($(shell grep -q "struct selinux_state " $(srctree)/security/selinux/include/security.h; echo $$?),0) |
| 34 | +ccflags-y += -DKSU_COMPAT_HAS_SELINUX_STATE |
| 35 | +endif |
| 36 | + |
| 37 | +ifndef KSU_EXPECTED_SIZE |
| 38 | +KSU_EXPECTED_SIZE := 0x033b |
| 39 | +endif |
| 40 | + |
| 41 | +ifndef KSU_EXPECTED_HASH |
| 42 | +KSU_EXPECTED_HASH := c371061b19d8c7d7d6133c6a9bafe198fa944e50c1b31c9d8daa8d7f1fc2d2d6 |
| 43 | +endif |
| 44 | + |
| 45 | +ifdef KSU_MANAGER_PACKAGE |
| 46 | +ccflags-y += -DKSU_MANAGER_PACKAGE=\"$(KSU_MANAGER_PACKAGE)\" |
| 47 | +$(info -- KernelSU Manager package name: $(KSU_MANAGER_PACKAGE)) |
| 48 | +endif |
| 49 | + |
| 50 | +$(info -- KernelSU Manager signature size: $(KSU_EXPECTED_SIZE)) |
| 51 | +$(info -- KernelSU Manager signature hash: $(KSU_EXPECTED_HASH)) |
| 52 | + |
| 53 | +ccflags-y += -DEXPECTED_SIZE=$(KSU_EXPECTED_SIZE) |
| 54 | +ccflags-y += -DEXPECTED_HASH=\"$(KSU_EXPECTED_HASH)\" |
| 55 | + |
| 56 | +ifeq ($(shell grep -q "int path_umount" $(srctree)/fs/namespace.c; echo $$?),0) |
| 57 | +ccflags-y += -DKSU_UMOUNT |
| 58 | +else |
| 59 | +$(info -- Did you know you can backport path_umount to fs/namespace.c from 5.9?) |
| 60 | +$(info -- Read: https://kernelsu.org/guide/how-to-integrate-for-non-gki.html#how-to-backport-path-umount) |
| 61 | +endif |
| 62 | + |
| 63 | +ccflags-y += -Wno-implicit-function-declaration -Wno-strict-prototypes -Wno-int-conversion -Wno-gcc-compat |
| 64 | +ccflags-y += -Wno-declaration-after-statement -Wno-unused-function |
| 65 | + |
| 66 | +# Keep a new line here!! Because someone may append config |
| 67 | + |
| 68 | +ccflags-y += -DKSU_VERSION=12030 |
0 commit comments