-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit a640a24
Showing
10 changed files
with
478 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Auto detect text files and perform LF normalization | ||
* text=auto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
|
||
*.ko | ||
*.zip |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/sbin/sh | ||
|
||
################# | ||
# Initialization | ||
################# | ||
|
||
umask 022 | ||
|
||
# echo before loading util_functions | ||
ui_print() { echo "$1"; } | ||
|
||
require_new_magisk() { | ||
ui_print "*******************************" | ||
ui_print " Please install Magisk v20.4+! " | ||
ui_print "*******************************" | ||
exit 1 | ||
} | ||
|
||
######################### | ||
# Load util_functions.sh | ||
######################### | ||
|
||
OUTFD=$2 | ||
ZIPFILE=$3 | ||
|
||
mount /data 2>/dev/null | ||
|
||
[ -f /data/adb/magisk/util_functions.sh ] || require_new_magisk | ||
. /data/adb/magisk/util_functions.sh | ||
[ $MAGISK_VER_CODE -lt 20400 ] && require_new_magisk | ||
|
||
install_module | ||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#MAGISK |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Kernel Module Loader | ||
利用Magisk/KernelSU在开机后加载内核模块 | ||
|
||
## 使用方法 | ||
|
||
### 1、克隆本仓库 | ||
``` | ||
git clone https://github.com/natsumerinchan/Kernel_Module_Loader.git | ||
``` | ||
|
||
### 2、将内核模块放入kernel_module目录 | ||
|
||
### 3、修改customize.sh | ||
|
||
- `MODULES_ARCH` 此项可限制模块的cpu架构 | ||
|
||
- 限定内核版本 | ||
``` | ||
# Check Kernel Version | ||
kernel_version=$(uname -r | awk -F '-' '{print $1}') | ||
case "$kernel_version" in | ||
5.4.*) supported=true ;; | ||
4.19.*) supported=true ;; | ||
*) supported=false ;; | ||
esac | ||
``` | ||
|
||
- 要求内核开启某些配置 | ||
``` | ||
config_list=" | ||
CONFIG_MODULES | ||
CONFIG_KPROBES | ||
CONFIG_HAVE_KPROBES | ||
CONFIG_KPROBE_EVENTS | ||
" | ||
``` | ||
|
||
### 4、修改module.prop | ||
这个无需多讲,爱怎么改就怎么改 | ||
|
||
### 5、制作模块 | ||
``` | ||
zip -r MODULE_NAME.zip * -x .git ./kernel_module/.placeholder .gitattributes .gitgnore | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
SKIPUNZIP=0 | ||
MODULES_ARCH=arm64 | ||
|
||
# Check Device Platform | ||
if [ "$ARCH" != "$MODULES_ARCH" ]; then | ||
abort "! Unsupport platform: $ARCH" | ||
else | ||
ui_print "- Device platform: $ARCH" | ||
fi | ||
|
||
ui_print "- API Level: $API" | ||
|
||
# Check Kernel Version | ||
kernel_version=$(uname -r | awk -F '-' '{print $1}') | ||
case "$kernel_version" in | ||
5.4.*) supported=true ;; | ||
4.19.*) supported=true ;; | ||
*) supported=false ;; | ||
esac | ||
|
||
if [ ! $supported ]; then | ||
abort "! Unsupport Kernel Version: $kernel_version" | ||
else | ||
ui_print "- Kernel Version: $kernel_version" | ||
fi | ||
|
||
# Check Kernel Configs | ||
ui_print "- Check Kernel Configs..." | ||
config_list=" | ||
CONFIG_MODULES | ||
CONFIG_KPROBES | ||
CONFIG_HAVE_KPROBES | ||
CONFIG_KPROBE_EVENTS | ||
" | ||
for config_name in $config_list | ||
do | ||
(zcat /proc/config.gz | grep "$config_name=y") || abort "! Your Kernel has not enabled $config_name !" | ||
done |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
id=Kernel_Module_Loader | ||
name=Kernel Module Loader | ||
version=v1.0.0 | ||
versionCode=100 | ||
author=natsumerinchan | ||
description=利用Magisk/KernelSU在开机后加载内核模块 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/system/bin/sh | ||
MODDIR=${0%/*} | ||
MODULE_DIR=$MODDIR/kernel_module | ||
while [ "$(getprop sys.boot_completed)" != "1" ] || [ ! -e "$MODULE_DIR" ]; do | ||
sleep 3 | ||
done | ||
|
||
module_list=$(ls $MODULE_DIR) | ||
for module_name in $module_list | ||
do | ||
insmod $MODULE_DIR/$module_name | ||
done |