Skip to content

Commit

Permalink
Docs update (#1143)
Browse files Browse the repository at this point in the history
  • Loading branch information
tiann authored Nov 14, 2023
1 parent 9223558 commit 0617c44
Show file tree
Hide file tree
Showing 14 changed files with 66 additions and 65 deletions.
1 change: 0 additions & 1 deletion website/docs/.vitepress/locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ export default defineConfig({
function nav() {
return [
{ text: 'Guide', link: '/guide/what-is-kernelsu' },
{ text: 'GitHub', link: 'https://github.com/tiann/KernelSU' }
]
}

Expand Down
1 change: 0 additions & 1 deletion website/docs/.vitepress/locales/id_ID.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ export default defineConfig({
function nav() {
return [
{ text: 'Petunjuk', link: '/id_ID/guide/what-is-kernelsu' },
{ text: 'GitHub', link: 'https://github.com/tiann/KernelSU' }
]
}

Expand Down
1 change: 0 additions & 1 deletion website/docs/.vitepress/locales/ja_JP.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ export default defineConfig({
function nav() {
return [
{ text: 'ガイド', link: '/ja_JP/guide/what-is-kernelsu' },
{ text: 'GitHub', link: 'https://github.com/tiann/KernelSU' }
]
}

Expand Down
1 change: 0 additions & 1 deletion website/docs/.vitepress/locales/pt_BR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ export default defineConfig({
function nav() {
return [
{ text: 'Guia', link: '/pt_BR/guide/what-is-kernelsu' },
{ text: 'GitHub', link: 'https://github.com/tiann/KernelSU' }
]
}

Expand Down
1 change: 0 additions & 1 deletion website/docs/.vitepress/locales/ru_RU.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ export default defineConfig({
function nav() {
return [
{ text: 'Руководство', link: '/ru_RU/guide/what-is-kernelsu' },
{ text: 'GitHub', link: 'https://github.com/tiann/KernelSU' }
]
}

Expand Down
1 change: 0 additions & 1 deletion website/docs/.vitepress/locales/vi_VN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ export default defineConfig({
function nav() {
return [
{ text: 'Hướng Dẫn', link: '/vi_VN/guide/what-is-kernelsu' },
{ text: 'GitHub', link: 'https://github.com/tiann/KernelSU' }
]
}

Expand Down
1 change: 0 additions & 1 deletion website/docs/.vitepress/locales/zh_CN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ export default defineConfig({
function nav() {
return [
{ text: '指南', link: '/zh_CN/guide/what-is-kernelsu' },
{ text: 'GitHub', link: 'https://github.com/tiann/KernelSU' }
]
}

Expand Down
1 change: 0 additions & 1 deletion website/docs/.vitepress/locales/zh_TW.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ export default defineConfig({
function nav() {
return [
{ text: '指南', link: '/zh_TW/guide/what-is-kernelsu' },
{ text: 'GitHub', link: 'https://github.com/tiann/KernelSU' }
]
}

Expand Down
19 changes: 10 additions & 9 deletions website/docs/guide/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ Certainly, yes.

## Does KernelSU support modules?

Yes, But it is in early version, it may be buggy. Please wait for it to be stable :)
Yes, check [Module Page](module.md) please.

## Does KernelSU support Xposed?

Yes, [Dreamland](https://github.com/canyie/Dreamland) and [TaiChi](https://taichi.cool) work now. For LSPosed, you can make it work by [ZygiskNext](https://github.com/Dr-TSNG/ZygiskNext)
Yes, you can use LSPosed on [ZygiskNext](https://github.com/Dr-TSNG/ZygiskNext)

## Does KernelSU support Zygisk?

Expand Down Expand Up @@ -49,19 +49,20 @@ It is possible, KernelSU is backported to kernel 4.14 now, for older kernel, you

## How to integrate KernelSU for old kernel?

Please refer [guide](how-to-integrate-for-non-gki)
Please refer [Guide](how-to-integrate-for-non-gki)

## Why my Android version is 13, and the kernel shows "android12-5.10"?

The Kernel version has nothing to do with Android version, if you need to flash kernel, always use the kernel version, Android version is not so important.

## Is there any --mount-master/global mount namespace in KernelSU?
## I am GKI1.0, can i use this?

There isn't now(maybe in the future), But there are many ways to switch to global mount namespace manully, such as:
GKI1 is completely different from GKI2, you must compile kernel by yourself.

1. `nsenter -t 1 -m sh` to get a shell in global mount namespace.
2. Add `nsenter --mount=/proc/1/ns/mnt` to the command you want to execute, then the command is executed in global mount namespace. KernelSU is also [using this way](https://github.com/tiann/KernelSU/blob/77056a710073d7a5f7ee38f9e77c9fd0b3256576/manager/app/src/main/java/me/weishu/kernelsu/ui/util/KsuCli.kt#L115)
## How can i make `/system` RW?

## I am GKI1.0, can i use this?
We do not recommend you to modify the system partition directly. You should use the [module](module.md) to modify it systemlessly. If you insist on doing this, check [magisk_overlayfs](https://github.com/HuskyDG/magic_overlayfs).

GKI1 is completely different from GKI2, you must compile kernel by yourself.
## Can KernelSU modify hosts? How can i use AdAday?

Of course. But KernelSU doesn't have builtin hosts support, you can install [systemless-hosts](https://github.com/symbuzzer/systemless-hosts-KernelSU-module) to do it.
14 changes: 6 additions & 8 deletions website/docs/guide/how-to-build.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,22 +44,20 @@ tools/bazel build --config=fast //common:kernel_aarch64_dist

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)
::: code-group

```sh
```sh[Latest tag(stable)]
curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash -
```

- main branch(dev)

```sh
```sh[ main branch(dev)]
curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash -s main
```

- Select tag(Such as v0.5.2)

```sh
```sh[Select tag(Such as v0.5.2)]
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!
30 changes: 18 additions & 12 deletions website/docs/guide/how-to-integrate-for-non-gki.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,27 +46,27 @@ If kprobe does not work in your kernel (may be an upstream or kernel bug below 4

First, add KernelSU to your kernel source tree:

- Latest tag(stable)
::: code-group

```sh
```sh[Latest tag(stable)]
curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash -
```

- main branch(dev)

```sh
```sh[ main branch(dev)]
curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash -s main
```

- Select tag(Such as v0.5.2)

```sh
```sh[Select tag(Such as v0.5.2)]
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:

```diff
::: code-group

```diff[exec.c]
diff --git a/fs/exec.c b/fs/exec.c
index ac59664eaecf..bdd585e1d2cc 100644
--- a/fs/exec.c
Expand All @@ -92,7 +92,7 @@ index ac59664eaecf..bdd585e1d2cc 100644
return __do_execve_file(fd, filename, argv, envp, flags, NULL);
}
```
```diff
```diff[open.c]
diff --git a/fs/open.c b/fs/open.c
index 05036d819197..965b84d486b8 100644
--- a/fs/open.c
Expand Down Expand Up @@ -123,7 +123,7 @@ index 05036d819197..965b84d486b8 100644
if (mode & ~S_IRWXO) /* where's F_OK, X_OK, W_OK, R_OK? */
return -EINVAL;
```
```diff
```diff[read_write.c]
diff --git a/fs/read_write.c b/fs/read_write.c
index 650fc7e0f3a6..55be193913b6 100644
--- a/fs/read_write.c
Expand All @@ -146,7 +146,7 @@ index 650fc7e0f3a6..55be193913b6 100644
return -EBADF;
if (!(file->f_mode & FMODE_CAN_READ))
```
```diff
```diff[stat.c]
diff --git a/fs/stat.c b/fs/stat.c
index 376543199b5a..82adcef03ecc 100644
--- a/fs/stat.c
Expand All @@ -170,6 +170,8 @@ index 376543199b5a..82adcef03ecc 100644
return -EINVAL;
```

:::

You should find the four functions in kernel source:

1. do_faccessat, usually in `fs/open.c`
Expand Down Expand Up @@ -262,3 +264,7 @@ index 45306f9ef247..815091ebfca4 100755
```

Finally, build your kernel again, KernelSU should work well.

:::info Entering safe mode accidiently?
If you use manual integration and do not disable `CONFIG_KPROBES`, then the user may trigger safe mode by pressing the volume down button after booting! Therefore if using manual integration you need to disable `CONFIG_KPROBES`!
:::
17 changes: 9 additions & 8 deletions website/docs/zh_CN/guide/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@

## KernelSU 是否支持模块 ?

支持,但它是早期版本,可能有问题。请等待它稳定 :)
支持。请查阅 [模块](module.md)

## KernelSU 是否支持 Xposed ?

支持。[Dreamland](https://github.com/canyie/Dreamland)[TaiChi](https://taichi.cool) 可以正常运行。LSPosed 可以在 [ZygiskNext](https://github.com/Dr-TSNG/ZygiskNext) 的支持下正常运行。
支持。LSPosed 可以在 [ZygiskNext](https://github.com/Dr-TSNG/ZygiskNext) 的支持下正常运行。

## KernelSU 支持 Zygisk 吗?

Expand Down Expand Up @@ -55,13 +55,14 @@ KernelSU 的模块系统与 Magisk 的 magic mount 有冲突,如果 KernelSU

内核版本与 Android 版本无关,如果你需要刷入 KernelSU,请永远使用**内核版本**而非 Android 版本,如果你为 "android12-5.10" 的设备刷入 Android 13 的内核,等待你的将是 bootloop.

## KernelSU 支持 --mount-master/全局挂载命名空间吗?
## 我是 GKI1.0, 能用 KernelSU 吗?

目前没有(未来可能会支持),但实际上有很多种办法手动进入全局命名空间,无需 su 内置支持,比如:
GKI1 跟 GKI2 完全是两个东西,所以你需要自行编译内核。

1. `nsenter -t 1 -m sh` 可以获得一个全局 mount namespace 的 shell.
2. 在你要执行的命令之前添加 `nsenter --mount=/proc/1/ns/mnt` 就可以让此命令在全局 mount namespace 下执行。 KernelSU 本身也使用了 [这种方法](https://github.com/tiann/KernelSU/blob/77056a710073d7a5f7ee38f9e77c9fd0b3256576/manager/app/src/main/java/me/weishu/kernelsu/ui/util/KsuCli.kt#L115)
## 如何把 `/system` 变成挂载为可读写?

## 我是 GKI1.0, 能用 KernelSU 吗?
我们不建议你直接修改系统分区,你应该使用[模块功能](module.md) 来做修改;如果你执意要这么做,可以看看 [magisk_overlayfs](https://github.com/HuskyDG/magic_overlayfs)

GKI1 跟 GKI2 完全是两个东西,所以你需要自行编译内核。
## KernelSU 能修改 hosts 吗,我如何使用 AdAday?

当然可以。但这个功能 KernelSU 没有内置,你可以安装这个 [systemless-hosts](https://github.com/symbuzzer/systemless-hosts-KernelSU-module)
14 changes: 6 additions & 8 deletions website/docs/zh_CN/guide/how-to-build.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,22 +44,20 @@ tools/bazel build --config=fast //common:kernel_aarch64_dist

如果您可以成功构建内核,那么构建 KernelSU 就很容易,根据自己的需求在内核源代码根目录中运行以下任一命令:

- 最新tag(稳定版本)
::: code-group

```sh
```sh[最新tag(稳定版本)]
curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash -
```

- main分支(开发版本)

```sh
```sh[main分支(开发版本)]
curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash -s main
```

- 指定tag(比如v0.5.2)

```sh
```sh[指定tag(比如v0.5.2)]
curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash -s v0.5.2
```

:::

然后重建内核,您将获得带有 KernelSU 的内核映像!
29 changes: 17 additions & 12 deletions website/docs/zh_CN/guide/how-to-integrate-for-non-gki.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,22 @@ KernelSU 使用 kprobe 机制来做内核的相关 hook,如果 *kprobe* 可以

首先,把 KernelSU 添加到你的内核源码树,在内核的根目录执行以下命令:

- 最新tag(稳定版本)
::: code-group

```sh
```sh[最新tag(稳定版本)]
curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash -
```

- main分支(开发版本)

```sh
```sh[main分支(开发版本)]
curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash -s main
```

- 指定tag(比如v0.5.2)

```sh
```sh[指定tag(比如v0.5.2)]
curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash -s v0.5.2
```

:::

然后,你需要检查你的内核是否开启了 *kprobe* 相关的配置,如果没有开启,需要添加以下配置:

```
Expand Down Expand Up @@ -66,7 +64,9 @@ curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh

然后,手动修改内核源码,你可以参考下面这个 patch:

```diff
::: code-group

```diff[exec.c]
diff --git a/fs/exec.c b/fs/exec.c
index ac59664eaecf..bdd585e1d2cc 100644
--- a/fs/exec.c
Expand All @@ -92,7 +92,7 @@ index ac59664eaecf..bdd585e1d2cc 100644
return __do_execve_file(fd, filename, argv, envp, flags, NULL);
}
```
```diff
```diff[open.c]
diff --git a/fs/open.c b/fs/open.c
index 05036d819197..965b84d486b8 100644
--- a/fs/open.c
Expand Down Expand Up @@ -123,7 +123,7 @@ index 05036d819197..965b84d486b8 100644
if (mode & ~S_IRWXO) /* where's F_OK, X_OK, W_OK, R_OK? */
return -EINVAL;
```
```diff
```diff[read_write.c]
diff --git a/fs/read_write.c b/fs/read_write.c
index 650fc7e0f3a6..55be193913b6 100644
--- a/fs/read_write.c
Expand All @@ -146,7 +146,7 @@ index 650fc7e0f3a6..55be193913b6 100644
return -EBADF;
if (!(file->f_mode & FMODE_CAN_READ))
```
```diff
```diff[stat.c]
diff --git a/fs/stat.c b/fs/stat.c
index 376543199b5a..82adcef03ecc 100644
--- a/fs/stat.c
Expand All @@ -169,6 +169,7 @@ index 376543199b5a..82adcef03ecc 100644
AT_EMPTY_PATH | KSTAT_QUERY_FLAGS)) != 0)
return -EINVAL;
```
:::

主要是要改四个地方:

Expand Down Expand Up @@ -262,3 +263,7 @@ index 45306f9ef247..815091ebfca4 100755
```

改完之后重新编译内核即可。

:::info 莫名其妙进入安全模式?
如果你采用手动集成的方式,并且没有禁用`CONFIG_KPROBES`,那么用户在开机之后按音量下,也可能触发安全模式!因此如果使用手动集成,你需要关闭 `CONFIG_KPROBES`
:::

0 comments on commit 0617c44

Please sign in to comment.