-
Notifications
You must be signed in to change notification settings - Fork 0
/
patch-boot-KSU
executable file
·43 lines (34 loc) · 1.35 KB
/
patch-boot-KSU
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/bash
# Check if Android version and kernel version are provided as arguments
if [ $# -lt 2 ]; then
echo "Usage: $0 <ANDROID_VERSION> <KERNEL_VERSION>"
exit 1
fi
ANDROID_VERSION="$1"
KERNEL_VERSION="$2"
# Define BASE_DIR as the base directory of the script
BASE_DIR=$(dirname "$(realpath "$0")")
# Determine the appropriate --kmi argument based on versions
if [[ "$ANDROID_VERSION" == "12" && "$KERNEL_VERSION" == "5.10" ]]; then
KMI="android12-5.10"
elif [[ "$ANDROID_VERSION" == "13" && "$KERNEL_VERSION" == "5.10" ]]; then
KMI="android13-5.10"
elif [[ "$ANDROID_VERSION" == "13" && "$KERNEL_VERSION" == "5.15" ]]; then
KMI="android13-5.15"
elif [[ "$ANDROID_VERSION" == "14" && "$KERNEL_VERSION" == "5.15" ]]; then
KMI="android14-5.15"
elif [[ "$ANDROID_VERSION" == "14" && "$KERNEL_VERSION" == "6.1" ]]; then
KMI="android14-6.1"
elif [[ "$ANDROID_VERSION" == "15" && "$KERNEL_VERSION" == "6.6" ]]; then
KMI="android15-6.6"
else
echo "Unsupported Android or kernel version."
exit 1
fi
echo "Patching with --kmi $KMI..."
# Navigate to the bin directory where ksud and magiskboot_arm are located
cd bin
./ksud boot-patch -b "../boot.img" --magiskboot "./magiskboot_arm" --kmi "$KMI"
# Move the patched kernel files to the base directory
mv kernelsu_patched_* "$BASE_DIR"
echo "Patched kernel files moved to the base directory."