Skip to content

Commit

Permalink
drivers: KernelSU: Add KernelSU
Browse files Browse the repository at this point in the history
  • Loading branch information
utziacre authored and LesGaR committed Aug 20, 2023
1 parent 01e398c commit 842a985
Show file tree
Hide file tree
Showing 33 changed files with 5,094 additions and 0 deletions.
17 changes: 17 additions & 0 deletions drivers/kernelsu/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
menu "KernelSU"

config KSU
tristate "KernelSU function support"
select OVERLAY_FS
default y
help
Enable kernel-level root privileges on Android System.

config KSU_DEBUG
bool "KernelSU debug mode"
depends on KSU
default n
help
Enable KernelSU debug mode

endmenu
339 changes: 339 additions & 0 deletions drivers/kernelsu/LICENSE

Large diffs are not rendered by default.

41 changes: 41 additions & 0 deletions drivers/kernelsu/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
obj-y += ksu.o
obj-y += allowlist.o
kernelsu-objs := apk_sign.o
obj-y += kernelsu.o
obj-y += module_api.o
obj-y += sucompat.o
obj-y += uid_observer.o
obj-y += manager.o
obj-y += core_hook.o
obj-y += ksud.o
obj-y += embed_ksud.o
obj-y += kernel_compat.o

obj-y += selinux/
# .git is a text file while the module is imported by 'git submodule add'.
ifeq ($(shell test -e $(srctree)/$(src)/../.git; echo $$?),0)
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 + 200 for historical reasons
$(eval KSU_VERSION=$(shell expr 10000 + $(KSU_GIT_VERSION) + 200))
$(info -- KernelSU version: $(KSU_VERSION))
ccflags-y += -DKSU_VERSION=$(KSU_VERSION)
else # If there is no .git file, the default version will be passed.
$(warning "KSU_GIT_VERSION not defined! It is better to make KernelSU a git submodule!")
ccflags-y += -DKSU_VERSION=16
endif

ifndef KSU_EXPECTED_SIZE
KSU_EXPECTED_SIZE := 0x033b
endif

ifndef KSU_EXPECTED_HASH
KSU_EXPECTED_HASH := 0xb0b91415
endif

$(info -- KernelSU Manager signature size: $(KSU_EXPECTED_SIZE))
$(info -- KernelSU Manager signature hash: $(KSU_EXPECTED_HASH))

ccflags-y += -DEXPECTED_SIZE=$(KSU_EXPECTED_SIZE)
ccflags-y += -DEXPECTED_HASH=$(KSU_EXPECTED_HASH)
ccflags-y += -Wno-implicit-function-declaration -Wno-strict-prototypes -Wno-int-conversion -Wno-gcc-compat
ccflags-y += -Wno-declaration-after-statement
Loading

0 comments on commit 842a985

Please sign in to comment.