From 0617c4440bfe80b386b068cfbc7091630e67d4a7 Mon Sep 17 00:00:00 2001 From: weishu Date: Tue, 14 Nov 2023 13:56:21 +0800 Subject: [PATCH] Docs update (#1143) --- website/docs/.vitepress/locales/en.ts | 1 - website/docs/.vitepress/locales/id_ID.ts | 1 - website/docs/.vitepress/locales/ja_JP.ts | 1 - website/docs/.vitepress/locales/pt_BR.ts | 1 - website/docs/.vitepress/locales/ru_RU.ts | 1 - website/docs/.vitepress/locales/vi_VN.ts | 1 - website/docs/.vitepress/locales/zh_CN.ts | 1 - website/docs/.vitepress/locales/zh_TW.ts | 1 - website/docs/guide/faq.md | 19 ++++++------ website/docs/guide/how-to-build.md | 14 ++++----- .../guide/how-to-integrate-for-non-gki.md | 30 +++++++++++-------- website/docs/zh_CN/guide/faq.md | 17 ++++++----- website/docs/zh_CN/guide/how-to-build.md | 14 ++++----- .../guide/how-to-integrate-for-non-gki.md | 29 ++++++++++-------- 14 files changed, 66 insertions(+), 65 deletions(-) diff --git a/website/docs/.vitepress/locales/en.ts b/website/docs/.vitepress/locales/en.ts index f985ddaf69ff..60433fc04f8c 100644 --- a/website/docs/.vitepress/locales/en.ts +++ b/website/docs/.vitepress/locales/en.ts @@ -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' } ] } diff --git a/website/docs/.vitepress/locales/id_ID.ts b/website/docs/.vitepress/locales/id_ID.ts index 59429ca7c0ce..85591cedea28 100644 --- a/website/docs/.vitepress/locales/id_ID.ts +++ b/website/docs/.vitepress/locales/id_ID.ts @@ -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' } ] } diff --git a/website/docs/.vitepress/locales/ja_JP.ts b/website/docs/.vitepress/locales/ja_JP.ts index 5609f5660bf1..a1472cc7af74 100644 --- a/website/docs/.vitepress/locales/ja_JP.ts +++ b/website/docs/.vitepress/locales/ja_JP.ts @@ -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' } ] } diff --git a/website/docs/.vitepress/locales/pt_BR.ts b/website/docs/.vitepress/locales/pt_BR.ts index ba5200544ee1..784c8ea9a13a 100644 --- a/website/docs/.vitepress/locales/pt_BR.ts +++ b/website/docs/.vitepress/locales/pt_BR.ts @@ -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' } ] } diff --git a/website/docs/.vitepress/locales/ru_RU.ts b/website/docs/.vitepress/locales/ru_RU.ts index ead6b0fc0167..771c137b68db 100644 --- a/website/docs/.vitepress/locales/ru_RU.ts +++ b/website/docs/.vitepress/locales/ru_RU.ts @@ -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' } ] } diff --git a/website/docs/.vitepress/locales/vi_VN.ts b/website/docs/.vitepress/locales/vi_VN.ts index e2ee629674f3..b71d4da8ec0b 100644 --- a/website/docs/.vitepress/locales/vi_VN.ts +++ b/website/docs/.vitepress/locales/vi_VN.ts @@ -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' } ] } diff --git a/website/docs/.vitepress/locales/zh_CN.ts b/website/docs/.vitepress/locales/zh_CN.ts index 93117106d7ea..69410f5072b8 100644 --- a/website/docs/.vitepress/locales/zh_CN.ts +++ b/website/docs/.vitepress/locales/zh_CN.ts @@ -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' } ] } diff --git a/website/docs/.vitepress/locales/zh_TW.ts b/website/docs/.vitepress/locales/zh_TW.ts index 4cc78a396826..62cdc3e2d507 100644 --- a/website/docs/.vitepress/locales/zh_TW.ts +++ b/website/docs/.vitepress/locales/zh_TW.ts @@ -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' } ] } diff --git a/website/docs/guide/faq.md b/website/docs/guide/faq.md index f33910990ae3..a696b3a80c36 100644 --- a/website/docs/guide/faq.md +++ b/website/docs/guide/faq.md @@ -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? @@ -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. diff --git a/website/docs/guide/how-to-build.md b/website/docs/guide/how-to-build.md index 14a693514c7b..095bec8ad3f0 100644 --- a/website/docs/guide/how-to-build.md +++ b/website/docs/guide/how-to-build.md @@ -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! diff --git a/website/docs/guide/how-to-integrate-for-non-gki.md b/website/docs/guide/how-to-integrate-for-non-gki.md index 35f26498e815..b2f4c1820997 100644 --- a/website/docs/guide/how-to-integrate-for-non-gki.md +++ b/website/docs/guide/how-to-integrate-for-non-gki.md @@ -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 @@ -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 @@ -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 @@ -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 @@ -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` @@ -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`! +::: diff --git a/website/docs/zh_CN/guide/faq.md b/website/docs/zh_CN/guide/faq.md index c8d6cc345277..0216c87fdf36 100644 --- a/website/docs/zh_CN/guide/faq.md +++ b/website/docs/zh_CN/guide/faq.md @@ -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 吗? @@ -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) diff --git a/website/docs/zh_CN/guide/how-to-build.md b/website/docs/zh_CN/guide/how-to-build.md index 15252764f0d2..e3a3f19d14a8 100644 --- a/website/docs/zh_CN/guide/how-to-build.md +++ b/website/docs/zh_CN/guide/how-to-build.md @@ -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 的内核映像! diff --git a/website/docs/zh_CN/guide/how-to-integrate-for-non-gki.md b/website/docs/zh_CN/guide/how-to-integrate-for-non-gki.md index 8d03e75002cc..40f16c71444e 100644 --- a/website/docs/zh_CN/guide/how-to-integrate-for-non-gki.md +++ b/website/docs/zh_CN/guide/how-to-integrate-for-non-gki.md @@ -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* 相关的配置,如果没有开启,需要添加以下配置: ``` @@ -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 @@ -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 @@ -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 @@ -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 @@ -169,6 +169,7 @@ index 376543199b5a..82adcef03ecc 100644 AT_EMPTY_PATH | KSTAT_QUERY_FLAGS)) != 0) return -EINVAL; ``` +::: 主要是要改四个地方: @@ -262,3 +263,7 @@ index 45306f9ef247..815091ebfca4 100755 ``` 改完之后重新编译内核即可。 + +:::info 莫名其妙进入安全模式? +如果你采用手动集成的方式,并且没有禁用`CONFIG_KPROBES`,那么用户在开机之后按音量下,也可能触发安全模式!因此如果使用手动集成,你需要关闭 `CONFIG_KPROBES`! +:::