Change-Id: Iae93122929b9cb992bdfc714fd34711e86dd1602 Signed-off-by: Samuel Pascua <pascua.samuel.14@gmail.com>
92 lines
3.1 KiB
Makefile
92 lines
3.1 KiB
Makefile
kernelsu-objs := ksu.o
|
|
kernelsu-objs += allowlist.o
|
|
kernelsu-objs += apk_sign.o
|
|
kernelsu-objs += sucompat.o
|
|
kernelsu-objs += throne_tracker.o
|
|
kernelsu-objs += core_hook.o
|
|
kernelsu-objs += ksud.o
|
|
kernelsu-objs += embed_ksud.o
|
|
kernelsu-objs += kernel_compat.o
|
|
|
|
kernelsu-objs += selinux/selinux.o
|
|
kernelsu-objs += selinux/sepolicy.o
|
|
kernelsu-objs += selinux/rules.o
|
|
ccflags-y += -I$(srctree)/security/selinux -I$(srctree)/security/selinux/include
|
|
ccflags-y += -I$(objtree)/security/selinux -include $(srctree)/include/uapi/asm-generic/errno.h
|
|
|
|
obj-$(CONFIG_KSU) += kernelsu.o
|
|
|
|
ccflags-y += -DKSU_VERSION=12998
|
|
|
|
# Checks hooks state
|
|
ifeq ($(strip $(CONFIG_KSU_MANUAL_HOOK)),y)
|
|
$(info -- KernelSU: CONFIG_KSU_MANUAL_HOOK)
|
|
else
|
|
$(info -- KernelSU: CONFIG_KSU_KPROBES_HOOK)
|
|
ccflags-y += -DCONFIG_KSU_KPROBES_HOOK
|
|
endif
|
|
|
|
# SELinux drivers check
|
|
ifeq ($(shell grep -q "current_sid(void)" $(srctree)/security/selinux/include/objsec.h; echo $$?),0)
|
|
ccflags-y += -DKSU_COMPAT_HAS_CURRENT_SID
|
|
endif
|
|
ifeq ($(shell grep -q "struct selinux_state " $(srctree)/security/selinux/include/security.h; echo $$?),0)
|
|
ccflags-y += -DKSU_COMPAT_HAS_SELINUX_STATE
|
|
endif
|
|
|
|
# Handle optional backports
|
|
ifeq ($(shell grep -q "strncpy_from_user_nofault" $(srctree)/include/linux/uaccess.h; echo $$?),0)
|
|
ccflags-y += -DKSU_OPTIONAL_STRNCPY
|
|
endif
|
|
ifeq ($(shell grep -q "ssize_t kernel_read" $(srctree)/fs/read_write.c; echo $$?),0)
|
|
ccflags-y += -DKSU_OPTIONAL_KERNEL_READ
|
|
endif
|
|
ifeq ($(shell grep "ssize_t kernel_write" $(srctree)/fs/read_write.c | grep -q "const void" ; echo $$?),0)
|
|
ccflags-y += -DKSU_OPTIONAL_KERNEL_WRITE
|
|
endif
|
|
ifeq ($(shell grep -q "int\s\+path_umount" $(srctree)/fs/namespace.c; echo $$?),0)
|
|
ccflags-y += -DKSU_HAS_PATH_UMOUNT
|
|
endif
|
|
|
|
# Checks Samsung UH drivers
|
|
ifeq ($(shell grep -q "CONFIG_KDP_CRED" $(srctree)/kernel/cred.c; echo $$?),0)
|
|
ccflags-y += -DSAMSUNG_UH_DRIVER_EXIST
|
|
endif
|
|
|
|
# Samsung SELinux Porting
|
|
ifeq ($(shell grep -q "SEC_SELINUX_PORTING_COMMON" $(srctree)/security/selinux/avc.c; echo $$?),0)
|
|
ccflags-y += -DSAMSUNG_SELINUX_PORTING
|
|
endif
|
|
|
|
# Custom Signs
|
|
ifdef KSU_EXPECTED_SIZE
|
|
ccflags-y += -DEXPECTED_SIZE=$(KSU_EXPECTED_SIZE)
|
|
$(info -- Custom KernelSU Manager signature size: $(KSU_EXPECTED_SIZE))
|
|
endif
|
|
ifdef KSU_EXPECTED_HASH
|
|
ccflags-y += -DEXPECTED_HASH=\"$(KSU_EXPECTED_HASH)\"
|
|
$(info -- Custom KernelSU Manager signature hash: $(KSU_EXPECTED_HASH))
|
|
endif
|
|
|
|
ifdef KSU_MANAGER_PACKAGE
|
|
ccflags-y += -DKSU_MANAGER_PACKAGE=\"$(KSU_MANAGER_PACKAGE)\"
|
|
$(info -- KernelSU Manager package name: $(KSU_MANAGER_PACKAGE))
|
|
endif
|
|
|
|
$(info -- Supported KernelSU Manager(s): tiann, rsuntk, 5ec1cff)
|
|
|
|
ccflags-y += -Wno-implicit-function-declaration -Wno-strict-prototypes -Wno-int-conversion -Wno-gcc-compat
|
|
ccflags-y += -Wno-declaration-after-statement -Wno-unused-function
|
|
|
|
## For susfs stuff ##
|
|
ifeq ($(shell test -e $(srctree)/fs/susfs.c; echo $$?),0)
|
|
$(eval SUSFS_VERSION=$(shell cat $(srctree)/include/linux/susfs.h | grep -E '^#define SUSFS_VERSION' | cut -d' ' -f3 | sed 's/"//g'))
|
|
$(info )
|
|
$(info -- SUSFS_VERSION: $(SUSFS_VERSION))
|
|
else
|
|
$(info -- You have not integrate susfs in your kernel.)
|
|
$(info -- Read: https://gitlab.com/simonpunk/susfs4ksu)
|
|
endif
|
|
|
|
# Keep a new line here!! Because someone may append config
|