kernel: Support switch branch or tag (#382)
This commit is contained in:
@@ -18,7 +18,11 @@ fi
|
|||||||
test -d "$GKI_ROOT/KernelSU" || git clone https://github.com/tiann/KernelSU
|
test -d "$GKI_ROOT/KernelSU" || git clone https://github.com/tiann/KernelSU
|
||||||
cd "$GKI_ROOT/KernelSU"
|
cd "$GKI_ROOT/KernelSU"
|
||||||
git stash && git pull
|
git stash && git pull
|
||||||
git checkout "$(git describe --abbrev=0 --tags)"
|
if [ ! "$1" ]; then
|
||||||
|
git checkout "$(git describe --abbrev=0 --tags)"
|
||||||
|
else
|
||||||
|
git checkout "$1"
|
||||||
|
fi
|
||||||
cd "$GKI_ROOT"
|
cd "$GKI_ROOT"
|
||||||
|
|
||||||
echo "[+] GKI_ROOT: $GKI_ROOT"
|
echo "[+] GKI_ROOT: $GKI_ROOT"
|
||||||
|
|||||||
@@ -42,10 +42,24 @@ tools/bazel build --config=fast //common:kernel_aarch64_dist
|
|||||||
|
|
||||||
## Build Kernel with KernelSU
|
## Build Kernel with KernelSU
|
||||||
|
|
||||||
If you can build the kernel successfully, then build KernelSU is so easy, run this command in Kernel source root dir:
|
If you can build the kernel successfully, then build KernelSU is so easy, Select any one run in Kernel source root dir:
|
||||||
|
|
||||||
|
- Latest tag(stable)
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash -
|
curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash -
|
||||||
```
|
```
|
||||||
|
|
||||||
|
- main branch(dev)
|
||||||
|
|
||||||
|
```sh
|
||||||
|
curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash -s main
|
||||||
|
```
|
||||||
|
|
||||||
|
- Select tag(Such as v0.5.2)
|
||||||
|
|
||||||
|
```sh
|
||||||
|
curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash -s v0.5.2
|
||||||
|
```
|
||||||
|
|
||||||
And then rebuild the kernel and you will get a kernel image with KernelSU!
|
And then rebuild the kernel and you will get a kernel image with KernelSU!
|
||||||
|
|||||||
@@ -46,10 +46,24 @@ If kprobe can not work in your kernel (maybe a upstream bug or kernel below 4.8)
|
|||||||
|
|
||||||
First, add KernelSU to your kernel source tree:
|
First, add KernelSU to your kernel source tree:
|
||||||
|
|
||||||
|
- Latest tag(stable)
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash -
|
curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash -
|
||||||
```
|
```
|
||||||
|
|
||||||
|
- main branch(dev)
|
||||||
|
|
||||||
|
```sh
|
||||||
|
curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash -s main
|
||||||
|
```
|
||||||
|
|
||||||
|
- Select tag(Such as v0.5.2)
|
||||||
|
|
||||||
|
```sh
|
||||||
|
curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash -s v0.5.2
|
||||||
|
```
|
||||||
|
|
||||||
Then, add KernelSU calls to the kernel source, here is a patch to refer:
|
Then, add KernelSU calls to the kernel source, here is a patch to refer:
|
||||||
|
|
||||||
```diff
|
```diff
|
||||||
|
|||||||
@@ -42,8 +42,22 @@ tools/bazel build --config=fast //common:kernel_aarch64_dist
|
|||||||
|
|
||||||
Jika Anda dapat build kernel dengan sukses, maka build KernelSU sangatlah mudah, jalankan perintah ini di root dir kernel source:
|
Jika Anda dapat build kernel dengan sukses, maka build KernelSU sangatlah mudah, jalankan perintah ini di root dir kernel source:
|
||||||
|
|
||||||
|
- Latest tag(stable)
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash -
|
curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash -
|
||||||
```
|
```
|
||||||
|
|
||||||
|
- main branch(dev)
|
||||||
|
|
||||||
|
```sh
|
||||||
|
curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash -s main
|
||||||
|
```
|
||||||
|
|
||||||
|
- Select tag(Such as v0.5.2)
|
||||||
|
|
||||||
|
```sh
|
||||||
|
curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash -s v0.5.2
|
||||||
|
```
|
||||||
|
|
||||||
Dan kemudian build ulang kernel dan Anda akan mendapatkan image kernel dengan KernelSU!
|
Dan kemudian build ulang kernel dan Anda akan mendapatkan image kernel dengan KernelSU!
|
||||||
|
|||||||
@@ -17,10 +17,24 @@ KernelSU menggunakan kprobe untuk melakukan hook kernel, jika *kprobe* berjalan
|
|||||||
|
|
||||||
Pertama, tambahkan KernelSU ke dalam berkas kernel source tree:
|
Pertama, tambahkan KernelSU ke dalam berkas kernel source tree:
|
||||||
|
|
||||||
|
- Latest tag(stable)
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash -
|
curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash -
|
||||||
```
|
```
|
||||||
|
|
||||||
|
- main branch(dev)
|
||||||
|
|
||||||
|
```sh
|
||||||
|
curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash -s main
|
||||||
|
```
|
||||||
|
|
||||||
|
- Select tag(Such as v0.5.2)
|
||||||
|
|
||||||
|
```sh
|
||||||
|
curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash -s v0.5.2
|
||||||
|
```
|
||||||
|
|
||||||
Kemudian, Anda harus memeriksa apakah *kprobe* diaktifkan dalam konfigurasi kernel Anda, jika tidak, tambahkan konfigurasi ini ke dalamnya:
|
Kemudian, Anda harus memeriksa apakah *kprobe* diaktifkan dalam konfigurasi kernel Anda, jika tidak, tambahkan konfigurasi ini ke dalamnya:
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -44,8 +44,22 @@ tools/bazel build --config=fast //common:kernel_aarch64_dist
|
|||||||
|
|
||||||
Nếu bạn có thể build được kernel hoàn chỉnh, thì việc tích hợp KernelSU rất dễ dàng, chạy lệnh sau tại thư mục chứa mã nguồn kernel:
|
Nếu bạn có thể build được kernel hoàn chỉnh, thì việc tích hợp KernelSU rất dễ dàng, chạy lệnh sau tại thư mục chứa mã nguồn kernel:
|
||||||
|
|
||||||
|
- Latest tag(stable)
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash -
|
curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash -
|
||||||
```
|
```
|
||||||
|
|
||||||
|
- main branch(dev)
|
||||||
|
|
||||||
|
```sh
|
||||||
|
curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash -s main
|
||||||
|
```
|
||||||
|
|
||||||
|
- Select tag(Such as v0.5.2)
|
||||||
|
|
||||||
|
```sh
|
||||||
|
curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash -s v0.5.2
|
||||||
|
```
|
||||||
|
|
||||||
Và rồi build lại, bạn sẽ có được một image chứa KernelSU
|
Và rồi build lại, bạn sẽ có được một image chứa KernelSU
|
||||||
@@ -18,10 +18,24 @@ KernelSU sử dụng kprobe để thực hiện hook kernel, nếu *kprobe* ch
|
|||||||
|
|
||||||
Đầu tiên, thêm KernelSU vào mã nguồn kernel của bạn:
|
Đầu tiên, thêm KernelSU vào mã nguồn kernel của bạn:
|
||||||
|
|
||||||
|
- Latest tag(stable)
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash -
|
curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash -
|
||||||
```
|
```
|
||||||
|
|
||||||
|
- main branch(dev)
|
||||||
|
|
||||||
|
```sh
|
||||||
|
curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash -s main
|
||||||
|
```
|
||||||
|
|
||||||
|
- Select tag(Such as v0.5.2)
|
||||||
|
|
||||||
|
```sh
|
||||||
|
curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash -s v0.5.2
|
||||||
|
```
|
||||||
|
|
||||||
Sau đó, bạn nên kiểm tra xem *kprobe* có được bật trong config của bạn hay không, nếu không, vui lòng thêm các cấu hình sau vào:
|
Sau đó, bạn nên kiểm tra xem *kprobe* có được bật trong config của bạn hay không, nếu không, vui lòng thêm các cấu hình sau vào:
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -42,10 +42,24 @@ tools/bazel build --config=fast //common:kernel_aarch64_dist
|
|||||||
|
|
||||||
## 使用 KernelSU 构建内核
|
## 使用 KernelSU 构建内核
|
||||||
|
|
||||||
如果您可以成功构建内核,那么构建 KernelSU 就很容易,在内核源代码根目录中运行此命令:
|
如果您可以成功构建内核,那么构建 KernelSU 就很容易,根据自己的需求在内核源代码根目录中运行以下任一命令:
|
||||||
|
|
||||||
|
- 最新tag(稳定版本)
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash -
|
curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash -
|
||||||
```
|
```
|
||||||
|
|
||||||
|
- main分支(开发版本)
|
||||||
|
|
||||||
|
```sh
|
||||||
|
curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash -s main
|
||||||
|
```
|
||||||
|
|
||||||
|
- 指定tag(比如v0.5.2)
|
||||||
|
|
||||||
|
```sh
|
||||||
|
curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash -s v0.5.2
|
||||||
|
```
|
||||||
|
|
||||||
然后重建内核,您将获得带有 KernelSU 的内核映像!
|
然后重建内核,您将获得带有 KernelSU 的内核映像!
|
||||||
|
|||||||
@@ -17,10 +17,24 @@ KernelSU 使用 kprobe 机制来做内核的相关 hook,如果 *kprobe* 可以
|
|||||||
|
|
||||||
首先,把 KernelSU 添加到你的内核源码树,在内核的根目录执行以下命令:
|
首先,把 KernelSU 添加到你的内核源码树,在内核的根目录执行以下命令:
|
||||||
|
|
||||||
|
- 最新tag(稳定版本)
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash -
|
curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash -
|
||||||
```
|
```
|
||||||
|
|
||||||
|
- main分支(开发版本)
|
||||||
|
|
||||||
|
```sh
|
||||||
|
curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash -s main
|
||||||
|
```
|
||||||
|
|
||||||
|
- 指定tag(比如v0.5.2)
|
||||||
|
|
||||||
|
```sh
|
||||||
|
curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash -s v0.5.2
|
||||||
|
```
|
||||||
|
|
||||||
然后,你需要检查你的内核是否开启了 *kprobe* 相关的配置,如果没有开启,需要添加以下配置:
|
然后,你需要检查你的内核是否开启了 *kprobe* 相关的配置,如果没有开启,需要添加以下配置:
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|||||||
Reference in New Issue
Block a user