You've already forked KernelSU
mirror of
https://github.com/tiann/KernelSU.git
synced 2025-08-27 23:46:34 +00:00
kernel: Use CONFIG_KSU=m to compile lkm (#1468)
before: CONFIG_KSU=y CONFIG_KSU_MODULE=y after: CONFIG_KSU=m --------- Signed-off-by: dabao1955 <dabao1955@163.com> Co-authored-by: weishu <twsxtd@gmail.com>
This commit is contained in:
6
.github/workflows/gki-kernel.yml
vendored
6
.github/workflows/gki-kernel.yml
vendored
@@ -128,7 +128,9 @@ jobs:
|
|||||||
ln -sf $GITHUB_WORKSPACE/KernelSU/kernel $GKI_ROOT/common/drivers/kernelsu
|
ln -sf $GITHUB_WORKSPACE/KernelSU/kernel $GKI_ROOT/common/drivers/kernelsu
|
||||||
echo "[+] Add KernelSU driver to Makefile"
|
echo "[+] Add KernelSU driver to Makefile"
|
||||||
DRIVER_MAKEFILE=$GKI_ROOT/common/drivers/Makefile
|
DRIVER_MAKEFILE=$GKI_ROOT/common/drivers/Makefile
|
||||||
grep -q "kernelsu" $DRIVER_MAKEFILE || printf "\nobj-y += kernelsu/\n" >> $DRIVER_MAKEFILE
|
DRIVER_KCONFIG=$GKI_ROOT/common/drivers/Kconfig
|
||||||
|
grep -q "kernelsu" "$DRIVER_MAKEFILE" || printf "\nobj-\$(CONFIG_KSU) += kernelsu/\n" >> "$DRIVER_MAKEFILE"
|
||||||
|
grep -q "kernelsu" "$DRIVER_KCONFIG" || sed -i "/endmenu/i\\source \"drivers/kernelsu/Kconfig\"" "$DRIVER_KCONFIG"
|
||||||
echo "[+] Apply KernelSU patches"
|
echo "[+] Apply KernelSU patches"
|
||||||
cd $GKI_ROOT/common/ && git apply $GITHUB_WORKSPACE/KernelSU/.github/patches/$PATCH_PATH/*.patch || echo "[-] No patch found"
|
cd $GKI_ROOT/common/ && git apply $GITHUB_WORKSPACE/KernelSU/.github/patches/$PATCH_PATH/*.patch || echo "[-] No patch found"
|
||||||
|
|
||||||
@@ -166,7 +168,7 @@ jobs:
|
|||||||
sudo apt-get install llvm-15 -y
|
sudo apt-get install llvm-15 -y
|
||||||
ast-grep -U -p '$$$ check_exports($$$) {$$$}' -r '' common/scripts/mod/modpost.c
|
ast-grep -U -p '$$$ check_exports($$$) {$$$}' -r '' common/scripts/mod/modpost.c
|
||||||
ast-grep -U -p 'check_exports($$$);' -r '' common/scripts/mod/modpost.c
|
ast-grep -U -p 'check_exports($$$);' -r '' common/scripts/mod/modpost.c
|
||||||
sed -i '1i KSU_MODULE := 1' $GITHUB_WORKSPACE/KernelSU/kernel/Makefile
|
sed -i '/config KSU/,/help/{s/default y/default m/}' common/drivers/kernelsu/Kconfig
|
||||||
echo "drivers/kernelsu/kernelsu.ko" >> common/android/gki_aarch64_modules
|
echo "drivers/kernelsu/kernelsu.ko" >> common/android/gki_aarch64_modules
|
||||||
|
|
||||||
# bazel build, android14-5.15, android14-6.1 use bazel
|
# bazel build, android14-5.15, android14-6.1 use bazel
|
||||||
|
|||||||
@@ -6,19 +6,14 @@ config KSU
|
|||||||
default y
|
default y
|
||||||
help
|
help
|
||||||
Enable kernel-level root privileges on Android System.
|
Enable kernel-level root privileges on Android System.
|
||||||
|
To compile as a module, choose M here: the
|
||||||
|
module will be called kernelsu.
|
||||||
|
|
||||||
config KSU_DEBUG
|
config KSU_DEBUG
|
||||||
bool "KernelSU debug mode"
|
bool "KernelSU debug mode"
|
||||||
depends on KSU
|
depends on KSU
|
||||||
default n
|
default n
|
||||||
help
|
help
|
||||||
Enable KernelSU debug mode
|
Enable KernelSU debug mode.
|
||||||
|
|
||||||
config KSU_MODULE
|
|
||||||
bool "Build KernelSU as a module"
|
|
||||||
depends on KSU
|
|
||||||
default n
|
|
||||||
help
|
|
||||||
Build KernelSU as a loadable kernel module
|
|
||||||
|
|
||||||
endmenu
|
endmenu
|
||||||
|
|||||||
@@ -16,11 +16,7 @@ kernelsu-objs += selinux/rules.o
|
|||||||
ccflags-y += -I$(srctree)/security/selinux -I$(srctree)/security/selinux/include
|
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
|
ccflags-y += -I$(objtree)/security/selinux -include $(srctree)/include/uapi/asm-generic/errno.h
|
||||||
|
|
||||||
ifndef KSU_MODULE
|
obj-$(CONFIG_KSU) += kernelsu.o
|
||||||
obj-y += kernelsu.o
|
|
||||||
else
|
|
||||||
obj-m += kernelsu.o
|
|
||||||
endif
|
|
||||||
|
|
||||||
# .git is a text file while the module is imported by 'git submodule add'.
|
# .git is a text file while the module is imported by 'git submodule add'.
|
||||||
ifeq ($(shell test -e $(srctree)/$(src)/../.git; echo $$?),0)
|
ifeq ($(shell test -e $(srctree)/$(src)/../.git; echo $$?),0)
|
||||||
|
|||||||
Reference in New Issue
Block a user