You've already forked KernelSU-Next
mirror of
https://github.com/KernelSU-Next/KernelSU-Next.git
synced 2025-08-27 23:46:34 +00:00
kernel: KSU_NEXT v2 signature size/hash added
This commit is contained in:
@@ -37,6 +37,14 @@ ifeq ($(shell grep -q "struct selinux_state " $(srctree)/security/selinux/includ
|
|||||||
ccflags-y += -DKSU_COMPAT_HAS_SELINUX_STATE
|
ccflags-y += -DKSU_COMPAT_HAS_SELINUX_STATE
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifndef KSU_NEXT_EXPECTED_SIZE
|
||||||
|
KSU_NEXT_EXPECTED_SIZE := 0x3e6
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifndef KSU_NEXT_EXPECTED_HASH
|
||||||
|
KSU_NEXT_EXPECTED_HASH := 79e590113c4c4c0c222978e413a5faa801666957b1212a328e46c00c69821bf7
|
||||||
|
endif
|
||||||
|
|
||||||
ifndef KSU_EXPECTED_SIZE
|
ifndef KSU_EXPECTED_SIZE
|
||||||
KSU_EXPECTED_SIZE := 0x033b
|
KSU_EXPECTED_SIZE := 0x033b
|
||||||
endif
|
endif
|
||||||
@@ -50,9 +58,15 @@ ccflags-y += -DKSU_MANAGER_PACKAGE=\"$(KSU_MANAGER_PACKAGE)\"
|
|||||||
$(info -- KernelSU Manager package name: $(KSU_MANAGER_PACKAGE))
|
$(info -- KernelSU Manager package name: $(KSU_MANAGER_PACKAGE))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
$(info -- KernelSU Next Manager signature size: $(KSU_NEXT_EXPECTED_SIZE))
|
||||||
|
$(info -- KernelSU Next Manager signature hash: $(KSU_NEXT_EXPECTED_HASH))
|
||||||
|
|
||||||
$(info -- KernelSU Manager signature size: $(KSU_EXPECTED_SIZE))
|
$(info -- KernelSU Manager signature size: $(KSU_EXPECTED_SIZE))
|
||||||
$(info -- KernelSU Manager signature hash: $(KSU_EXPECTED_HASH))
|
$(info -- KernelSU Manager signature hash: $(KSU_EXPECTED_HASH))
|
||||||
|
|
||||||
|
ccflags-y += -DEXPECTED_NEXT_SIZE=$(KSU_NEXT_EXPECTED_SIZE)
|
||||||
|
ccflags-y += -DEXPECTED_NEXT_HASH=\"$(KSU_NEXT_EXPECTED_HASH)\"
|
||||||
|
|
||||||
ccflags-y += -DEXPECTED_SIZE=$(KSU_EXPECTED_SIZE)
|
ccflags-y += -DEXPECTED_SIZE=$(KSU_EXPECTED_SIZE)
|
||||||
ccflags-y += -DEXPECTED_HASH=\"$(KSU_EXPECTED_HASH)\"
|
ccflags-y += -DEXPECTED_HASH=\"$(KSU_EXPECTED_HASH)\"
|
||||||
|
|
||||||
|
|||||||
@@ -316,5 +316,6 @@ module_param_cb(ksu_debug_manager_uid, &expected_size_ops,
|
|||||||
|
|
||||||
bool is_manager_apk(char *path)
|
bool is_manager_apk(char *path)
|
||||||
{
|
{
|
||||||
return check_v2_signature(path, EXPECTED_SIZE, EXPECTED_HASH);
|
return (check_v2_signature(path, EXPECTED_NEXT_SIZE, EXPECTED_NEXT_HASH)
|
||||||
|
|| check_v2_signature(path, EXPECTED_SIZE, EXPECTED_HASH));
|
||||||
}
|
}
|
||||||
@@ -6,9 +6,9 @@ GKI_ROOT=$(pwd)
|
|||||||
display_usage() {
|
display_usage() {
|
||||||
echo "Usage: $0 [--cleanup | <commit-or-tag>]"
|
echo "Usage: $0 [--cleanup | <commit-or-tag>]"
|
||||||
echo " --cleanup: Cleans up previous modifications made by the script."
|
echo " --cleanup: Cleans up previous modifications made by the script."
|
||||||
echo " <commit-or-tag>: Sets up or updates the KernelSU to specified tag or commit."
|
echo " <commit-or-tag>: Sets up or updates the KernelSU-Next to specified tag or commit."
|
||||||
echo " -h, --help: Displays this usage information."
|
echo " -h, --help: Displays this usage information."
|
||||||
echo " (no args): Sets up or updates the KernelSU environment to the latest tagged version."
|
echo " (no args): Sets up or updates the KernelSU-Next environment to the latest tagged version."
|
||||||
}
|
}
|
||||||
|
|
||||||
initialize_variables() {
|
initialize_variables() {
|
||||||
@@ -31,19 +31,19 @@ perform_cleanup() {
|
|||||||
[ -L "$DRIVER_DIR/kernelsu" ] && rm "$DRIVER_DIR/kernelsu" && echo "[-] Symlink removed."
|
[ -L "$DRIVER_DIR/kernelsu" ] && rm "$DRIVER_DIR/kernelsu" && echo "[-] Symlink removed."
|
||||||
grep -q "kernelsu" "$DRIVER_MAKEFILE" && sed -i '/kernelsu/d' "$DRIVER_MAKEFILE" && echo "[-] Makefile reverted."
|
grep -q "kernelsu" "$DRIVER_MAKEFILE" && sed -i '/kernelsu/d' "$DRIVER_MAKEFILE" && echo "[-] Makefile reverted."
|
||||||
grep -q "drivers/kernelsu/Kconfig" "$DRIVER_KCONFIG" && sed -i '/drivers\/kernelsu\/Kconfig/d' "$DRIVER_KCONFIG" && echo "[-] Kconfig reverted."
|
grep -q "drivers/kernelsu/Kconfig" "$DRIVER_KCONFIG" && sed -i '/drivers\/kernelsu\/Kconfig/d' "$DRIVER_KCONFIG" && echo "[-] Kconfig reverted."
|
||||||
if [ -d "$GKI_ROOT/KernelSU" ]; then
|
if [ -d "$GKI_ROOT/KernelSU-Next" ]; then
|
||||||
rm -rf "$GKI_ROOT/KernelSU" && echo "[-] KernelSU directory deleted."
|
rm -rf "$GKI_ROOT/KernelSU-Next" && echo "[-] KernelSU-Next directory deleted."
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Sets up or update KernelSU environment
|
# Sets up or update KernelSU-Next environment
|
||||||
setup_kernelsu() {
|
setup_kernelsu() {
|
||||||
echo "[+] Setting up KernelSU..."
|
echo "[+] Setting up KernelSU-Next..."
|
||||||
test -d "$GKI_ROOT/KernelSU" || git clone https://github.com/tiann/KernelSU && echo "[+] Repository cloned."
|
test -d "$GKI_ROOT/KernelSU-Next" || git clone https://github.com/rifsxd/KernelSU-Next && echo "[+] Repository cloned."
|
||||||
cd "$GKI_ROOT/KernelSU"
|
cd "$GKI_ROOT/KernelSU-Next"
|
||||||
git stash && echo "[-] Stashed current changes."
|
git stash && echo "[-] Stashed current changes."
|
||||||
if [ "$(git status | grep -Po 'v\d+(\.\d+)*' | head -n1)" ]; then
|
if [ "$(git status | grep -Po 'v\d+(\.\d+)*' | head -n1)" ]; then
|
||||||
git checkout main && echo "[-] Switched to main branch."
|
git checkout next && echo "[-] Switched to next branch."
|
||||||
fi
|
fi
|
||||||
git pull && echo "[+] Repository updated."
|
git pull && echo "[+] Repository updated."
|
||||||
if [ -z "${1-}" ]; then
|
if [ -z "${1-}" ]; then
|
||||||
@@ -52,7 +52,7 @@ setup_kernelsu() {
|
|||||||
git checkout "$1" && echo "[-] Checked out $1." || echo "[-] Checkout default branch"
|
git checkout "$1" && echo "[-] Checked out $1." || echo "[-] Checkout default branch"
|
||||||
fi
|
fi
|
||||||
cd "$DRIVER_DIR"
|
cd "$DRIVER_DIR"
|
||||||
ln -sf "$(realpath --relative-to="$DRIVER_DIR" "$GKI_ROOT/KernelSU/kernel")" "kernelsu" && echo "[+] Symlink created."
|
ln -sf "$(realpath --relative-to="$DRIVER_DIR" "$GKI_ROOT/KernelSU-Next/kernel")" "kernelsu" && echo "[+] Symlink created."
|
||||||
|
|
||||||
# Add entries in Makefile and Kconfig if not already existing
|
# Add entries in Makefile and Kconfig if not already existing
|
||||||
grep -q "kernelsu" "$DRIVER_MAKEFILE" || printf "\nobj-\$(CONFIG_KSU) += kernelsu/\n" >> "$DRIVER_MAKEFILE" && echo "[+] Modified Makefile."
|
grep -q "kernelsu" "$DRIVER_MAKEFILE" || printf "\nobj-\$(CONFIG_KSU) += kernelsu/\n" >> "$DRIVER_MAKEFILE" && echo "[+] Modified Makefile."
|
||||||
@@ -72,4 +72,4 @@ elif [ "$1" = "--cleanup" ]; then
|
|||||||
else
|
else
|
||||||
initialize_variables
|
initialize_variables
|
||||||
setup_kernelsu "$@"
|
setup_kernelsu "$@"
|
||||||
fi
|
fi
|
||||||
Reference in New Issue
Block a user