mirror of
https://github.com/tiann/KernelSU.git
synced 2025-02-20 11:43:32 +08:00
website: enhanced english/portuguese translation (#2427)
Enhanced english/portuguese translation for better fluency, grammar, clarity, and text accuracy.
This commit is contained in:
parent
633bc4fc47
commit
cbff9b8ba1
@ -4,7 +4,7 @@
|
||||
|
||||
<img src="https://kernelsu.org/logo.png" style="width: 96px;" alt="logo">
|
||||
|
||||
A Kernel-based root solution for Android devices.
|
||||
A kernel-based root solution for Android devices.
|
||||
|
||||
[](https://github.com/tiann/KernelSU/releases/latest)
|
||||
[](https://hosted.weblate.org/engage/kernelsu)
|
||||
@ -18,19 +18,19 @@ A Kernel-based root solution for Android devices.
|
||||
2. Module system based on [OverlayFS](https://en.wikipedia.org/wiki/OverlayFS).
|
||||
3. [App Profile](https://kernelsu.org/guide/app-profile.html): Lock up the root power in a cage.
|
||||
|
||||
## Compatibility State
|
||||
## Compatibility state
|
||||
|
||||
KernelSU officially supports Android GKI 2.0 devices (kernel 5.10+). Older kernels (4.14+) are also compatible, but the kernel will have to be built manually.
|
||||
KernelSU officially supports Android GKI 2.0 devices (kernel 5.10+). Older kernels (4.14+) are also supported, but the kernel will need to be built manually.
|
||||
|
||||
With this, WSA, ChromeOS, and container-based Android are all supported.
|
||||
|
||||
Currently, only `arm64-v8a` and `x86_64` are supported.
|
||||
Currently, only the `arm64-v8a` and `x86_64` architectures are supported.
|
||||
|
||||
## Usage
|
||||
|
||||
- [Installation Instruction](https://kernelsu.org/guide/installation.html)
|
||||
- [How to build?](https://kernelsu.org/guide/how-to-build.html)
|
||||
- [Official Website](https://kernelsu.org/)
|
||||
- [Installation](https://kernelsu.org/guide/installation.html)
|
||||
- [How to build](https://kernelsu.org/guide/how-to-build.html)
|
||||
- [Official website](https://kernelsu.org/)
|
||||
|
||||
## Translation
|
||||
|
||||
@ -51,7 +51,7 @@ For information on reporting security vulnerabilities in KernelSU, see [SECURITY
|
||||
|
||||
## Credits
|
||||
|
||||
- [kernel-assisted-superuser](https://git.zx2c4.com/kernel-assisted-superuser/about/): the KernelSU idea.
|
||||
- [Magisk](https://github.com/topjohnwu/Magisk): the powerful root tool.
|
||||
- [genuine](https://github.com/brevent/genuine/): apk v2 signature validation.
|
||||
- [Diamorphine](https://github.com/m0nad/Diamorphine): some rootkit skills.
|
||||
- [Kernel-Assisted Superuser](https://git.zx2c4.com/kernel-assisted-superuser/about/): The KernelSU idea.
|
||||
- [Magisk](https://github.com/topjohnwu/Magisk): The powerful root tool.
|
||||
- [genuine](https://github.com/brevent/genuine/): APK v2 signature validation.
|
||||
- [Diamorphine](https://github.com/m0nad/Diamorphine): Some rootkit skills.
|
||||
|
@ -15,26 +15,26 @@ Uma solução root baseada em kernel para dispositivos Android.
|
||||
## Características
|
||||
|
||||
1. `su` e gerenciamento de acesso root baseado em kernel.
|
||||
2. Sistema modular baseado em [OverlayFS](https://en.wikipedia.org/wiki/OverlayFS).
|
||||
2. Sistema de módulos baseado em [OverlayFS](https://en.wikipedia.org/wiki/OverlayFS).
|
||||
3. [Perfil do Aplicativo](https://kernelsu.org/pt_BR/guide/app-profile.html): Tranque o poder root em uma gaiola.
|
||||
|
||||
## Estado de compatibilidade
|
||||
|
||||
O KernelSU oferece suporte oficial a dispositivos Android GKI 2.0 (kernel 5.10+). Kernels mais antigos (4.14+) também são compatíveis, mas o kernel terá que ser construído manualmente.
|
||||
O KernelSU oferece suporte oficial a dispositivos Android GKI 2.0 (kernel 5.10+). Kernels mais antigos (4.14+) também são compatíveis, mas será necessário construir o kernel manualmente.
|
||||
|
||||
Com isso, WSA, ChromeOS e Android baseado em contêiner são todos suportados.
|
||||
|
||||
Atualmente, apenas `arm64-v8a` e `x86_64` são suportados.
|
||||
Atualmente, apenas as arquiteturas `arm64-v8a` e `x86_64` são compatíveis.
|
||||
|
||||
## Uso
|
||||
|
||||
- [Instalação](https://kernelsu.org/pt_BR/guide/installation.html)
|
||||
- [Como compilar o KernelSU?](https://kernelsu.org/pt_BR/guide/how-to-build.html)
|
||||
- [Como compilar](https://kernelsu.org/pt_BR/guide/how-to-build.html)
|
||||
- [Site oficial](https://kernelsu.org/pt_BR/)
|
||||
|
||||
## Tradução
|
||||
|
||||
Para contribuir com a tradução do KernelSU ou aprimorar traduções existentes, por favor, utilize o [Weblate](https://hosted.weblate.org/engage/kernelsu/). PR para a tradução do Gerenciador não são mais aceitas, pois podem entrar em conflito com o Weblate.
|
||||
Para contribuir com a tradução do KernelSU ou aprimorar traduções existentes, por favor, use o [Weblate](https://hosted.weblate.org/engage/kernelsu/). PR para a tradução do Manager não são mais aceitas, pois podem entrar em conflito com o Weblate.
|
||||
|
||||
## Discussão
|
||||
|
||||
@ -51,7 +51,7 @@ Para obter informações sobre como relatar vulnerabilidades de segurança do Ke
|
||||
|
||||
## Créditos
|
||||
|
||||
- [kernel-assisted-superuser](https://git.zx2c4.com/kernel-assisted-superuser/about/): a ideia do KernelSU.
|
||||
- [Magisk](https://github.com/topjohnwu/Magisk): a poderosa ferramenta root.
|
||||
- [genuine](https://github.com/brevent/genuine/): validação de assinatura apk v2.
|
||||
- [Diamorphine](https://github.com/m0nad/Diamorphine): algumas habilidades de rootkit.
|
||||
- [Kernel-Assisted Superuser](https://git.zx2c4.com/kernel-assisted-superuser/about/): A ideia do KernelSU.
|
||||
- [Magisk](https://github.com/topjohnwu/Magisk): A poderosa ferramenta root.
|
||||
- [genuine](https://github.com/brevent/genuine/): Validação de assinatura APK v2.
|
||||
- [Diamorphine](https://github.com/m0nad/Diamorphine): Algumas habilidades de rootkit.
|
||||
|
19
js/README.md
19
js/README.md
@ -10,12 +10,12 @@ yarn add kernelsu
|
||||
|
||||
### exec
|
||||
|
||||
Spawns a **root** shell and runs a command within that shell, passing the `stdout` and `stderr` to a Promise when complete.
|
||||
Spawns a **root** shell and runs a command within that shell, returning a Promise that resolves with the `stdout` and `stderr` outputs upon completion.
|
||||
|
||||
- `command` `<string>` The command to run, with space-separated arguments.
|
||||
- `options` `<Object>`
|
||||
- `cwd` - Current working directory of the child process
|
||||
- `env` - Environment key-value pairs
|
||||
- `cwd` - Current working directory of the child process.
|
||||
- `env` - Environment key-value pairs.
|
||||
|
||||
```javascript
|
||||
import { exec } from 'kernelsu';
|
||||
@ -31,13 +31,13 @@ if (errno === 0) {
|
||||
|
||||
Spawns a new process using the given `command` in **root** shell, with command-line arguments in `args`. If omitted, `args` defaults to an empty array.
|
||||
|
||||
Returns a `ChildProcess`, Instances of the ChildProcess represent spawned child processes.
|
||||
Returns a `ChildProcess` instance. Instances of `ChildProcess` represent spawned child processes.
|
||||
|
||||
- `command` `<string>` The command to run.
|
||||
- `args` `<string[]>` List of string arguments.
|
||||
- `options` `<Object>`:
|
||||
- `cwd` `<string>` - Current working directory of the child process
|
||||
- `env` `<Object>` - Environment key-value pairs
|
||||
- `cwd` `<string>` - Current working directory of the child process.
|
||||
- `env` `<Object>` - Environment key-value pairs.
|
||||
|
||||
Example of running `ls -lh /data`, capturing `stdout`, `stderr`, and the exit code:
|
||||
|
||||
@ -63,9 +63,9 @@ ls.on('exit', (code) => {
|
||||
|
||||
##### Event 'exit'
|
||||
|
||||
- `code` `<number>` The exit code if the child exited on its own.
|
||||
- `code` `<number>` The exit code if the child process exited on its own.
|
||||
|
||||
The `'exit'` event is emitted after the child process ends. If the process exited, `code` is the final exit code of the process, otherwise null
|
||||
The `'exit'` event is emitted when the child process ends. If the process exits, `code` contains the final exit code; otherwise, it is null.
|
||||
|
||||
##### Event 'error'
|
||||
|
||||
@ -112,7 +112,8 @@ toast('Hello, world!');
|
||||
|
||||
### moduleInfo
|
||||
|
||||
Get Module info.
|
||||
Get module info.
|
||||
|
||||
```javascript
|
||||
import { moduleInfo } from 'kernelsu';
|
||||
// print moduleId in console
|
||||
|
@ -11,7 +11,7 @@ export default defineConfig({
|
||||
themeConfig: {
|
||||
nav: nav(),
|
||||
|
||||
lastUpdatedText: 'last Updated',
|
||||
lastUpdatedText: 'Last updated',
|
||||
|
||||
sidebar: {
|
||||
'/guide/': sidebarGuide()
|
||||
@ -23,7 +23,7 @@ export default defineConfig({
|
||||
|
||||
footer: {
|
||||
message: 'Released under the GPL3 License.',
|
||||
copyright: 'Copyright © 2022-present KernelSU Developers'
|
||||
copyright: 'Copyright © 2022-present KernelSU developers.'
|
||||
},
|
||||
|
||||
editLink: {
|
||||
@ -47,7 +47,7 @@ function sidebarGuide() {
|
||||
{ text: 'What is KernelSU?', link: '/guide/what-is-kernelsu' },
|
||||
{ text: 'Difference with Magisk', link: '/guide/difference-with-magisk' },
|
||||
{ text: 'Installation', link: '/guide/installation' },
|
||||
{ text: 'How to build?', link: '/guide/how-to-build' },
|
||||
{ text: 'How to build', link: '/guide/how-to-build' },
|
||||
{ text: 'Intergrate for non-GKI devices', link: '/guide/how-to-integrate-for-non-gki'},
|
||||
{ text: 'Unofficially supported devices', link: '/guide/unofficially-support-devices.md' },
|
||||
{ text: 'Module guide', link: '/guide/module.md' },
|
||||
|
@ -23,7 +23,7 @@ export default defineConfig({
|
||||
|
||||
footer: {
|
||||
message: 'Rilis Dibawah Lisensi GPL3.',
|
||||
copyright: 'Copyright © 2022-Sekarang pengembang KernelSU '
|
||||
copyright: 'Copyright © 2022-Sekarang pengembang KernelSU.'
|
||||
},
|
||||
|
||||
editLink: {
|
||||
|
@ -23,7 +23,7 @@ export default defineConfig({
|
||||
|
||||
footer: {
|
||||
message: 'GPL3 ライセンスでリリースされています。',
|
||||
copyright: 'Copyright © 2022-現在 KernelSU 開発者'
|
||||
copyright: 'Copyright © 2022-現在 KernelSU 開発者。'
|
||||
},
|
||||
|
||||
editLink: {
|
||||
|
@ -23,7 +23,7 @@ export default defineConfig({
|
||||
|
||||
footer: {
|
||||
message: 'Lançado sob a Licença GPL3',
|
||||
copyright: 'Copyright © Desenvolvedores do KernelSU atuais de 2022'
|
||||
copyright: 'Copyright © 2022-presente Desenvolvedores do KernelSU.'
|
||||
},
|
||||
|
||||
editLink: {
|
||||
@ -47,8 +47,8 @@ function sidebarGuide() {
|
||||
{ text: 'O que é KernelSU?', link: '/pt_BR/guide/what-is-kernelsu' },
|
||||
{ text: 'Diferenças com Magisk', link: '/pt_BR/guide/difference-with-magisk' },
|
||||
{ text: 'Instalação', link: '/pt_BR/guide/installation' },
|
||||
{ text: 'Como compilar?', link: '/pt_BR/guide/how-to-build' },
|
||||
{ text: 'Integração para dispositivos não GKI', link: '/pt_BR/guide/how-to-integrate-for-non-gki'},
|
||||
{ text: 'Como compilar', link: '/pt_BR/guide/how-to-build' },
|
||||
{ text: 'Integração para dispositivos não-GKI', link: '/pt_BR/guide/how-to-integrate-for-non-gki'},
|
||||
{ text: 'Dispositivos com suporte não oficial', link: '/pt_BR/guide/unofficially-support-devices.md' },
|
||||
{ text: 'Guias de módulo', link: '/pt_BR/guide/module.md' },
|
||||
{ text: 'Módulo WebUI', link: '/pt_BR/guide/module-webui.md' },
|
||||
|
@ -23,7 +23,7 @@ export default defineConfig({
|
||||
|
||||
footer: {
|
||||
message: 'Выпускается под лицензией GPL3.',
|
||||
copyright: 'Авторские права © 2022-текущее Разработчики KernelSU'
|
||||
copyright: 'Авторские права © 2022-текущее Разработчики KernelSU.'
|
||||
},
|
||||
|
||||
editLink: {
|
||||
|
@ -23,7 +23,7 @@ export default defineConfig({
|
||||
|
||||
footer: {
|
||||
message: 'Phát hành dưới giấy phép GPL3.',
|
||||
copyright: 'Bản Quyền © 2022-nay KernelSU Developers'
|
||||
copyright: 'Bản Quyền © 2022-nay KernelSU developers.'
|
||||
},
|
||||
|
||||
editLink: {
|
||||
|
@ -23,7 +23,7 @@ export default defineConfig({
|
||||
|
||||
footer: {
|
||||
message: '在 GPL3 许可证下发布。',
|
||||
copyright: 'Copyright © 2022-现在 KernelSU 开发者'
|
||||
copyright: 'Copyright © 2022-现在 KernelSU 开发者。'
|
||||
},
|
||||
|
||||
editLink: {
|
||||
|
@ -23,7 +23,7 @@ export default defineConfig({
|
||||
|
||||
footer: {
|
||||
message: '係依據 GPL3 授權發行。',
|
||||
copyright: 'Copyright © 2022-目前 KernelSU 開發人員'
|
||||
copyright: 'Copyright © 2022-目前 KernelSU 開發人員。'
|
||||
},
|
||||
|
||||
editLink: {
|
||||
|
@ -12,12 +12,12 @@ For ordinary apps without root permissions, the App Profile can control the beha
|
||||
|
||||
Linux systems have two concepts: users and groups. Each user has a user ID (UID), and a user can belong to multiple groups, each with its own group ID (GID). These IDs are used to identify users in the system and determine which system resources they can access.
|
||||
|
||||
Users with a UID of 0 are known as root users, and groups with a GID of 0 are known as root groups. The root user group typically holds the highest system privileges.
|
||||
Users with a UID of 0 are known as root users, and groups with a GID of 0 are known as root groups. The root user group generally has the highest system privileges.
|
||||
|
||||
In the case of the Android system, each app is a separate user (excluding shared UID scenarios) with a unique UID. For example, `0` represents the root user, `1000` represents `system`, `2000` represents the ADB shell, and UIDs ranging from `10000` to `19999` represent ordinary apps.
|
||||
In the case of the Android system, each app functions as a separate user (except in cases of shared UIDs) with a unique UID. For example, `0` represents the root user, `1000` represents `system`, `2000` represents the ADB shell, and UIDs ranging from `10000` to `19999` represent ordinary apps.
|
||||
|
||||
::: info
|
||||
Here, the UID mentioned is not the same as the concept of multiple users or work profiles in the Android system. Work profiles are actually implemented by partitioning the UID range. For example, 10000-19999 represents the main user, while 110000-119999 represents a work profile. Each ordinary app among them has its own unique UID.
|
||||
Here, the UID mentioned isn't the same as the concept of multiple users or work profiles in the Android system. Work profiles are actually implemented by partitioning the UID range. For example, 10000-19999 represents the main user, while 110000-119999 represents a work profile. Each ordinary app among them has its own unique UID.
|
||||
:::
|
||||
|
||||
Each app can have several groups, with the GID representing the primary group, which usually matches the UID. Other groups are known as supplementary groups. Certain permissions are controlled through groups, such as network access permissions or Bluetooth access.
|
||||
@ -31,50 +31,50 @@ uid=2000(shell) gid=2000(shell) groups=2000(shell),1004(input),1007(log),1011(ad
|
||||
|
||||
Here, the UID is `2000`, and the GID (primary group ID) is also `2000`. Additionally, it belongs to several supplementary groups, such as `inet` (indicating the ability to create `AF_INET` and `AF_INET6` sockets) and `sdcard_rw` (indicating read/write permissions for the SD card).
|
||||
|
||||
KernelSU's Root Profile allows customization of the UID, GID, and groups for the root process after executing `su`. For example, the Root Profile of a root app can set its UID to `2000`, which means that when using `su`, the app's actual permissions are at the ADB shell level. The `inet` group can be removed, preventing the `su` command from accessing the network.
|
||||
KernelSU's Root Profile allows customization of the UID, GID, and groups for the root process after executing `su`. For example, the Root Profile of a root app can set its UID to `2000`, which means that when using `su`, the app's actual permissions are at the ADB shell level. Additionally, the `inet` group can be removed, preventing the `su` command from accessing the network.
|
||||
|
||||
:::tip Note
|
||||
The App Profile only controls the permissions of the root process after using `su`; it does not control the permissions of the app itself. If an app has requested network access permission, it can still access the network even without using `su`. Removing the `inet` group from `su` only prevents `su` from accessing the network.
|
||||
::: tip NOTE
|
||||
The App Profile only controls the permissions of the root process after using `su` and doesn't control the app's own permissions. If an app has requested network access permission, it can still access the network even without using `su`. Removing the `inet` group from `su` only prevents `su` from accessing the network.
|
||||
:::
|
||||
|
||||
Root Profile is enforced in the kernel and does not rely on the voluntary behavior of root apps, unlike switching users or groups through `su`, the granting of `su` permission is entirely up to the user rather than the developer.
|
||||
Root Profile is enforced in the kernel and doesn't rely on the voluntary behavior of root apps, unlike switching users or groups through `su`. Granting `su` permissions is entirely controlled by the user, not the developer.
|
||||
|
||||
### Capabilities
|
||||
|
||||
Capabilities are a mechanism for privilege separation in Linux.
|
||||
|
||||
For the purpose of performing permission checks, traditional `UNIX` implementations distinguish two categories of processes: privileged processes (whose effective user ID is `0`, referred to as superuser or root), and unprivileged processes (whose effective UID is nonzero). Privileged processes bypass all kernel permission checks, while unprivileged processes are subject to full permission checking based on the process's credentials (usually: effective UID, effective GID, and supplementary group list).
|
||||
For the purpose of performing permission checks, traditional `UNIX` implementations distinguish two categories of processes: privileged processes (whose effective user ID is `0`, referred to as superuser or root) and unprivileged processes (whose effective UID is nonzero). Privileged processes bypass all kernel permission checks, while unprivileged processes are subject to full permission checking based on the process's credentials (usually: effective UID, effective GID, and supplementary group list).
|
||||
|
||||
Starting with Linux 2.2, Linux divides the privileges traditionally associated with superuser into distinct units, known as capabilities, which can be independently enabled and disabled.
|
||||
|
||||
Each Capability represents one or more privileges. For example, `CAP_DAC_READ_SEARCH` represents the ability to bypass permission checks for file reading, as well as directory reading and execution permissions. If a user with an effective UID of `0` (root user) lacks `CAP_DAC_READ_SEARCH` or higher capabilities, this means that even though they are root, they cannot read files at will.
|
||||
Each capability represents one or more privileges. For example, `CAP_DAC_READ_SEARCH` represents the ability to bypass permission checks for file reading, as well as directory read and execute permissions. If a user with an effective UID of `0` (root user) doesn't have the `CAP_DAC_READ_SEARCH` capability or higher, this means that even as root, they cannot freely read files.
|
||||
|
||||
KernelSU's Root Profile allows customization of the Capabilities of the root process after executing `su`, thereby achieving partially granting "root permissions." Unlike the aforementioned UID and GID, certain root apps require a UID of `0` after using `su`. In such cases, limiting the Capabilities of this root user with UID `0` can restrict their allowed operations.
|
||||
KernelSU's Root Profile allows customization of the capabilities of the root process after executing `su`, thus granting partial "root privileges". Unlike the UID and GID mentioned above, certain root apps require a UID of `0` after using `su`. In such cases, limiting the capabilities of this root user with UID `0` can restrict the operations they're allowed to perform.
|
||||
|
||||
:::tip Strong Recommendation
|
||||
Linux's Capability [official documentation](https://man7.org/linux/man-pages/man7/capabilities.7.html) provides detailed explanations of the abilities represented by each Capability. If you intend to customize Capabilities, it is strongly recommended that you read this document first.
|
||||
::: tip STRONG RECOMMENDATION
|
||||
Linux's capability [official documentation](https://man7.org/linux/man-pages/man7/capabilities.7.html) provides detailed explanations of the abilities represented by each capability. If you intend to customize capabilities, it's strongly recommended that you read this document first.
|
||||
:::
|
||||
|
||||
### SELinux
|
||||
|
||||
SELinux is a powerful Mandatory Access Control (MAC) mechanism. It operates on the principle of **default deny**: any action not explicitly allowed is denied.
|
||||
SELinux is a powerful Mandatory Access Control (MAC) mechanism. It operates on the principle of **default deny**. Any action not explicitly allowed is denied.
|
||||
|
||||
SELinux can run in two global modes:
|
||||
|
||||
1. Permissive mode: Denial events are logged but not enforced.
|
||||
1. Permissive mode: Denial events are logged, but not enforced.
|
||||
2. Enforcing mode: Denial events are logged and enforced.
|
||||
|
||||
:::warning Warning
|
||||
Modern Android systems heavily rely on SELinux to ensure overall system security. It is highly recommended not to use any custom systems running in "permissive mode" since it provides no significant advantages over a completely open system.
|
||||
::: warning
|
||||
Modern Android systems heavily rely on SELinux to ensure overall system security. It's highly recommended not to use any custom systems running in "Permissive mode" since it provides no significant advantages over a completely open system.
|
||||
:::
|
||||
|
||||
Explaining the full concept of SELinux is complex and beyond the scope of this document. It is recommended to first understand its workings through the following resources:
|
||||
Explaining the full concept of SELinux is complex and beyond the scope of this document. It's recommended to first understand how it works through the following resources:
|
||||
|
||||
1. [Wikipedia](https://en.wikipedia.org/wiki/Security-Enhanced_Linux)
|
||||
2. [Red Hat: What Is SELinux?](https://www.redhat.com/en/topics/linux/what-is-selinux)
|
||||
3. [ArchLinux: SELinux](https://wiki.archlinux.org/title/SELinux)
|
||||
|
||||
KernelSU's Root Profile allows customization of the SELinux context of the root process after executing `su`. Specific access control rules can be set for this context to enable fine-grained control over root permissions.
|
||||
KernelSU's Root Profile allows customization of the SELinux context of the root process after executing `su`. Specific access control rules can be set for this context, enabling fine-grained control over root permissions.
|
||||
|
||||
In typical scenarios, when an app executes `su`, it switches the process to a SELinux domain with **unrestricted access**, such as `u:r:su:s0`. Through the Root Profile, this domain can be switched to a custom domain, such as `u:r:app1:s0`, and a series of rules can be defined for this domain:
|
||||
|
||||
@ -85,34 +85,34 @@ typeattribute app1 mlstrustedsubject
|
||||
allow app1 * * *
|
||||
```
|
||||
|
||||
Note that the `allow app1 * * *` rule is used for demonstration purposes only. In practice, this rule should not be used extensively since it doesn't differ much from permissive mode.
|
||||
Note that the `allow app1 * * *` rule is used for demonstration purposes only. In practice, this rule shouldn't be used extensively, as it isn't much different from Permissive mode.
|
||||
|
||||
### Escalation
|
||||
|
||||
If the configuration of the Root Profile is not set properly, an escalation scenario may occur: the restrictions imposed by the Root Profile can unintentionally fail.
|
||||
If the configuration of the Root Profile isn't set properly, an escalation scenario may occur. The restrictions imposed by the Root Profile can unintentionally fail.
|
||||
|
||||
For example, if you grant root permission to an ADB shell user (which is a common case), and then you grant root permission to a regular app but configure its root profile with UID 2000 (which is the UID of the ADB shell user), the app can obtain full root access by executing the `su` command twice:
|
||||
For example, if you grant root permission to an ADB shell user (which is a common case) and then grant root permission to a regular app, but configure its Root Profile with UID 2000 (which is the UID of the ADB shell user), the app can obtain full root access by executing the `su` command twice:
|
||||
|
||||
1. The first `su` execution is subject to the enforcement of the App Profile and will switch to UID `2000` (ADB shell) instead of `0` (root).
|
||||
2. The second `su` execution, since the UID is `2000`, and you have granted root access to the UID `2000` (ADB shell) in the configuration, the app will gain full root privileges.
|
||||
1. The first execution of `su` will be subject to the App Profile and will switch to UID `2000` (ADB shell) instead of `0` (root).
|
||||
2. The second execution of `su`, since the UID is `2000` and root access has been granted to UID `2000` (ADB shell) in the configuration, the app will gain full root privileges.
|
||||
|
||||
:::warning Note
|
||||
This behavior is entirely expected and not a bug. Therefore, we recommend the following:
|
||||
::: warning NOTE
|
||||
This behavior is fully expected and isn't a bug. Therefore, we recommend the following:
|
||||
|
||||
If you genuinely need to grant root permissions to ADB (e.g., as a developer), it is not advisable to change the UID to `2000` when configuring the Root Profile. Using `1000` (system) would be a better choice.
|
||||
If you genuinely need to grant root permissions to ADB (e.g., as a developer), it isn't advisable to change the UID to `2000` when configuring the Root Profile. Using `1000` (system) would be a better choice.
|
||||
:::
|
||||
|
||||
## Non-Root Profile
|
||||
## Non-root profile
|
||||
|
||||
### Umount modules
|
||||
|
||||
KernelSU provides a systemless mechanism for modifying system partitions, achieved through OverlayFS mounting. However, some apps may be sensitive to such behavior. Thus, we can unload modules mounted on these apps by setting the "Umount modules" option.
|
||||
KernelSU provides a systemless mechanism to modify system partitions, achieved through the mounting of OverlayFS. However, some apps may be sensitive to this behavior. In this case, we can unload modules mounted in these apps by setting the "Umount modules" option.
|
||||
|
||||
Additionally, the settings interface of the KernelSU manager provides a switch for "Umount modules by default". By default, this switch is **enabled**, which means that KernelSU or some modules will unload modules for this app unless additional settings are applied. If you do not prefer this setting or if it affects certain apps, you have the following options:
|
||||
Additionally, the KernelSU manager's settings interface provides the "Umount modules by default". By default, this option is **enabled**, which means that KernelSU or some modules will unload modules for this app unless additional settings are applied. If you don't prefer this setting or if it affects certain apps, you have the following options:
|
||||
|
||||
1. Keep the switch for "Umount modules by default" and individually disable the "Umount modules" option in the App Profile for apps requiring module loading (acting as a "whitelist").
|
||||
2. Disable the switch for "Umount modules by default" and individually enable the "Umount modules" option in the App Profile for apps requiring module unloading (acting as a "blacklist").
|
||||
1. Keep the "Umount modules by default" option enabled and individually disable the "Umount modules" option in the App Profile for apps requiring module loading (acting as a "whitelist").
|
||||
2. Disable the "Umount modules by default" option and individually enable the "Umount modules" option in the App Profile for apps requiring module loading (acting as a "blacklist").
|
||||
|
||||
::: info
|
||||
In devices using kernel version 5.10 and above, the kernel performs without any further action the unloading of modules. However, for devices running kernel versions below 5.10, this switch is merely a configuration option, and KernelSU itself does not take any action. If you want to be able to use the "Umount modules" option in kernel versions before 5.10 you need to backport the `path_umount` function in `fs/namespace.c`, you can get more information at the end of the [How to integrate KernelSU for non-GKI kernels](https://kernelsu.org/guide/how-to-integrate-for-non-gki.html#how-to-backport-path_umount) page. Some modules, such as Zygisksu, may also use this switch to determine whether module unloading is necessary.
|
||||
In devices running kernel version 5.10 and above, the kernel performs without any further action the unloading of modules. However, for devices running kernel versions below 5.10, this option is merely a configuration setting, and KernelSU itself doesn't take any action. If you want to use the "Umount modules" option in kernel versions before 5.10 you need to backport the `path_umount` function in `fs/namespace.c`. You can get more information at the end of the [Intergrate for non-GKI devices](https://kernelsu.org/guide/how-to-integrate-for-non-gki.html#how-to-backport-path_umount) page. Some modules, such as Zygisksu, may also use this option to determine if module unloading is necessary.
|
||||
:::
|
||||
|
@ -1,28 +1,28 @@
|
||||
# Difference with Magisk
|
||||
|
||||
Although there are many similarities between KernelSU modules and Magisk modules, there are inevitably some differences due to their completely different implementation mechanisms. If you want your module to run on both Magisk and KernelSU, you must understand these differences.
|
||||
Although KernelSU and Magisk modules have many similarities, there are inevitably some differences due to their completely different implementation mechanisms. If you want your module to work on both Magisk and KernelSU, it's essential to understand these differences.
|
||||
|
||||
## Similarities
|
||||
|
||||
- Module file format: both use zip format to organize modules, and the format of modules is almost the same.
|
||||
- Module installation directory: both located in `/data/adb/modules`.
|
||||
- Systemless: both support modifying `/system` in a systemless way through modules.
|
||||
- post-fs-data.sh: the execution time and semantics are exactly the same.
|
||||
- service.sh: the execution time and semantics are exactly the same.
|
||||
- system.prop: completely the same.
|
||||
- sepolicy.rule: completely the same.
|
||||
- BusyBox: scripts are run in BusyBox with "Standalone Mode" enabled in both cases.
|
||||
- Module file format: Both use the ZIP format to organize modules, and the module format is practically the same.
|
||||
- Module installation directory: Both are located at `/data/adb/modules`.
|
||||
- Systemless: Both support modifying `/system` in a systemless way through modules.
|
||||
- post-fs-data.sh: Execution time and semantics are exactly the same.
|
||||
- service.sh: Execution time and semantics are exactly the same.
|
||||
- system.prop: Completely the same.
|
||||
- sepolicy.rule: Completely the same.
|
||||
- BusyBox: Scripts are run in BusyBox with "Standalone Mode" enabled in both cases.
|
||||
|
||||
## Differences
|
||||
|
||||
Before understanding the differences, you need to know how to differentiate whether your module is running in KernelSU or Magisk. You can use the environment variable `KSU` to differentiate it in all places where you can run module scripts (`customize.sh`, `post-fs-data.sh`, `service.sh`). In KernelSU, this environment variable will be set to `true`.
|
||||
Before understanding the differences, it's important to know how to identify whether your module is running in KernelSU or Magisk. You can use the environment variable `KSU` to differentiate it in all places where you can run module scripts (`customize.sh`, `post-fs-data.sh`, `service.sh`). In KernelSU, this environment variable will be set to `true`.
|
||||
|
||||
Here are some differences:
|
||||
|
||||
- KernelSU modules cannot be installed in Recovery mode.
|
||||
- KernelSU modules do not have built-in support for Zygisk (but you can use Zygisk modules through [ZygiskNext](https://github.com/Dr-TSNG/ZygiskNext)).
|
||||
- The method for replacing or deleting files in KernelSU modules is completely different from Magisk. KernelSU does not support the `.replace` method. Instead, you need to create a same-named file with `mknod filename c 0 0` to delete the corresponding file.
|
||||
- The directories for BusyBox are different. The built-in BusyBox in KernelSU is located in `/data/adb/ksu/bin/busybox`, while in Magisk it is in `/data/adb/magisk/busybox`. **Note that this is an internal behavior of KernelSU and may change in the future!**
|
||||
- KernelSU does not support `.replace` files; however, KernelSU supports the `REMOVE` and `REPLACE` variable to remove or replace files and folders.
|
||||
- KernelSU adds `boot-completed` stage to run some scripts on boot completed.
|
||||
- KernelSU adds `post-mount` stage to run some scripts after mounting OverlayFS.
|
||||
- KernelSU modules don't have built-in support for Zygisk, but you can use Zygisk modules through [ZygiskNext](https://github.com/Dr-TSNG/ZygiskNext)).
|
||||
- The method for replacing or deleting files in KernelSU modules is completely different from Magisk. KernelSU doesn't support the `.replace` method. Instead, you need to create a same-named file with `mknod filename c 0 0` to delete the corresponding file.
|
||||
- The directories for BusyBox are different. The built-in BusyBox in KernelSU is located at `/data/adb/ksu/bin/busybox`, while in Magisk it is at `/data/adb/magisk/busybox`. **Note that this is an internal behavior of KernelSU and may change in the future!**
|
||||
- KernelSU doesn't support `.replace` files, but it supports the `REMOVE` and `REPLACE` variables to remove or replace files and folders.
|
||||
- KernelSU adds the `boot-completed` stage to run scripts after the boot process is finished.
|
||||
- KernelSU adds the `post-mount` stage to run scripts after OverlayFS is mounted.
|
||||
|
@ -2,66 +2,66 @@
|
||||
|
||||
## Does KernelSU support my device?
|
||||
|
||||
First, your devices should be able to unlock the bootloader. If it can't, then it is unsupported.
|
||||
First, your devices should be able to unlock the bootloader. If not, then there is unsupported.
|
||||
|
||||
Then install KernelSU manager App to your device and open it, if it shows `Unsupported` then your device cannot be supported out of box, but you can build kernel source and integrate KernelSU to make it work or using [Unofficially supported devices](unofficially-support-devices).
|
||||
Next, install the KernelSU manager on your device and open it. If it shows `Unsupported`, then your device cannot be supported immediately. However, you can build kernel source and integrate KernelSU to make it work, or use [Unofficially supported devices](unofficially-support-devices).
|
||||
|
||||
## Does KernelSU need to unlock Bootloader?
|
||||
## Does KernelSU need to unlock bootloader?
|
||||
|
||||
Certainly, yes.
|
||||
|
||||
## Does KernelSU support modules?
|
||||
|
||||
Yes, check [Module guide](module.md) please.
|
||||
Yes, check [Module guide](module.md).
|
||||
|
||||
## Does KernelSU support Xposed?
|
||||
|
||||
Yes, you can use LSPosed on [ZygiskNext](https://github.com/Dr-TSNG/ZygiskNext).
|
||||
Yes, you can use LSPosed with [ZygiskNext](https://github.com/Dr-TSNG/ZygiskNext).
|
||||
|
||||
## Does KernelSU support Zygisk?
|
||||
|
||||
KernelSU has no builtin Zygisk support, but you can use [ZygiskNext](https://github.com/Dr-TSNG/ZygiskNext) instead.
|
||||
KernelSU has no built-in Zygisk support, but you can use [ZygiskNext](https://github.com/Dr-TSNG/ZygiskNext).
|
||||
|
||||
## Is KernelSU compatible with Magisk?
|
||||
|
||||
KernelSU's module system is conflict with Magisk's magic mount, if there is any module enabled in KernelSU, then the whole Magisk would not work.
|
||||
KernelSU's module system conflicts with Magisk's magic mount. If any module is enabled in KernelSU, Magisk will stop working entirely.
|
||||
|
||||
But if you only use the `su` of KernelSU, then it will work well with Magisk: with KernelSU modifying the `kernel` and Magisk modifying the `ramdisk`, both of them can work together simultaneously.
|
||||
However, if you only use the `su` of KernelSU, it will work well with Magisk. KernelSU modifies the `kernel`, while Magisk modifies the `ramdisk`, allowing both to work together.
|
||||
|
||||
## Will KernelSU substitute Magisk?
|
||||
|
||||
We don't think so and it's not our goal. Magisk is good enough for userspace root solution and it will live long. KernelSU's goal is to provide a kernel interface to users, not substituting Magisk.
|
||||
We believe that it isn't, and that isn't our goal. Magisk is good enough for userspace root solution and will have a long life. KernelSU's goal is to provide a kernel interface to users, not substituting Magisk.
|
||||
|
||||
## Can KernelSU support non GKI devices?
|
||||
## Can KernelSU support non-GKI devices?
|
||||
|
||||
It is possible. But you should download the kernel source and intergrate KernelSU to the source tree and compile the kernel yourself.
|
||||
It's possible. But you should download the kernel source and intergrate KernelSU into the source tree, and compile the kernel yourself.
|
||||
|
||||
## Can KernelSU support devices below Android 12?
|
||||
|
||||
It is device's kernel that affect KernelSU's compatability and it has nothing to do with Android version. The only restriction is that devices launched with Android 12 must be kernel of a 5.10+ version (GKI devices). So:
|
||||
It's the device's kernel that affects KernelSU's compatibility, and it has nothing to do with the Android version. The only restriction is that devices launched with Android 12 must have a kernel version of 5.10+ (GKI devices). So:
|
||||
|
||||
1. Devices launched with Android 12 must be supported.
|
||||
2. Devices which have an old kernel (Some Android 12 devices is also old kernel) are compatible (You should build kernel yourself).
|
||||
2. Devices with an older kernel (some devices with Android 12 also have the older kernel) are compatible (you should build kernel yourself).
|
||||
|
||||
## Can KernelSU support old kernel?
|
||||
|
||||
It is possible, KernelSU is backported to kernel 4.14 now; for older kernel, you need to backport it manually and PRs welcome!
|
||||
It's possible. KernelSU is backported to kernel 4.14 now. For older kernels, you need to backport it manually, and PRs are always welcome!
|
||||
|
||||
## How to integrate KernelSU for an older kernel?
|
||||
|
||||
Please refer to the following [How to integrate KernelSU for non-GKI kernels](how-to-integrate-for-non-gki) guide.
|
||||
Please check the [Intergrate for non-GKI devices](how-to-integrate-for-non-gki) guide.
|
||||
|
||||
## 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.
|
||||
The kernel version has nothing to do with the Android version. If you need to flash kernel, always use the kernel version; the Android version isn't as important.
|
||||
|
||||
## I am GKI1.0, can i use this?
|
||||
## I'm GKI 1.0, can I use this?
|
||||
|
||||
GKI1 is completely different from GKI2, you must compile kernel by yourself.
|
||||
GKI 1.0 is completely different from GKI 2.0, you must compile kernel by yourself.
|
||||
|
||||
## How can I make `/system` RW?
|
||||
|
||||
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).
|
||||
We don't recommend that you modify the system partition directly. Please check [Module guide](module.md) to modify it systemlessly. If you insist on doing this, check [magisk_overlayfs](https://github.com/HuskyDG/magic_overlayfs).
|
||||
|
||||
## Can KernelSU modify hosts? How can I use AdAway?
|
||||
|
||||
@ -69,10 +69,10 @@ Of course. But KernelSU doesn't have built-in hosts support, you can install [sy
|
||||
|
||||
## Why is there a huge 1 TB file?
|
||||
|
||||
The 1 TB size `modules.img` is a disk image file, **don't worry about its size**, it's a special type of file known as a [sparse file](https://en.wikipedia.org/wiki/Sparse_file), it's actual size is only the size of the module you use, and it will dynamically shrink after you delete the module; it does not actually occupy 1 TB of disk space (your mobile phone may not actually have that much space).
|
||||
The 1 TB `modules.img` file is a disk image file. **Don't worry about its size**; it's a special type of file known as a [sparse file](https://en.wikipedia.org/wiki/Sparse_file). Its actual size is only the size of the module you use, and it will decrease dynamically after you delete the module. In fact, it doesn't occupy 1 TB of disk space (your device might not even have that much space).
|
||||
|
||||
If you're really unhappy with the size of this file, you can use the `resize2fs -M` command to make it the actual size; but the module may not work properly at this time, and we won't provide any support for this.
|
||||
If you really care about the size of this file, you can use the `resize2fs -M` command to make it the actual size. However, the module may not work correctly in this case, and we won't provide any support for this.
|
||||
|
||||
## Why does my device show wrong storage size?
|
||||
|
||||
Certain devices use non-standard methods for calculating device's storage size, potentially leading to inaccurate storage calculations in system apps and menus, especially when dealing with 1 TB sparse files. While this problem seems to be specific to Samsung devices, affecting only Samsung apps and services, it's essential to note that the discrepancy is primarily in the total storage size, and the free space calculation remains accurate.
|
||||
Certain devices use non-standard methods to calculate the device's storage size, which may lead to inaccurate storage calculations in system apps and menus, especially when dealing with 1 TB sparse files. Although this problem seems to be specific to Samsung devices, affecting only Samsung apps and services, it's important to note that the discrepancy mainly concerns the total storage size, and the free space calculation remains accurate.
|
||||
|
@ -1,12 +1,12 @@
|
||||
# How to build KernelSU?
|
||||
# How to build
|
||||
|
||||
First, you should read the Android Official docs for kernel build:
|
||||
First, you should read the official Android documentation for kernel build:
|
||||
|
||||
1. [Build kernels](https://source.android.com/docs/setup/build/building-kernels)
|
||||
2. [GKI release builds](https://source.android.com/docs/core/architecture/kernel/gki-release-builds)
|
||||
|
||||
::: warning
|
||||
This page is for GKI devices, if you use an old kernel, please refer [How to integrate KernelSU for non-GKI kernels](how-to-integrate-for-non-gki).
|
||||
This page is for GKI devices, if you use an old kernel, please refer [Intergrate for non-GKI devices](how-to-integrate-for-non-gki).
|
||||
:::
|
||||
|
||||
## Build kernel
|
||||
@ -20,11 +20,11 @@ repo init -m manifest.xml
|
||||
repo sync
|
||||
```
|
||||
|
||||
The `<kernel_manifest.xml>` is a manifest file which can determine a build uniquely, you can use the manifest to do a re-preducable build. You should download the manifest file from [GKI release builds](https://source.android.com/docs/core/architecture/kernel/gki-release-builds).
|
||||
The `<kernel_manifest.xml>` file is a manifest that uniquely identifies a build, allowing you to make it reproducible. To do this, you should download the manifest file from [GKI release builds](https://source.android.com/docs/core/architecture/kernel/gki-release-builds).
|
||||
|
||||
### Build
|
||||
|
||||
Please check the [official docs](https://source.android.com/docs/setup/build/building-kernels) first.
|
||||
Please check the [Building kernels](https://source.android.com/docs/setup/build/building-kernels) first.
|
||||
|
||||
For example, to build an `aarch64` kernel image:
|
||||
|
||||
@ -32,7 +32,7 @@ For example, to build an `aarch64` kernel image:
|
||||
LTO=thin BUILD_CONFIG=common/build.config.gki.aarch64 build/build.sh
|
||||
```
|
||||
|
||||
Don't forget to add the `LTO=thin` flag, otherwise the build may fail if your computer's memory is less then 24 GB.
|
||||
Don't forget to add the `LTO=thin` flag; otherwise, the build may fail if your computer has less than 24 GB of memory.
|
||||
|
||||
Starting from Android 13, the kernel is built by `bazel`:
|
||||
|
||||
@ -41,16 +41,16 @@ tools/bazel build --config=fast //common:kernel_aarch64_dist
|
||||
```
|
||||
|
||||
::: info
|
||||
For some of the Android 14 kernels, to make Wi-Fi/Bluetooth work, it might be necessary to remove all the GKI protected exports:
|
||||
For some Android 14 kernels, to make Wi-Fi/Bluetooth work, it might be necessary to remove all GKI protected exports:
|
||||
|
||||
```sh
|
||||
rm common/android/abi_gki_protected_exports_*
|
||||
```
|
||||
:::
|
||||
|
||||
## Build Kernel with KernelSU
|
||||
## Build kernel with KernelSU
|
||||
|
||||
If you are able to build the kernel successfully, then adding KernelSU support to it is relatively easy. In the root of kernel source directory, run any of the command options listed below:
|
||||
If you can successfully build the kernel, adding support for KernelSU will be relatively easy. In the root of kernel source directory, run any of the options listed below:
|
||||
|
||||
::: code-group
|
||||
|
||||
@ -62,10 +62,10 @@ curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh
|
||||
curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash -s main
|
||||
```
|
||||
|
||||
```sh[Select tag(Such as v0.5.2)]
|
||||
```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!
|
||||
Then, rebuild the kernel and you will get a kernel image with KernelSU!
|
||||
|
@ -1,19 +1,19 @@
|
||||
# How to integrate KernelSU for non-GKI kernels?
|
||||
# Intergrate for non-GKI devices
|
||||
|
||||
KernelSU can be integrated into non-GKI kernels, and was backported to 4.14 and below.
|
||||
KernelSU can be integrated into non-GKI kernels and was backported to 4.14 and earlier versions.
|
||||
|
||||
Due to the fragmentization of non-GKI kernels, we do not have a universal way to build it, so we cannot provide non-GKI boot images. But you can build the kernel yourself with KernelSU integrated.
|
||||
Due to the fragmentation of non-GKI kernels, we don't have a universal method to build it, so we cannot provide the non-GKI boot.img. However, you can build the kernel with KernelSU integrated on your own.
|
||||
|
||||
First, you should be able to build a bootable kernel from kernel source code. If the kernel is not open source, then it is difficult to run KernelSU for your device.
|
||||
First, you should be able to build a bootable kernel from kernel source code. If the kernel isn't open source, then it is difficult to run KernelSU for your device.
|
||||
|
||||
If you can build a bootable kernel, there are two ways to integrate KernelSU to the kernel source code:
|
||||
If you're able to build a bootable kernel, there are two ways to integrate KernelSU into the kernel source code:
|
||||
|
||||
1. Automatically with `kprobe`
|
||||
2. Manually
|
||||
|
||||
## Integrate with kprobe
|
||||
|
||||
KernelSU uses kprobe to do kernel hooks, if the *kprobe* runs well in your kernel, it is recommended to use this way.
|
||||
KernelSU uses kprobe to do kernel hooks, if kprobe runs well in your kernel, it's recommended to use it this way.
|
||||
|
||||
First, add KernelSU to your kernel source tree:
|
||||
|
||||
@ -22,10 +22,10 @@ curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh
|
||||
```
|
||||
|
||||
::: info
|
||||
[KernelSU 1.0 and later versions no longer support non-GKI kernels](https://github.com/tiann/KernelSU/issues/1705). The last supported version is `v0.9.5`, please make sure to use the correct version.
|
||||
[KernelSU 1.0 and later versions no longer support non-GKI kernels](https://github.com/tiann/KernelSU/issues/1705). The last supported version is `v0.9.5`, so make sure to use the correct version.
|
||||
:::
|
||||
|
||||
Then, you should check if *kprobe* is enabled in your kernel config, if it is not, please add these configs to it:
|
||||
Then, you should check if kprobe is enabled in your kernel config. If it isn't, add these configs to it:
|
||||
|
||||
```txt
|
||||
CONFIG_KPROBES=y
|
||||
@ -33,25 +33,23 @@ CONFIG_HAVE_KPROBES=y
|
||||
CONFIG_KPROBE_EVENTS=y
|
||||
```
|
||||
|
||||
And now when you re-build your kernel, KernelSU should work well.
|
||||
Now, when you re-build your kernel, KernelSU should work correctly.
|
||||
|
||||
If you find that KPROBES is still not activated, you can try enabling `CONFIG_MODULES`. If it still doesn't take effect, use `make menuconfig` to search for other dependencies of KPROBES.
|
||||
If you find that KPROBES is still not enabled, you can try enabling `CONFIG_MODULES`. If that doesn't solve the issue, use `make menuconfig` to search for other KPROBES dependencies.
|
||||
|
||||
But if you encounter a boot loop when integrated KernelSU, it might be because *kprobe is broken in your kernel*, which means that you should fix the kprobe bug or use another way.
|
||||
However, if you encounter a bootloop after integrating KernelSU, this may indicate that the **kprobe is broken in your kernel**, which means that you should fix the kprobe bug or use another way.
|
||||
|
||||
:::tip How to check if kprobe is broken?
|
||||
|
||||
comment out `ksu_enable_sucompat()` and `ksu_enable_ksud()` in `KernelSU/kernel/ksu.c`, if the device boots normally, then kprobe may be broken.
|
||||
::: tip HOW TO CHECK IF KPROBE IS BROKEN?
|
||||
Comment out `ksu_enable_sucompat()` and `ksu_enable_ksud()` in `KernelSU/kernel/ksu.c`, if the device boots normally, then kprobe may be broken.
|
||||
:::
|
||||
|
||||
:::info How to get module umount feature working on pre-GKI?
|
||||
|
||||
If your kernel is older than 5.9, you should backport `path_umount` to `fs/namespace.c`. This is required to get module umount feature working. If you don't backport `path_umount`, module umount feature won't work. You can get more info on how to achieve this at the end of this page.
|
||||
::: info HOW TO GET MODULE UMOUNT FEATURE WORKING ON PRE-GKI?
|
||||
If your kernel is older than 5.9, you should backport `path_umount` to `fs/namespace.c`. This is required to get "Umount module" feature work correctly. If you don't backport `path_umount`, "Umount module" feature won't work. You can get more info on how to achieve this at the end of this page.
|
||||
:::
|
||||
|
||||
## Manually modify the kernel source
|
||||
|
||||
If kprobe does not work in your kernel (may be an upstream or kernel bug below 4.8), then you can try the following:
|
||||
If kprobe doesn't work on your kernel this may be caused by an upstream bug or if the kernel is below 4.8), then you can try the following:
|
||||
|
||||
First, add KernelSU to your kernel source tree:
|
||||
|
||||
@ -59,14 +57,14 @@ First, add KernelSU to your kernel source tree:
|
||||
curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash -s v0.9.5
|
||||
```
|
||||
|
||||
Keep in mind that on some devices, your defconfig may be in `arch/arm64/configs` or in other cases `arch/arm64/configs/vendor/your_defconfig`. For whichever defconfig you are using, make sure to enable `CONFIG_KSU` with `y` to enable or `n` to disable it. For example, in case you chose to enable it, you defconfig should contain the following string:
|
||||
Keep in mind that, on some devices, your defconfig may be located at `arch/arm64/configs` or in other cases, it may be at `arch/arm64/configs/vendor/your_defconfig`. Regardless of the defconfig you're using, make sure to enable `CONFIG_KSU` with `y` to enable or `n` to disable it. For example, if you choose to enable it, your defconfig should contain the following string:
|
||||
|
||||
```txt
|
||||
# KernelSU
|
||||
CONFIG_KSU=y
|
||||
```
|
||||
|
||||
Then, add KernelSU calls to the kernel source, here are some patches for reference:
|
||||
Next, add KernelSU calls to the kernel source. Below are some patches for reference:
|
||||
|
||||
::: code-group
|
||||
|
||||
@ -197,7 +195,7 @@ You should find the four functions in kernel source:
|
||||
3. `vfs_read`, usually in `fs/read_write.c`
|
||||
4. `vfs_statx`, usually in `fs/stat.c`
|
||||
|
||||
If your kernel does not have the `vfs_statx` function, use `vfs_fstatat` instead:
|
||||
If your kernel doesn't have the `vfs_statx` function, use `vfs_fstatat` instead:
|
||||
|
||||
```diff
|
||||
diff --git a/fs/stat.c b/fs/stat.c
|
||||
@ -258,10 +256,10 @@ index 2ff887661237..e758d7db7663 100644
|
||||
|
||||
### Safe Mode
|
||||
|
||||
To enable KernelSU's built-in Safe Mode, you should additionally modify `input_handle_event` function in `drivers/input/input.c`:
|
||||
To enable KernelSU's built-in Safe Mode, you should modify the `input_handle_event` function in `drivers/input/input.c`:
|
||||
|
||||
::: tip
|
||||
It is strongly recommended to enable this feature, it is very helpful in preventing bootloops!
|
||||
It's strongly recommended to enable this feature, it's very useful for preventing bootloops!
|
||||
:::
|
||||
|
||||
```diff
|
||||
@ -291,8 +289,8 @@ index 45306f9ef247..815091ebfca4 100755
|
||||
add_input_randomness(type, code, value);
|
||||
```
|
||||
|
||||
:::info Entering safe mode accidentally?
|
||||
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`!
|
||||
::: info ENTERING SAFE MODE ACCIDENTALLY?
|
||||
If you're using manual integration and don't disable `CONFIG_KPROBES`, the user will be able to trigger Safe Mode by pressing the volume down button after booting! Therefore, if you're using manual integration, it's necessary to disable `CONFIG_KPROBES`!
|
||||
:::
|
||||
|
||||
### Failed to execute `pm` in terminal?
|
||||
@ -329,7 +327,7 @@ index 32f6f1c68..d69d8eca2 100644
|
||||
|
||||
### How to backport path_umount
|
||||
|
||||
You can get "Umount modules" feature working on pre-GKI kernels by manually backporting `path_umount` from 5.9. You can use this patch as reference:
|
||||
You can make the "Umount modules" feature work on pre-GKI kernels by manually backporting `path_umount` from 5.9. You can use this patch as reference:
|
||||
|
||||
```diff
|
||||
--- a/fs/namespace.c
|
||||
@ -376,4 +374,4 @@ You can get "Umount modules" feature working on pre-GKI kernels by manually back
|
||||
* This is important for filesystems which use unnamed block devices.
|
||||
```
|
||||
|
||||
Finally, build your kernel again, KernelSU should work well.
|
||||
Finally, build your kernel again, and KernelSU should work correctly.
|
||||
|
@ -2,21 +2,21 @@
|
||||
|
||||
## Check if your device is supported
|
||||
|
||||
Download KernelSU manager APP from [GitHub Releases](https://github.com/tiann/KernelSU/releases) and install it to your device:
|
||||
Download KernelSU manager from [GitHub Releases](https://github.com/tiann/KernelSU/releases) and install it on your device:
|
||||
|
||||
- If the app shows `Unsupported`, it means **you should compile the kernel yourself**, KernelSU will not and never provide a boot image for you to flash.
|
||||
- If the app shows `Not installed`, then your devices is officially supported by KernelSU.
|
||||
- If the app shows `Unsupported`, it means that **you should compile the kernel yourself**, KernelSU won't and never provide a boot.img file for you to flash.
|
||||
- If the app shows `Not installed`, then your device is officially supported by KernelSU.
|
||||
|
||||
::: info
|
||||
For devices showing `Unsupported`, here is an [Unofficially supported devices](unofficially-support-devices.md). You can compile the kernel yourself.
|
||||
For devices showing `Unsupported`, you can check the list of [Unofficially supported devices](unofficially-support-devices.md). You can compile the kernel yourself.
|
||||
:::
|
||||
|
||||
## Backup stock boot.img
|
||||
|
||||
Before flashing, you must first backup your stock boot.img. If you encounter any bootloop, you can always restore the system by flashing back to the stock factory boot using fastboot.
|
||||
Before flashing, it's essential that you back up your stock boot.img. If you encounter any bootloop, you can always restore the system by flashing back to the stock factory boot using fastboot.
|
||||
|
||||
::: warning
|
||||
Flashing may cause data loss, be sure to do this step well before proceeding to the next step! You can also back up all the data on your device if necessary.
|
||||
Flashing may cause data loss. Make sure to do this step well before proceeding to the next step! You can also back up all the data on your device if necessary.
|
||||
:::
|
||||
|
||||
## Necessary knowledge
|
||||
@ -27,7 +27,7 @@ By default, you will use ADB and fastboot tools in this tutorial, so if you don'
|
||||
|
||||
### KMI
|
||||
|
||||
Kernel Module Interface (KMI), kernel versions with the same KMI are **compatible**, this is what "general" means in GKI; conversely, if the KMI is different, then these kernels are not compatible with each other, and flashing a kernel image with a different KMI than your device may cause a bootloop.
|
||||
Kernel Module Interface (KMI), kernel versions with the same KMI are **compatible**, this is what "general" means in GKI; conversely, if the KMI is different, then these kernels aren't compatible with each other, and flashing a kernel image with a different KMI than your device may cause a bootloop.
|
||||
|
||||
Specifically, for GKI devices, the kernel version format should be as follows:
|
||||
|
||||
@ -37,23 +37,23 @@ Version.PatchLevel.SubLevel-AndroidRelease-KmiGeneration-suffix
|
||||
w .x .y -zzz -k -something
|
||||
```
|
||||
|
||||
`w.x-zzz-k` is the KMI version. For example, if a device kernel version is `5.10.101-android12-9-g30979850fc20`, then its KMI is `5.10-android12-9`; theoretically, it can boot up normally with other KMI kernels.
|
||||
`w.x-zzz-k` is the KMI version. For example, if a device kernel version is `5.10.101-android12-9-g30979850fc20`, then its KMI is `5.10-android12-9`. Theoretically, it can boot up normally with other KMI kernels.
|
||||
|
||||
::: tip
|
||||
Note that the SubLevel in the kernel version is not part of the KMI! That means that `5.10.101-android12-9-g30979850fc20` has the same KMI as `5.10.137-android12-9-g30979850fc20`!
|
||||
Note that the SubLevel in the kernel version isn't part of the KMI! This means that `5.10.101-android12-9-g30979850fc20` has the same KMI as `5.10.137-android12-9-g30979850fc20`!
|
||||
:::
|
||||
|
||||
### Security patch level {#security-patch-level}
|
||||
|
||||
Newer Android devices may have anti-rollback mechanisms in place that do not allow flashing a boot image with an old security patch level. For example, if your device kernel is `5.10.101-android12-9-g30979850fc20`, it's security patch level is `2023-11`; even if you flash the kernel corresponding to the KMI, if the security patch level is older than `2023- 11` (such as `2023-06`), then it may cause bootloop.
|
||||
Newer Android devices may have anti-rollback mechanisms that prevent flashing a boot image with an old security patch level. For example, if your device kernel is `5.10.101-android12-9-g30979850fc20`, the security patch level is `2023-11`; even if you flash the kernel corresponding to the KMI, if the security patch level is older than `2023-11` (such as `2023-06`), it may cause a bootloop.
|
||||
|
||||
Therefore, kernels with latest security patch levels are preferred for maintaining the correspondence with KMI.
|
||||
Therefore, kernels with latest security patch levels are preferred to maintain compatibility with the KMI.
|
||||
|
||||
### Kernel version vs Android version
|
||||
|
||||
Please note: **Kernel version and Android version are not necessarily the same!**
|
||||
Please note: **Kernel version and Android version aren't necessarily the same!**
|
||||
|
||||
If you find that your kernel version is `android12-5.10.101`, but your Android system version is Android 13 or other, please don't be surprised, because the version number of the Android system is not necessarily the same as the version number of the Linux kernel. The version number of the Linux kernel is generally correspondent to the version of the Android system that comes with the **device when it is shipped**. If the Android system is upgraded later, the kernel version will generally not change. So, before flashing anything, **always refer to the kernel version!**
|
||||
If you find that your kernel version is `android12-5.10.101`, but your Android system version is Android 13 or other, don't be surprised, because the version number of the Android system isn't necessarily the same as the version number of the Linux kernel. The version number of the Linux kernel is generally correspondent to the version of the Android system that comes with the **device when it is shipped**. If the Android system is upgraded later, the kernel version will generally not change. So, before flashing anything, **always refer to the kernel version!**
|
||||
|
||||
## Introduction
|
||||
|
||||
@ -68,49 +68,49 @@ These two modes are suitable for different scenarios, and you can choose the one
|
||||
|
||||
In GKI mode, the original kernel of the device will be replaced with the generic kernel image provided by KernelSU. The advantages of GKI mode are:
|
||||
|
||||
1. Strong universality, suitable for most devices; for example, Samsung has enabled KNOX devices, and LKM mode cannot operate. There are also some niche modified devices that can only use GKI mode.
|
||||
2. Can be used without relying on official firmware; no need to wait for official firmware updates, as long as the KMI is consistent, it can be used.
|
||||
1. Strong universality, suitable for most devices. For example, Samsung has enabled KNOX devices, and LKM mode cannot work. There are also some niche modified devices that can only use GKI mode.
|
||||
2. Can be used without relying on official firmware, and there is no need to wait for official firmware updates, as long as the KMI is consistent, it can be used.
|
||||
|
||||
### LKM mode {#lkm-mode}
|
||||
|
||||
In LKM mode, the original kernel of the device will not be replaced, but the loadable kernel module will be loaded into the device kernel. The advantages of LKM mode are:
|
||||
In LKM mode, the original kernel of the device won't be replaced, but the loadable kernel module will be loaded into the device kernel. The advantages of LKM mode are:
|
||||
|
||||
1. Will not replace the original kernel of the device; if you have special requirements for the original kernel of the device, or you want to use KernelSU while using a third-party kernel, you can use LKM mode.
|
||||
2. It is more convenient to upgrade and OTA; when upgrading KernelSU, you can directly install it in the manager without flashing manually; after the system OTA, you can directly install it to the second slot without manual flashing.
|
||||
3. Suitable for some special scenarios; for example, LKM can also be loaded with temporary ROOT permissions. Since it does not need to replace the boot partition, it will not trigger AVB and will not cause the device to be bricked.
|
||||
4. LKM can be temporarily uninstalled; if you want to temporarily disable root access, you can uninstall LKM, this process does not require flashing partitions, or even rebooting the device; if you want to enable root again, just reboot the device.
|
||||
1. Won't replace the original kernel of the device. If you have special requirements for the original kernel of the device, or you want to use KernelSU while using a third-party kernel, you can use LKM mode.
|
||||
2. It's more convenient to upgrade and OTA. When upgrading KernelSU, you can directly install it in the manager without flashing manually. After the system OTA, you can directly install it to the second slot without manual flashing.
|
||||
3. Suitable for some special scenarios. For example, LKM can also be loaded with temporary root permissions. Since it doesn't need to replace the boot partition, it won't trigger AVB and won't cause the device to be bricked.
|
||||
4. LKM can be temporarily uninstalled. If you want to temporarily disable root access, you can uninstall LKM. This process doesn't require flashing partitions, or even rebooting the device. If you want to enable root again, just reboot the device.
|
||||
|
||||
:::tip Coexistence of two modes
|
||||
After opening the manager, you can see the current mode of the device on the homepage; note that the priority of GKI mode is higher than that of LKM. For example, if you use GKI kernel to replace the original kernel, and use LKM to patch the GKI kernel, then LKM will be ignored, and the device will always run in GKI mode.
|
||||
::: tip COEXISTENCE OF TWO MODES
|
||||
After opening the manager, you can see the current mode of the device on the homepage. Note that the priority of GKI mode is higher than that of LKM. For example, if you use GKI kernel to replace the original kernel, and use LKM to patch the GKI kernel, the LKM will be ignored, and the device will always run in GKI mode.
|
||||
:::
|
||||
|
||||
### Which one to choose? {#which-one}
|
||||
|
||||
If your device is a mobile phone, we recommend that you prioritize LKM mode; if your device is an emulator, WSA, or Waydroid, we recommend that you prioritize GKI mode.
|
||||
If your device is a mobile phone, we recommend that you prioritize LKM mode. If your device is an emulator, WSA, or Waydroid, we recommend that you prioritize GKI mode.
|
||||
|
||||
## LKM installation
|
||||
|
||||
### Get the official firmware
|
||||
|
||||
To use LKM mode, you need to get the official firmware and then patch it on the basis of the official firmware. If you use a third-party kernel, you can use the `boot.img` of the third-party kernel as the official firmware.
|
||||
To use LKM mode, you need to get the official firmware and patch it based on the official firmware. If you use a third-party kernel, you can use the `boot.img` of the third-party kernel as the official firmware.
|
||||
|
||||
There are many ways to get the official firmware. If your device supports `fastboot boot`, then we recommend **the most recommended and simplest** method is to use `fastboot boot` to temporarily boot the GKI kernel provided by KernelSU, then install the manager, and finally install it directly in the manager. This method does not require you to manually download the official firmware, nor do you need to manually extract the boot.
|
||||
There are many ways to get the official firmware. If your device supports `fastboot boot`, we recommend **the most recommended and simplest** method is to use `fastboot boot` to temporarily boot the GKI kernel provided by KernelSU, then install the manager, and finally install it directly in the manager. This method doesn't require manually downloading the official firmware or manually extracting the boot.
|
||||
|
||||
If your device does not support `fastboot boot`, then you may need to manually download the official firmware package and then extract the boot from it.
|
||||
If your device doesn't support `fastboot boot`, you may need to manually download the official firmware package and extract the boot from it.
|
||||
|
||||
Unlike GKI mode, LKM mode will modify the `ramdisk`, so on devices with Android 13, it needs to patch the `init_boot` partition instead of the `boot` partition; meanwhile, GKI mode always operates the `boot` partition.
|
||||
Unlike GKI mode, LKM mode modifies the `ramdisk`. Therefore, on devices with Android 13, it needs to patch the `init_boot` partition instead of the `boot` partition, while GKI mode always operates on the `boot` partition.
|
||||
|
||||
### Use the manager
|
||||
|
||||
Open the manager, click the installation icon in the upper right corner, and several options will appear:
|
||||
|
||||
1. Select and patch a file. If your device does not have root permissions, you can choose this option, and then select your official firmware, the manager will automatically patch it; you only need to flash this patched file to permanently obtain root permissions.
|
||||
2. Install directly. If your device is already rooted, you can choose this option, the manager will automatically get your device information, and then automatically patch the official firmware, and then flash it; you can consider using `fastboot boot` KernelSU's GKI kernel to get temporary root and install the manager, and then use this option; this is also the main way to upgrade KernelSU.
|
||||
3. Install to another partition. If your device supports A/B partition, you can choose this option, the manager will automatically patch the official firmware, and then install it to another partition; this method is suitable for devices after OTA, you can directly install it to another partition after OTA, and then restart the device.
|
||||
1. Select a file. If your device doesn't have root privileges, you can choose this option and then select your official firmware. The manager will automatically patch it. After that, just flash this patched file to obtain root privileges permanently.
|
||||
2. Direct install. If your device is already rooted, you can choose this option. The manager will automatically get your device information, and then automatically patch the official firmware, and flash it automatically. You can consider using `fastboot boot` KernelSU's GKI kernel to get temporary root and install the manager, and then use this option. This is also the main way to upgrade KernelSU.
|
||||
3. Install to inactive slot. If your device supports A/B partition, you can choose this option. The manager will automatically patch the official firmware and install it to another partition. This method is suitable for devices after OTA, you can directly install it to another partition after OTA, and then restart the device.
|
||||
|
||||
### Use the command line
|
||||
|
||||
If you do not want to use the manager, you can also use the command line to install LKM. The `ksud` tool provided by KernelSU can help you quickly patch the official firmware and then flash it.
|
||||
If you don't want to use the manager, you can also use the command line to install LKM. The `ksud` tool provided by KernelSU can help you quickly patch the official firmware and then flash it.
|
||||
|
||||
This tool supports macOS, Linux, and Windows. You can download the corresponding version from [GitHub Release](https://github.com/tiann/KernelSU/releases).
|
||||
|
||||
@ -123,22 +123,22 @@ Patch boot or init_boot images to apply KernelSU
|
||||
Usage: ksud boot-patch [OPTIONS]
|
||||
|
||||
Options:
|
||||
-b, --boot <BOOT> boot image path, if not specified, will try to find the boot image automatically
|
||||
-k, --kernel <KERNEL> kernel image path to replace
|
||||
-m, --module <MODULE> LKM module path to replace, if not specified, will use the builtin one
|
||||
-b, --boot <BOOT> Boot image path. If not specified, it will try to find the boot image automatically
|
||||
-k, --kernel <KERNEL> Kernel image path to be replaced
|
||||
-m, --module <MODULE> LKM module path to be replaced. If not specified, the built-in module will be used
|
||||
-i, --init <INIT> init to be replaced
|
||||
-u, --ota will use another slot when boot image is not specified
|
||||
-u, --ota Will use another slot if the boot image is not specified
|
||||
-f, --flash Flash it to boot partition after patch
|
||||
-o, --out <OUT> output path, if not specified, will use current directory
|
||||
--magiskboot <MAGISKBOOT> magiskboot path, if not specified, will use builtin one
|
||||
--kmi <KMI> KMI version, if specified, will use the specified KMI
|
||||
-o, --out <OUT> Output path. If not specified, the current directory will be used
|
||||
--magiskboot <MAGISKBOOT> magiskboot path. If not specified, the built-in version will be used
|
||||
--kmi <KMI> KMI version. If specified, the indicated KMI will be used
|
||||
-h, --help Print help
|
||||
```
|
||||
|
||||
A few options that need to be explained:
|
||||
|
||||
1. The `--magiskboot` option can specify the path of magiskboot. If it is not specified, ksud will look for it in the environment variables. If you do not know how to get magiskboot, you can refer to [this](#patch-boot-image).
|
||||
2. The `--kmi` option can specify the `KMI` version. If the kernel name of your device does not follow the KMI specification, you can specify it through this option.
|
||||
1. The `--magiskboot` option can specify the path of magiskboot. If not specified, ksud will look for it in the environment variables. If you don’t know how to get magiskboot, you can check [here](#patch-boot-image).
|
||||
2. The `--kmi` option can specify the `KMI` version. If the kernel name of your device doesn't follow the KMI specification, you can specify it using this option.
|
||||
|
||||
The most common usage is:
|
||||
|
||||
@ -151,31 +151,31 @@ ksud boot-patch -b <boot.img> --kmi android13-5.10
|
||||
There are several installation methods for GKI mode, each suitable for a different scenario, so please choose accordingly:
|
||||
|
||||
1. Install with fastboot using the boot.img provided by KernelSU.
|
||||
2. Install with a kernel flash app, such as KernelFlasher.
|
||||
2. Install with a kernel flash app, such as [Kernel Flasher](https://github.com/capntrips/KernelFlasher/releases).
|
||||
3. Repair the boot.img manually and install it.
|
||||
4. Install with custom Recovery (e.g., TWRP).
|
||||
|
||||
## Install with boot.img provided by KernelSU
|
||||
|
||||
If your device's `boot.img` uses a commonly used compression format, you can use the GKI images provided by KernelSU to flash it directly. It does not require TWRP or self-patching the image.
|
||||
If your device's `boot.img` uses a commonly used compression format, you can use the GKI images provided by KernelSU to flash it directly. This doesn't require TWRP or self-patching the image.
|
||||
|
||||
### Find proper boot.img
|
||||
|
||||
KernelSU provides a generic boot.img for GKI devices, and you should flash the boot.img to the boot partition of the device.
|
||||
KernelSU provides a generic boot.img for GKI devices, and you should flash the boot.img to the device's boot partition.
|
||||
|
||||
You can download boot.img from [GitHub Release](https://github.com/tiann/KernelSU/releases), please note that you should use the correct version of boot.img. If you do not know which file to download, please carefully read the description of [KMI](#kmi) and [Security patch level](#security-patch-level) in this document.
|
||||
You can download boot.img from [GitHub Release](https://github.com/tiann/KernelSU/releases). Please note that you should use the correct version of boot.img. If you don't know which file to download, carefully read the description of [KMI](#kmi) and [Security patch level](#security-patch-level) in this document.
|
||||
|
||||
Normally, there are three boot files in different formats under the same KMI and security patch level. They are all the same except for the kernel compression format. Please check the kernel compression format of your original boot.img. You should use the correct format, such as `lz4`, `gz`. If you use an incorrect compression format, you may encounter bootloop after flashing boot.
|
||||
Normally, there are three boot files in different formats for the same KMI and security patch level. They're identical except for the kernel compression format. Please check the kernel compression format of your original boot.img. You should use the correct format, such as `lz4`, `gz`. If you use an incorrect compression format, you may encounter bootloop after flashing boot.img.
|
||||
|
||||
:::info Compression format of boot.img
|
||||
1. You can use magiskboot to get the compression format of your original boot; alternatively, you can also ask for it from community members/developers with the same model as your device. Also, the compression format of the kernel usually does not change, so if you boot successfully with a certain compression format, you can try that format later as well.
|
||||
::: info COMPRESSION FORMAT OF BOOT.IMG
|
||||
1. You can use magiskboot to get the compression format of your original boot.img. Alternatively, you can also ask members or developers in the community who have the same device model. Also, the compression format of the kernel usually doesn't change, so if you boot successfully with a certain compression format, you can try that format later as well.
|
||||
2. Xiaomi devices usually use `gz` or `uncompressed`.
|
||||
3. For Pixel devices, follow the instructions below:
|
||||
:::
|
||||
|
||||
### Flash boot.img to device
|
||||
|
||||
Use `adb` to connect your device, then execute `adb reboot bootloader` to enter fastboot mode, then use this command to flash KernelSU:
|
||||
Use `adb` to connect your device, then execute `adb reboot bootloader` to enter fastboot mode, and use this command to flash KernelSU:
|
||||
|
||||
```sh
|
||||
fastboot flash boot boot.img
|
||||
@ -187,7 +187,7 @@ If your device supports `fastboot boot`, you can first use `fastboot boot boot.i
|
||||
|
||||
### Reboot
|
||||
|
||||
After the flashing process is complete, you should reboot your device:
|
||||
After the flash is completed, you should reboot your device:
|
||||
|
||||
```sh
|
||||
fastboot reboot
|
||||
@ -197,13 +197,13 @@ fastboot reboot
|
||||
|
||||
Steps:
|
||||
|
||||
1. Download the AnyKernel3 zip. If you do not know which file to download, please carefully read the description of [KMI](#kmi) and [Security patch level](#security-patch-level) in this document.
|
||||
2. Open the Kernel Flash app (grant necessary root permissions) and use the provided AnyKernel3 zip to flash.
|
||||
1. Download the AnyKernel3 ZIP. If you don't know which file to download, carefully read the description of [KMI](#kmi) and [Security patch level](#security-patch-level) in this document.
|
||||
2. Open the Kernel Flasher app, grant necessary root permissions, and use the provided AnyKernel3 ZIP to flash.
|
||||
|
||||
This way requires the kernel flash App to have root permissions. You can use the following methods to achieve this:
|
||||
This way requires the Kernel Flasher app to have root permissions. You can use the following methods to achieve this:
|
||||
|
||||
1. Your device is rooted. For example, you have installed KernelSU and want to upgrade to the latest version, or you have rooted through other methods (such as Magisk).
|
||||
2. If your device is not rooted, but the device supports the temporary boot method of `fastboot boot boot.img`, you can use the GKI image provided by KernelSU to temporarily boot your device, obtain temporary root permissions, and then use the Kernel Flash app to obtain permanent root privileges.
|
||||
1. Your device is rooted. For example, you have installed KernelSU and want to upgrade to the latest version or you have rooted through other methods (such as Magisk).
|
||||
2. If your device isn't rooted, but the device supports the temporary boot method of `fastboot boot boot.img`, you can use the GKI image provided by KernelSU to temporarily boot your device, obtain temporary root permissions, and then use the Kernel Flash app to obtain permanent root privileges.
|
||||
|
||||
Some of kernel flashing apps that can be used for this:
|
||||
|
||||
@ -215,7 +215,7 @@ Note: This method is more convenient when upgrading KernelSU and can be done wit
|
||||
|
||||
## Patch boot.img manually {#patch-boot-image}
|
||||
|
||||
For some devices, the boot.img format is not so common, such as not `lz4`, `gz` and `uncompressed`; the most typical example is a Pixel, it's boot.img format is `lz4_legacy` compressed, ramdisk may be `gz` may also be `lz4_legacy` compression; currently, if you directly flash the boot.img provided by KernelSU, the device may not be able to boot; as an alternative, and you can manually patch the boot.img to achieve this.
|
||||
For some devices, the boot.img format isn't as common as `lz4`, `gz`, and `uncompressed`. A typical example is the Pixel, where the boot.img is compressed in the `lz4_legacy` format, while the, ramdisk may be in `gz` or also compressed in `lz4_legacy`. Currently, if you directly flash the boot.img provided by KernelSU, the device may not be able to boot. In this case, you can manually patch the boot.img to achieve this.
|
||||
|
||||
It's always recommended to use `magiskboot` to patch images, there are two ways:
|
||||
|
||||
@ -225,23 +225,23 @@ It's always recommended to use `magiskboot` to patch images, there are two ways:
|
||||
The official build of `magiskboot` can only run on Android devices, if you want to run it on PC, you can try the second option.
|
||||
|
||||
::: tip
|
||||
Android-Image-Kitchen is not recommended for now, as it doesn't handle the boot metadata (such as security patch level) correctly, thus it may not work on some devices.
|
||||
Android-Image-Kitchen isn't recommended for now because it doesn't handle the boot metadata (such as security patch level) correctly. Therefore, it may not work on some devices.
|
||||
:::
|
||||
|
||||
### Preparation
|
||||
|
||||
1. Get your device's stock boot.img; you can get it from your device manufacturers. You may need [payload-dumper-go](https://github.com/ssut/payload-dumper-go).
|
||||
2. Download the AnyKernel3 zip file provided by KernelSU that matches the KMI version of your device. You can refer to the [Install with custom Recovery](#install-with-custom-recovery).
|
||||
1. Get your device's stock boot.img. You can get it from your device manufacturers. You may need [payload-dumper-go](https://github.com/ssut/payload-dumper-go).
|
||||
2. Download the AnyKernel3 ZIP file provided by KernelSU that matches the KMI version of your device. You can refer to [Install with custom Recovery](#install-with-custom-recovery).
|
||||
3. Unpack the AnyKernel3 package and get the `Image` file, which is the kernel file of KernelSU.
|
||||
|
||||
### Using magiskboot on Android devices {#using-magiskboot-on-Android-devices}
|
||||
|
||||
1. Download latest Magisk from [Release Page](https://github.com/topjohnwu/Magisk/releases).
|
||||
1. Download latest Magisk from [GitHub Releases](https://github.com/topjohnwu/Magisk/releases).
|
||||
2. Rename `Magisk-*(version).apk` to `Magisk-*.zip` and unzip it.
|
||||
3. Push `Magisk-*/lib/arm64-v8a/libmagiskboot.so` to your device by ADB: `adb push Magisk-*/lib/arm64-v8a/libmagiskboot.so /data/local/tmp/magiskboot`
|
||||
4. Push stock boot.img and Image in AnyKernel3 to your device.
|
||||
5. Enter adb shell and run `cd /data/local/tmp/` directory, then `chmod +x magiskboot`
|
||||
6. Enter adb shell and run `cd /data/local/tmp/` directory, execute `./magiskboot unpack boot.img` to unpack `boot.img`, you will get a `kernel` file, this is your stock kernel.
|
||||
5. Enter ADB shell and run `cd /data/local/tmp/` directory, then `chmod +x magiskboot`
|
||||
6. Enter ADB shell and run `cd /data/local/tmp/` directory, execute `./magiskboot unpack boot.img` to unpack `boot.img`, you will get a `kernel` file, this is your stock kernel.
|
||||
7. Replace `kernel` with `Image` by running the command: `mv -f Image kernel`.
|
||||
8. Execute `./magiskboot repack boot.img` to repack boot image, and you will get a `new-boot.img` file, flash this file to device by fastboot.
|
||||
|
||||
@ -255,26 +255,26 @@ Android-Image-Kitchen is not recommended for now, as it doesn't handle the boot
|
||||
6. Execute `./magiskboot repack boot.img` to repack the boot image, and you will get a `new-boot.img` file, flash this file to device by fastboot.
|
||||
|
||||
::: info
|
||||
Official `magiskboot` can run in `Linux` environments normally, if you are a Linux user, you can use the official build.
|
||||
Official `magiskboot` can run in `Linux` environments normally, if you're a Linux user, you can use the official build.
|
||||
:::
|
||||
|
||||
## Install with custom Recovery {#install-with-custom-recovery}
|
||||
|
||||
Prerequisite: Your device must have a custom Recovery, such as TWRP. If there is no custom recovery available for your device, use another method.
|
||||
Prerequisite: Your device must have a custom Recovery, such as TWRP. If there is no custom Recovery available for your device, use another method.
|
||||
|
||||
Steps:
|
||||
|
||||
1. From the [Release page](https://github.com/tiann/KernelSU/releases) of KernelSU, download the zip package starting with `AnyKernel3` that matches your phone version; for example, if the device's kernel version is `android12-5.10. 66`, then you should download the `AnyKernel3-android12-5.10.66_yyyy-MM.zip` file (where `yyyy` is the year and `MM` is the month).
|
||||
1. On [GitHub Releases](https://github.com/tiann/KernelSU/releases), download the ZIP package starting with `AnyKernel3` that matches your device's version. For example, if the device's kernel version is `android12-5.10.66`, then you should download the `AnyKernel3-android12-5.10.66_yyyy-MM.zip` file (where `yyyy` is the year and `MM` is the month).
|
||||
2. Reboot the device into TWRP.
|
||||
3. Use adb to place AnyKernel3-*.zip into the device's `/sdcard` location and choose to install it in the TWRP GUI; or you can directly run `adb sideload AnyKernel-*.zip` to install.
|
||||
3. Use ADB to place AnyKernel3-*.zip into the device's `/sdcard` location and choose to install it in the TWRP GUI, or you can directly run `adb sideload AnyKernel-*.zip` to install.
|
||||
|
||||
Note: This method is suitable for any installation (not limited to initial installation or subsequent upgrades), as long as you are using TWRP.
|
||||
Note: This method is suitable for any installation (not limited to initial installation or subsequent upgrades), as long as you're using TWRP.
|
||||
|
||||
## Other methods
|
||||
|
||||
In fact, all of these installation methods have only one main idea, which is to **replace the original kernel for the one provided by KernelSU**; as long as this can be achieved, it can be installed. The following are other possible methods:
|
||||
In fact, all of these installation methods have only one main idea, which is to **replace the original kernel for the one provided by KernelSU**, as long as this can be achieved, it can be installed. The following are other possible methods:
|
||||
|
||||
1. First install Magisk, get root privileges through Magisk and then use the kernel flasher to flash in the AnyKernel3 zip from KernelSU.
|
||||
1. First, install Magisk, get root privileges through Magisk, and then use the Kernel Flasher to flash the AnyKernel3 ZIP from KernelSU.
|
||||
2. Use any flashing toolkit on PC to flash the kernel provided by KernelSU.
|
||||
|
||||
However, if it does not work, please try `magiskboot` approach.
|
||||
However, if it doesn't work, please try `magiskboot` approach.
|
||||
|
@ -1,8 +1,8 @@
|
||||
# Module WebUI
|
||||
|
||||
In addition to executing boot scripts and modifying system files, KernelSU's modules also support displaying UI interfaces and interacting with users.
|
||||
In addition to executing boot scripts and modifying system files, KernelSU's modules also support displaying UI interfaces and interacting directly with users.
|
||||
|
||||
The module can write HTML + CSS + JavaScript pages through any web technology. KernelSU's manager will display these pages through WebView. It also provides some APIs for interacting with the system, such as executing shell commands.
|
||||
The module can write HTML + CSS + JavaScript pages through any web technology. KernelSU's manager will display these pages through WebView. It also provides some APIs to interact with the system, such as executing shell commands.
|
||||
|
||||
## `webroot` directory
|
||||
|
||||
@ -17,16 +17,16 @@ Web resource files should be placed in the `webroot` subdirectory of the module
|
||||
```
|
||||
|
||||
::: warning
|
||||
When installing the module, KernelSU will automatically set the permissions and SELinux context of this directory. If you do not know what you are doing, please do not set the permissions of this directory yourself!
|
||||
When installing the module, KernelSU will automatically set the permissions and SELinux context for this directory. If you don't know what you're doing, do not set the permissions for this directory yourself!
|
||||
:::
|
||||
|
||||
If your page contains CSS and JavaScript, you need to place it in this directory as well.
|
||||
|
||||
## JavaScript API
|
||||
|
||||
If it is just a display page, it is no different from a normal web page. More importantly, KernelSU provides a series of system API that allows you to implement the unique functions of the module.
|
||||
If it's just a display page, it will function like a regular web page. However, the most important thing is that KernelSU provides a series of system APIs, allowing the implementation of module-specific functions.
|
||||
|
||||
KernelSU provides a JavaScript library and [publishes it on npm](https://www.npmjs.com/package/kernelsu), which you can use in the JavaScript code of your web pages.
|
||||
KernelSU provides a JavaScript library, which is published on [npm](https://www.npmjs.com/package/kernelsu) and can be used in the JavaScript code of your web pages.
|
||||
|
||||
For example, you can execute a shell command to obtain a specific configuration or modify a property:
|
||||
|
||||
@ -38,11 +38,11 @@ const { errno, stdout } = exec("getprop ro.product.model");
|
||||
|
||||
For another example, you can make the web page display full screen, or display a toast.
|
||||
|
||||
[API documentation](https://www.npmjs.com/package/kernelsu).
|
||||
[API documentation](https://www.npmjs.com/package/kernelsu)
|
||||
|
||||
If you find that the existing API does not meet your needs or is inconvenient to use, you are welcome to give us suggestions [here](https://github.com/tiann/KernelSU/issues)!
|
||||
If you find that the existing API doesn't meet your needs or is inconvenient to use, you're welcome to give us suggestions [here](https://github.com/tiann/KernelSU/issues)!
|
||||
|
||||
## Some tips
|
||||
|
||||
1. You can use `localStorage` normally to store some data, but it will be lost after the manager app is uninstalled. If you need to save persistently, you can write data to a custom directory yourself.
|
||||
2. For simple pages, I recommend you use [parceljs](https://parceljs.org/) for packaging. It requires zero configuration and is very convenient to use. However, if you are a front-end master or have your own preferences, then just choose the one you like!
|
||||
1. You can use `localStorage` as usual to store some data, but keep in mind that it will be lost if the manager app is uninstalled. If you need persistent storage, you will need to manually save the data in a specific directory.
|
||||
2. For simple pages, we recommend using [parceljs](https://parceljs.org/) for packaging. It requires no initial configuration and is extremely easy to use. However, if you're a front-end expert or have your own preferences, feel free to use the tool of your choice!
|
||||
|
@ -2,28 +2,27 @@
|
||||
|
||||
KernelSU provides a module mechanism that achieves the effect of modifying the system directory while maintaining the integrity of the system partition. This mechanism is commonly known as "systemless".
|
||||
|
||||
The module mechanism of KernelSU is almost the same as that of Magisk. If you are familiar with Magisk module development, developing KernelSU modules is very similar. You can skip the introduction of modules below and only need to read [difference-with-magisk](difference-with-magisk.md).
|
||||
The module mechanism of KernelSU is almost the same as that of Magisk. If you're familiar with Magisk module development, developing KernelSU modules is very similar. You can skip the introduction of modules below and just read [Difference with Magisk](difference-with-magisk.md).
|
||||
|
||||
## WebUI
|
||||
|
||||
KernelSU's modules support displaying interfaces and interacting with users. For more, please refer to [WebUI documentation](module-webui.md).
|
||||
KernelSU's modules support displaying interfaces and interacting with users. For more details, refer to the [WebUI documentation](module-webui.md).
|
||||
|
||||
## Busybox
|
||||
## BusyBox
|
||||
|
||||
KernelSU ships with a feature-complete BusyBox binary (including full SELinux support). The executable is located at `/data/adb/ksu/bin/busybox`. KernelSU's BusyBox supports runtime toggle-able "ASH Standalone Shell Mode". What this standalone mode means is that when running in the `ash` shell of BusyBox, every single command will directly use the applet within BusyBox, regardless of what is set as `PATH`. For example, commands like `ls`, `rm`, `chmod` will **NOT** use what is in `PATH` (in the case of Android by default it will be `/system/bin/ls`, `/system/bin/rm`, and `/system/bin/chmod` respectively), but will instead directly call internal BusyBox applets. This makes sure that scripts always run in a predictable environment and always have the full suite of commands no matter which Android version it is running on. To force a command _not_ to use BusyBox, you have to call the executable with full paths.
|
||||
KernelSU ships with a feature-complete BusyBox binary (including full SELinux support). The executable is located at `/data/adb/ksu/bin/busybox`. KernelSU's BusyBox supports runtime toggle-able "ASH Standalone Shell Mode". What this Standalone Mode means is that when running in the `ash` shell of BusyBox, every single command will directly use the applet within BusyBox, regardless of what is set as `PATH`. For example, commands like `ls`, `rm`, `chmod` will **NOT** use what is in `PATH` (in the case of Android by default it will be `/system/bin/ls`, `/system/bin/rm`, and `/system/bin/chmod` respectively), but will instead directly call internal BusyBox applets. This makes sure that scripts always run in a predictable environment and always have the full suite of commands no matter which Android version it is running on. To force a command _not_ to use BusyBox, you have to call the executable with full paths.
|
||||
|
||||
Every single shell script running in the context of KernelSU will be executed in BusyBox's `ash` shell with standalone mode enabled. For what is relevant to 3rd party developers, this includes all boot scripts and module installation scripts.
|
||||
Every single shell script running in the context of KernelSU will be executed in BusyBox's `ash` shell with Standalone Mode enabled. For what is relevant to 3rd party developers, this includes all boot scripts and module installation scripts.
|
||||
|
||||
For those who want to use this "Standalone Mode" feature outside of KernelSU, there are 2 ways to enable it:
|
||||
For those who want to use this Standalone Mode feature outside of KernelSU, there are 2 ways to enable it:
|
||||
|
||||
1. Set environment variable `ASH_STANDALONE` to `1` <br>Example: `ASH_STANDALONE=1 /data/adb/ksu/bin/busybox sh <script>`
|
||||
2. Toggle with command-line options:<br>`/data/adb/ksu/bin/busybox sh -o standalone <script>`
|
||||
|
||||
To make sure all subsequent `sh` shell executed also runs in standalone mode, option 1 is the preferred method (and this is what KernelSU and the KernelSU manager use internally) as environment variables are inherited down to child processes.
|
||||
To make sure all subsequent `sh` shell executed also runs in Standalone Mode, option 1 is the preferred method (and this is what KernelSU and the KernelSU manager use internally) as environment variables are inherited down to child processes.
|
||||
|
||||
::: tip Difference with Magisk
|
||||
|
||||
KernelSU's BusyBox is now using the binary file compiled directly from the Magisk project. **Thanks to Magisk!** Therefore, you don't have to worry about compatibility issues between BusyBox scripts in Magisk and KernelSU because they are exactly the same!
|
||||
::: tip DIFFERENCE WITH MAGISK
|
||||
KernelSU's BusyBox is now using the binary file compiled directly from the Magisk project. **Thanks to Magisk!** Therefore, you don't need to worry about compatibility issues between BusyBox scripts in Magisk and KernelSU, as they're exactly the same!
|
||||
:::
|
||||
|
||||
## KernelSU modules
|
||||
@ -61,6 +60,7 @@ A KernelSU module is a folder placed in `/data/adb/modules` with the structure b
|
||||
│ ├── service.sh <--- This script will be executed in late_start service
|
||||
│ ├── boot-completed.sh <--- This script will be executed on boot completed
|
||||
| ├── uninstall.sh <--- This script will be executed when KernelSU removes your module
|
||||
| ├── action.sh <--- This script will be executed when user click the Action button in KernelSU app
|
||||
│ ├── system.prop <--- Properties in this file will be loaded as system properties by resetprop
|
||||
│ ├── sepolicy.rule <--- Additional custom sepolicy rules
|
||||
│ │
|
||||
@ -82,13 +82,13 @@ A KernelSU module is a folder placed in `/data/adb/modules` with the structure b
|
||||
├── .
|
||||
```
|
||||
|
||||
::: tip Difference with Magisk
|
||||
KernelSU does not have built-in support for Zygisk, so there is no content related to Zygisk in the module. However, you can use [ZygiskNext](https://github.com/Dr-TSNG/ZygiskNext) to support Zygisk modules. In this case, the content of the Zygisk module is identical to that supported by Magisk.
|
||||
::: tip DIFFERENCE WITH MAGISK
|
||||
KernelSU doesn't have built-in support for Zygisk, so there is no content related to Zygisk in the module. However, you can use [ZygiskNext](https://github.com/Dr-TSNG/ZygiskNext) to support Zygisk modules. In this case, the content of the Zygisk module is identical to that supported by Magisk.
|
||||
:::
|
||||
|
||||
### module.prop
|
||||
|
||||
module.prop is a configuration file for a module. In KernelSU, if a module does not contain this file, it will not be recognized as a module. The format of this file is as follows:
|
||||
`module.prop` is a configuration file for a module. In KernelSU, if a module doesn't contain this file, it won't be recognized as a module. The format of this file is as follows:
|
||||
|
||||
```txt
|
||||
id=<string>
|
||||
@ -103,7 +103,7 @@ description=<string>
|
||||
Example: ✓ `a_module`, ✓ `a.module`, ✓ `module-101`, ✗ `a module`, ✗ `1_module`, ✗ `-a-module`<br>
|
||||
This is the **unique identifier** of your module. You should not change it once published.
|
||||
- `versionCode` has to be an **integer**. This is used to compare versions.
|
||||
- Others that weren't mentioned above can be any **single line** string.
|
||||
- Others that were not mentioned above can be any **single line** string.
|
||||
- Make sure to use the `UNIX (LF)` line break type and not the `Windows (CR+LF)` or `Macintosh (CR)`.
|
||||
|
||||
### Shell scripts
|
||||
@ -112,8 +112,8 @@ Please read the [Boot scripts](#boot-scripts) section to understand the differen
|
||||
|
||||
In all scripts of your module, please use `MODDIR=${0%/*}` to get your module's base directory path; do **NOT** hardcode your module path in scripts.
|
||||
|
||||
::: tip Difference with Magisk
|
||||
You can use the environment variable KSU to determine if a script is running in KernelSU or Magisk. If running in KernelSU, this value will be set to true.
|
||||
::: tip DIFFERENCE WITH MAGISK
|
||||
You can use the environment variable `KSU` to determine if a script is running in KernelSU or Magisk. If running in KernelSU, this value will be set to `true`.
|
||||
:::
|
||||
|
||||
### `system` directory
|
||||
@ -123,7 +123,7 @@ The contents of this directory will be overlaid on top of the system's `/system`
|
||||
1. Files with the same name as those in the corresponding directory in the system will be overwritten by the files in this directory.
|
||||
2. Folders with the same name as those in the corresponding directory in the system will be merged with the folders in this directory.
|
||||
|
||||
If you want to delete a file or folder in the original system directory, you need to create a file with the same name as the file/folder in the module directory using `mknod filename c 0 0`. This way, the OverlayFS system will automatically "whiteout" this file as if it has been deleted (the /system partition is not actually changed).
|
||||
If you want to delete a file or folder in the original system directory, you need to create a file with the same name as the file/folder in the module directory using `mknod filename c 0 0`. This way, the OverlayFS system will automatically "whiteout" this file as if it has been deleted (the /system partition isn't actually changed).
|
||||
|
||||
You can also declare a variable named `REMOVE` containing a list of directories in `customize.sh` to execute removal operations, and KernelSU will automatically execute `mknod <TARGET> c 0 0` in the corresponding directories of the module. For example:
|
||||
|
||||
@ -134,7 +134,7 @@ REMOVE="
|
||||
"
|
||||
```
|
||||
|
||||
The above list will execute `mknod $MODPATH/system/app/YouTube c 0 0` and `mknod $MODPATH/system/app/Bloatware c 0 0`; and `/system/app/YouTube` and `/system/app/Bloatware` will be removed after the module takes effect.
|
||||
The above list will execute `mknod $MODPATH/system/app/YouTube c 0 0` and `mknod $MODPATH/system/app/Bloatware c 0 0`, `/system/app/YouTube` and `/system/app/Bloatware` will be removed after the module takes effect.
|
||||
|
||||
If you want to replace a directory in the system, you need to create a directory with the same path in your module directory, and then set the attribute `setfattr -n trusted.overlay.opaque -v y <TARGET>` for this directory. This way, the OverlayFS system will automatically replace the corresponding directory in the system (without changing the /system partition).
|
||||
|
||||
@ -149,12 +149,11 @@ REPLACE="
|
||||
|
||||
This list will automatically create the directories `$MODPATH/system/app/YouTube` and `$MODPATH/system/app/Bloatware`, and then execute `setfattr -n trusted.overlay.opaque -v y $MODPATH/system/app/YouTube` and `setfattr -n trusted.overlay.opaque -v y $MODPATH/system/app/Bloatware`. After the module takes effect, `/system/app/YouTube` and `/system/app/Bloatware` will be replaced with empty directories.
|
||||
|
||||
::: tip Difference with Magisk
|
||||
|
||||
KernelSU's systemless mechanism is implemented through the kernel's OverlayFS, while Magisk currently uses magic mount (bind mount). The two implementation methods have significant differences, but the ultimate goal is the same: to modify /system files without physically modifying the /system partition.
|
||||
::: tip DIFFERENCE WITH MAGISK
|
||||
KernelSU's systemless mechanism is implemented through the kernel's OverlayFS, while Magisk currently uses magic mount (bind mount). These two implementation methods have significant differences, but the ultimate goal is the same: modifying /system files without physically modifying the /system partition.
|
||||
:::
|
||||
|
||||
If you are interested in OverlayFS, it is recommended to read the Linux Kernel's [documentation on OverlayFS](https://docs.kernel.org/filesystems/overlayfs.html).
|
||||
If you're interested in OverlayFS, it's recommended to read the Linux Kernel's [documentation on OverlayFS](https://docs.kernel.org/filesystems/overlayfs.html).
|
||||
|
||||
### system.prop
|
||||
|
||||
@ -166,7 +165,7 @@ If your module requires some additional sepolicy patches, please add those rules
|
||||
|
||||
## Module installer
|
||||
|
||||
A KernelSU module installer is a KernelSU module packaged in a zip file that can be flashed in the KernelSU manager. The simplest KernelSU module installer is just a KernelSU module packed as a zip file.
|
||||
A KernelSU module installer is a KernelSU module packaged in a ZIP file that can be flashed in the KernelSU manager. The simplest KernelSU module installer is just a KernelSU module packed as a ZIP file.
|
||||
|
||||
```txt
|
||||
module.zip
|
||||
@ -179,7 +178,7 @@ module.zip
|
||||
```
|
||||
|
||||
::: warning
|
||||
KernelSU module is **NOT** supported to be installed via a Custom Recovery!
|
||||
KernelSU module is **NOT** compatible for installation in a custom Recovery!
|
||||
:::
|
||||
|
||||
### Customization
|
||||
@ -188,7 +187,7 @@ If you need to customize the module installation process, optionally you can cre
|
||||
|
||||
If you would like to fully control and customize the installation process, declare `SKIPUNZIP=1` in `customize.sh` to skip all default installation steps. By doing so, your `customize.sh` will be responsible to install everything by itself.
|
||||
|
||||
The `customize.sh` script runs in KernelSU's BusyBox `ash` shell with "Standalone Mode" enabled. The following variables and functions are available:
|
||||
The `customize.sh` script runs in KernelSU's BusyBox `ash` shell with Standalone Mode enabled. The following variables and functions are available:
|
||||
|
||||
#### Variables
|
||||
|
||||
@ -199,13 +198,13 @@ The `customize.sh` script runs in KernelSU's BusyBox `ash` shell with "Standalon
|
||||
- `BOOTMODE` (bool): always be `true` in KernelSU.
|
||||
- `MODPATH` (path): the path where your module files should be installed.
|
||||
- `TMPDIR` (path): a place where you can temporarily store files.
|
||||
- `ZIPFILE` (path): your module's installation zip.
|
||||
- `ZIPFILE` (path): your module's installation ZIP.
|
||||
- `ARCH` (string): the CPU architecture of the device. Value is either `arm`, `arm64`, `x86`, or `x64`.
|
||||
- `IS64BIT` (bool): `true` if `$ARCH` is either `arm64` or `x64`.
|
||||
- `API` (int): the API level (Android version) of the device (e.g., `23` for Android 6.0).
|
||||
|
||||
::: warning
|
||||
In KernelSU, `MAGISK_VER_CODE` is always `25200` and `MAGISK_VER` is always `v25.2`. Please do not use these two variables to determine whether it is running on KernelSU or not.
|
||||
In KernelSU, `MAGISK_VER_CODE` is always `25200`, and `MAGISK_VER` is always `v25.2`. Please don't use these two variables to determine whether KernelSU is running or not.
|
||||
:::
|
||||
|
||||
#### Functions
|
||||
@ -239,14 +238,14 @@ set_perm_recursive <directory> <owner> <group> <dirpermission> <filepermission>
|
||||
In KernelSU, scripts are divided into two types based on their running mode: post-fs-data mode and late_start service mode.
|
||||
|
||||
- post-fs-data mode
|
||||
- This stage is BLOCKING. The boot process is paused before execution is done, or 10 seconds have passed.
|
||||
- This stage is BLOCKING. The boot process is paused before execution is done or after 10 seconds.
|
||||
- Scripts run before any modules are mounted. This allows a module developer to dynamically adjust their modules before it gets mounted.
|
||||
- This stage happens before Zygote is started, which pretty much means everything in Android.
|
||||
- **WARNING:** using `setprop` will deadlock the boot process! Please use `resetprop -n <prop_name> <prop_value>` instead.
|
||||
- **Only run scripts in this mode if necessary.**
|
||||
- **WARNING:** Using `setprop` will deadlock the boot process! Please use `resetprop -n <prop_name> <prop_value>` instead.
|
||||
- **Only run scripts in this mode if necessary**.
|
||||
- late_start service mode
|
||||
- This stage is NON-BLOCKING. Your script runs in parallel with the rest of the booting process.
|
||||
- **This is the recommended stage to run most scripts.**
|
||||
- **This is the recommended stage to run most scripts**.
|
||||
|
||||
In KernelSU, startup scripts are divided into two types based on their storage location: general scripts and module scripts.
|
||||
|
||||
@ -260,7 +259,7 @@ In KernelSU, startup scripts are divided into two types based on their storage l
|
||||
- Only executed if the module is enabled.
|
||||
- `post-fs-data.sh` runs in post-fs-data mode, `service.sh` runs in late_start service mode, `boot-completed.sh` runs on boot completed, `post-mount.sh` runs on OverlayFS mounted.
|
||||
|
||||
All boot scripts will run in KernelSU's BusyBox `ash` shell with "Standalone Mode" enabled.
|
||||
All boot scripts will run in KernelSU's BusyBox `ash` shell with Standalone Mode enabled.
|
||||
|
||||
### Boot scripts process explanation
|
||||
|
||||
@ -274,7 +273,7 @@ load kernel:
|
||||
- LKM mode: stock kernel
|
||||
...
|
||||
|
||||
1. kernel exec init (oem logo on screen):
|
||||
1. kernel exec init (OEM logo on screen):
|
||||
- GKI mode: stock init
|
||||
- LKM mode: exec ksuinit, insmod kernelsu.ko, exec stock init
|
||||
mount /dev, /dev/pts, /proc, /sys, etc.
|
||||
@ -306,7 +305,7 @@ load_all_props_action
|
||||
class_start main
|
||||
start-service adb, netd (iptables), zygote, etc.
|
||||
|
||||
2. kernel2user init (rom animation on screen, start by service bootanim)
|
||||
2. kernel2user init (ROM animation on screen, start by service bootanim)
|
||||
*execute general scripts in service.d/
|
||||
*execute module scripts service.sh
|
||||
*set props for resetprop without -p option
|
||||
@ -324,4 +323,4 @@ input password to decrypt /data/data
|
||||
start user apps (autostart)
|
||||
```
|
||||
|
||||
If you are interested in Android Init Language, it is recommended to read its [documentation](https://android.googlesource.com/platform/system/core/+/master/init/README.md).
|
||||
If you're interested in Android Init Language, it's recommended to read its [documentation](https://android.googlesource.com/platform/system/core/+/master/init/README.md).
|
||||
|
@ -1,50 +1,50 @@
|
||||
# Rescue from bootloop
|
||||
|
||||
When flashing a device, we may encounter situations when the device becomes "bricked". In theory, if you only use fastboot to flash the boot partition or install incompatible modules that cause the device to fail to boot, then this can be restored by appropriate operations. This document aims to provide some emergency methods to help you recover from a "bricked" state.
|
||||
When updating a device, situations may arise where the device becomes "bricked". In theory, if you only use fastboot to flash the boot partition or install incompatible modules that cause the device to fail during boot, it can be restored through appropriate operations. This document aims to provide emergency methods to help you recover a "bricked" device.
|
||||
|
||||
## Brick by flashing boot partition
|
||||
|
||||
In KernelSU, the following situations may cause boot brick when flashing the boot partition:
|
||||
|
||||
1. You flashed a boot image in the wrong format. For example, if your device's boot format is `gz`, but you flashed an `lz4` format image, then the device will not be able to boot.
|
||||
2. Your device needs to disable AVB verification in order to boot properly (usually requiring wiping all data on the device).
|
||||
3. Your kernel has some bugs or is not suitable for your device to flash.
|
||||
1. You flashed a boot image in the wrong format. For example, if your device's boot format is `gz`, but you flashed an image in `lz4` format, the device won't boot.
|
||||
2. Your device needs to disable AVB verification to boot correctly, which usually requires wiping all data from the device.
|
||||
3. Your kernel contains bugs or isn't compatible with your device's flash.
|
||||
|
||||
No matter what the situation is, you can recover by **flashing the stock boot image**. Therefore, at the beginning of the installation tutorial, we strongly recommend that you back up your stock boot before flashing. If you have not backed up, you can obtain the original factory boot from other users with the same device as you or from the official firmware.
|
||||
No matter the situation, you can recover by **flashing the stock boot image**. Therefore, at the beginning of the installation guide, we strongly recommend that you back up your stock boot before flashing. If you didn't back it up, you can obtain the original factory boot from other users with the same device or from the official firmware.
|
||||
|
||||
## Brick by modules
|
||||
|
||||
Installing modules can be a more common cause of bricking your device, but we must seriously warn you: **Do not install modules from unknown sources**! Since modules have root privileges, they can potentially cause irreversible damage to your device!
|
||||
The installation of modules can be one of the most common causes of bricking your device, but we must seriously warn you: **DO NOT INSTALL MODULES FROM UNKNOWN SOURCES!** Since modules have root privileges, they can cause irreversible damage to your device!
|
||||
|
||||
### Normal modules
|
||||
|
||||
If you have flashed a module that has been proven to be safe but causes your device to fail to boot, then this situation is easily recoverable in KernelSU without any worries. KernelSU has built-in mechanisms to rescue your device, including the following:
|
||||
|
||||
1. AB update
|
||||
2. Rescue by pressing Volume Down
|
||||
2. Rescue by pressing Volume down button
|
||||
|
||||
#### AB update
|
||||
|
||||
KernelSU's module updates draw inspiration from the Android system's AB update mechanism used in OTA updates. If you install a new module or update an existing one, it will not directly modify the currently used module file. Instead, all modules will be built into another update image. After the system is restarted, it will attempt to start using this update image. If the Android system successfully boots up, the modules will then be truly updated.
|
||||
KernelSU's module updates are based on the Android system's AB update mechanism used in OTA updates. When you install a new module or update an existing one, it won't directly modify the currently used module file. Instead, all modules are integrated into a new update image. After the system is restarted, it will attempt to boot using this new update image. If the Android system boots successfully, the modules will be effectively updated.
|
||||
|
||||
Therefore, the simplest and most commonly used method to rescue your device is to **force a reboot**. If you are unable to start your system after flashing a module, you can press and hold the power button for more than 10 seconds, and the system will automatically reboot; after rebooting, it will roll back to the state before updating the module, and the previously updated modules will be automatically disabled.
|
||||
Therefore, the simplest and most commonly used method to rescue your device is to **force a reboot**. If you're unable to start your system after flashing a module, you can press and hold the power button for more than 10 seconds, and the system will automatically reboot. After rebooting, it will roll back to the state before the module update, and any previously updated modules will be automatically disabled.
|
||||
|
||||
#### Rescue by pressing Volume Down
|
||||
#### Rescue by pressing Volume down button
|
||||
|
||||
If AB updates still cannot solve the problem, you can try using **Safe Mode**. In Safe Mode, all modules are disabled.
|
||||
If AB update hasn't yet resolved the issue, you can try using **Safe Mode**. In this mode, all modules are disabled.
|
||||
|
||||
There are two ways to enter Safe Mode:
|
||||
|
||||
1. The built-in Safe Mode of some systems; some systems have a built-in Safe Mode that can be accessed by long-pressing the volume down button, while others (such as MIUI) can enable Safe Mode in Recovery. When entering the system's Safe Mode, KernelSU will also enter Safe Mode and automatically disable modules.
|
||||
2. The built-in Safe Mode of KernelSU; the operation method is to **press the volume down key continuously for more than three times** after the first boot screen. Note that it is press-release, press-release, press-release, not press and hold.
|
||||
1. The built-in Safe Mode of some systems: Some systems have a built-in Safe Mode that can be accessed by long-pressing the Volume down button. In other systems (such as HyperOS), Safe Mode can be activated from the Recovery. When entering the system's Safe Mode, KernelSU will also enter this mode and automatically disable the modules.
|
||||
2. The built-in Safe Mode of KernelSU: In this case, the method is to **press the Volume down key continuously more than three times** after the first boot screen.
|
||||
|
||||
After entering safe mode, all modules on the module page of the KernelSU Manager are disabled, but you can perform "uninstall" operations to uninstall any modules that may be causing issues.
|
||||
After entering Safe Mode, all modules on the Module page in the KernelSU manager will be disabled. However, you can still perform the "uninstall" operation to remove any modules that may be causing issues.
|
||||
|
||||
The built-in safe mode is implemented in the kernel, so there is no possibility of missing key events due to interception. However, for non-GKI kernels, manual integration of the code may be required, and you can refer to the official documentation for guidance.
|
||||
The built-in Safe Mode is implemented in the kernel, so there is no possibility of missing important events due to interception. However, for non-GKI kernels, manual code integration may be required. For this, refer to the official documentation for guidance.
|
||||
|
||||
### Malicious modules
|
||||
|
||||
If the above methods cannot rescue your device, it is very likely that the module you installed has malicious operations or has damaged your device through other means. In this case, there are only two suggestions:
|
||||
If the above methods cannot rescue your device, it's highly likely that the module you installed has malicious operations or has damaged your device in some other way. In this case, there are only two suggestions:
|
||||
|
||||
1. Wipe the data and flash the official system.
|
||||
2. Consult the after-sales service.
|
||||
|
@ -1,11 +1,11 @@
|
||||
# Unofficially Supported Devices
|
||||
# Unofficially supported devices
|
||||
|
||||
::: warning
|
||||
In this page, there are kernels for non-GKI devices supporting KernelSU maintained by other developers.
|
||||
:::
|
||||
|
||||
::: warning
|
||||
This page is only for you to find the source code corresponding to your device, it does **NOT** mean that the source code has been reviewed by _KernelSU Developers_. You should use it at your own risk.
|
||||
This page is intended only to help you find the source code corresponding to your device. It **DOES NOT** mean that the source code has been reviewed by KernelSU developers. You should use it at your own risk.
|
||||
:::
|
||||
|
||||
<script setup>
|
||||
|
@ -4,15 +4,15 @@ KernelSU is a root solution for Android GKI devices, it works in kernel mode and
|
||||
|
||||
## Features
|
||||
|
||||
The main feature of KernelSU is it is **Kernel-based**. KernelSU works in kernel mode, so it can provide kernel interface we never had before. For example, we can add hardware breakpoint to any process in kernel mode; We can access physical memory of any process without anybody being aware of; We can intercept any syscall in kernel space; etc.
|
||||
The main feature of KernelSU is that it's **kernel-based**. KernelSU works in kernel mode, enabling it to provide a kernel interface that we never had before. For example, it's possible to add hardware breakpoints to any process in kernel mode, access the physical memory of any process invisibly, intercept any system call (syscall) within the kernel space, among other functionalities.
|
||||
|
||||
And also, KernelSU provides a module system via OverlayFS, which allows you to load your custom plugin into system. It also provides a mechanism to modify files in `/system` partition.
|
||||
Additionally, KernelSU provides a module system via OverlayFS, which allows you to load your custom plugin into system. It also provides a mechanism to modify files in `/system` partition.
|
||||
|
||||
## How to use?
|
||||
## How to use KernelSU?
|
||||
|
||||
Please refer: [Installation](installation)
|
||||
|
||||
## How to build?
|
||||
## How to build KernelSU?
|
||||
|
||||
Please refer: [How to build](how-to-build)
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
layout: home
|
||||
title: A kernel-based root solution for Android
|
||||
title: Home
|
||||
|
||||
hero:
|
||||
name: KernelSU
|
||||
@ -21,8 +21,8 @@ features:
|
||||
- title: Kernel-based
|
||||
details: As the name suggests, KernelSU works under the Linux kernel giving it more control over userspace apps.
|
||||
- title: Root access control
|
||||
details: Only permitted apps may access or see su, all other apps are not aware of this.
|
||||
details: Only permitted apps may access or see su, all other apps aren't aware of this.
|
||||
- title: Customizable root privileges
|
||||
details: KernelSU allows customization of su's uid, gid, groups, capabilities, and SELinux rules, locking up root privileges.
|
||||
- title: Modules
|
||||
details: Modules may modify /system systemlessly using OverlayFS enabling great power.
|
||||
details: Modules may modify /system systemlessly using OverlayFS providing significant flexibility.
|
||||
|
@ -10,11 +10,11 @@ Para apps comuns sem privilégios root, o Perfil do Aplicativo pode controlar o
|
||||
|
||||
### UID, GID e Grupos
|
||||
|
||||
Os sistemas Linux possuem dois conceitos: usuários e grupos. Cada usuário possui um ID de usuário (UID) e um usuário pode pertencer a vários grupos, cada um com seu próprio ID de grupo (GID). Esses IDs são usados para identificar usuários no sistema e determinar quais recursos do sistema eles podem acessar.
|
||||
Os sistemas Linux possuem dois conceitos: usuários e grupos. Cada usuário possui um ID de usuário (UID) e pode pertencer a vários grupos, cada um com seu próprio ID de grupo (GID). Esses IDs são usados para identificar usuários no sistema e determinar quais recursos do sistema eles podem acessar.
|
||||
|
||||
Os usuários com UID 0 são conhecidos como usuários root e os grupos com GID 0 são conhecidos como grupos root. O grupo de usuários root normalmente possui os privilégios de sistema mais altos.
|
||||
Os usuários com UID 0 são conhecidos como usuários root, e grupos com GID 0 são chamados de grupos root. O grupo de usuários root geralmente tem os privilégios mais altos no sistema.
|
||||
|
||||
No caso do sistema Android, cada app é um usuário separado (excluindo cenários de UID compartilhados) com um UID exclusivo. Por exemplo, `0` representa o usuário root, `1000` representa `system`, `2000` representa o ADB shell e UIDs variando de `10000` a `19999` representam apps comuns.
|
||||
No caso do sistema Android, cada app funciona como um usuário separado (exceto em casos de UID compartilhado) e recebe um UID exclusivo. Por exemplo, `0` representa o usuário root, `1000` representa `system`, `2000` ao ADB shell e os UIDs de `10000` a `19999` são atribuídos a apps comuns.
|
||||
|
||||
::: info INFORMAÇÕES
|
||||
Aqui, o UID mencionado não é o mesmo que o conceito de múltiplos usuários ou perfis de trabalho no sistema Android. Os perfis de trabalho são, na verdade, implementados particionando o intervalo UID. Por exemplo, 10000-19999 representa o usuário principal, enquanto 110000-119999 representa um perfil de trabalho. Cada app comum entre eles possui seu próprio UID exclusivo.
|
||||
@ -31,10 +31,10 @@ uid=2000(shell) gid=2000(shell) groups=2000(shell),1004(input),1007(log),1011(ad
|
||||
|
||||
Aqui, o UID é `2000` e o GID (ID do grupo primário) também é `2000`. Além disso, pertence a vários grupos suplementares, como `inet` (indicando a capacidade de criar soquetes `AF_INET` e `AF_INET6`) e `sdcard_rw` (indicando permissões de leitura/gravação para o cartão SD).
|
||||
|
||||
O Perfil root do KernelSU permite a personalização do UID, GID e grupos para o processo root após a execução de `su`. Por exemplo, o Perfil root de um app root pode definir seu UID como `2000`, que significa que ao usar `su`, as permissões reais do app estão no nível do ADB shell. O grupo `inet` pode ser removido, evitando que o comando `su` acesse a rede.
|
||||
O Perfil root do KernelSU permite personalizar o UID, GID e grupos para o processo root após a execução de `su`. Por exemplo, o Perfil root de um app root pode definir seu UID como `2000`, o que significa que, ao usar `su`, as permissões reais do app estão no nível do ADB shell. Além disso, o grupo `inet` pode ser removido, evitando que o comando `su` tenha acesso à rede.
|
||||
|
||||
::: tip OBSERVAÇÃO
|
||||
O Perfil do Aplicativo controla apenas as permissões do processo root após usar `su`, e ele não controla as permissões do próprio app. Se um app solicitou permissão de acesso à rede, ele ainda poderá acessar a rede mesmo sem usar `su`. Remover o grupo `inet` de `su` apenas impede que `su` acesse a rede.
|
||||
O Perfil do Aplicativo controla apenas as permissões do processo root após usar `su` e não afeta as permissões do próprio app. Se um app solicitou permissão para acessar a rede, ele ainda poderá acessar a rede mesmo sem usar `su`. Remover o grupo `inet` de `su` apenas impede que `su` acesse a rede.
|
||||
:::
|
||||
|
||||
O Perfil root é aplicado no kernel e não depende do comportamento voluntário de apps root, ao contrário da troca de usuários ou grupos por meio de `su`. A concessão da permissão `su` depende inteiramente do usuário e não do desenvolvedor.
|
||||
@ -47,9 +47,9 @@ Para realizar verificações de permissão, as implementações tradicionais do
|
||||
|
||||
A partir do Linux 2.2, o Linux divide os privilégios tradicionalmente associados ao superusuário em unidades distintas, conhecidas como capacidades, que podem ser ativadas e desativadas de forma independente.
|
||||
|
||||
Cada capacidade representa um ou mais privilégios. Por exemplo, `CAP_DAC_READ_SEARCH` representa a capacidade de ignorar verificações de permissão para leitura de arquivos, bem como permissões de leitura e execução de diretório. Se um usuário com um UID efetivo `0` (usuário root) não tiver recursos `CAP_DAC_READ_SEARCH` ou superiores, isso significa que mesmo sendo root, ele não pode ler arquivos à vontade.
|
||||
Cada capacidade representa um ou mais privilégios. Por exemplo, `CAP_DAC_READ_SEARCH` representa a capacidade de ignorar verificações de permissão para leitura de arquivos, bem como permissões de leitura e execução de diretório. Se um usuário com um UID efetivo `0` (usuário root) não tiver a capacidade `CAP_DAC_READ_SEARCH` ou superiores, isso significa que mesmo sendo root, ele não pode ler arquivos à vontade.
|
||||
|
||||
O Perfil root do KernelSU permite a personalização das capacidades do processo root após a execução de `su`, conseguindo assim conceder parcialmente "privilégios root". Ao contrário do UID e GID mencionados acima, certos apps root exigem um UID de `0` após usar `su`. Nesses casos, limitar as capacidades deste usuário root com UID `0` pode restringir suas operações permitidas.
|
||||
O Perfil root do KernelSU permite a personalização das capacidades do processo root após a execução de `su`, concedendo assim "privilégios root" de forma parcial. Ao contrário do UID e GID mencionados acima, certos apps root exigem um UID de `0` após usar `su`. Nesses casos, limitar as capacidades deste usuário root com UID `0` pode restringir as operações que ele pode realizar.
|
||||
|
||||
::: tip FORTE RECOMENDAÇÃO
|
||||
A [documentação oficial](https://man7.org/linux/man-pages/man7/capabilities.7.html) da capacidade do Linux fornece explicações detalhadas das habilidades representadas por cada capacidade. Se você pretende customizar as capacidade, é altamente recomendável que você leia este documento primeiro.
|
||||
@ -65,7 +65,7 @@ O SELinux pode ser executado em dois modos globais:
|
||||
2. Modo de aplicação: Os eventos de negação são registrados e aplicados.
|
||||
|
||||
::: warning AVISO
|
||||
Os sistemas Android modernos dependem fortemente do SELinux para garantir a segurança geral do sistema. É altamente recomendável não usar nenhum sistema personalizado executado em "Modo permissivo", pois não oferece vantagens significativas em relação a um sistema completamente aberto.
|
||||
Os sistemas Android modernos dependem fortemente do SELinux para garantir a segurança geral do sistema. É altamente recomendável não usar nenhum sistema personalizado executado em "Modo permissivo", pois ele não oferece vantagens significativas em relação a um sistema completamente aberto.
|
||||
:::
|
||||
|
||||
Explicar o conceito completo do SELinux é complexo e está além do objetivo deste documento. Recomenda-se primeiro entender seu funcionamento através dos seguintes recursos:
|
||||
@ -74,9 +74,9 @@ Explicar o conceito completo do SELinux é complexo e está além do objetivo de
|
||||
2. [Red Hat: O que é SELinux?](https://www.redhat.com/pt-br/topics/linux/what-is-selinux)
|
||||
3. [ArchLinux: SELinux](https://wiki.archlinux.org/title/SELinux)
|
||||
|
||||
O Perfil root do KernelSU permite a personalização do contexto SELinux do processo root após a execução de `su`. Regras específicas de controle de acesso podem ser definidas para este contexto para permitir um controle refinado sobre os privilégios root.
|
||||
O Perfil root do KernelSU permite a personalização do contexto SELinux do processo root após a execução de `su`. Regras específicas de controle de acesso podem ser definidas para este contexto, possibilitando um controle refinado sobre os privilégios root.
|
||||
|
||||
Em cenários típicos, quando um app executa `su`, ele alterna o processo para um domínio SELinux com **acesso irrestrito**, como `u:r:su:s0`. Através do Perfil root, este domínio pode ser mudado para um domínio personalizado, como `u:r:app1:s0`, e uma série de regras podem ser definidas para este domínio:
|
||||
Em cenários típicos, quando um app executa `su`, ele alterna o processo para um domínio SELinux com **acesso irrestrito**, como `u:r:su:s0`. Através do Perfil root, esse domínio pode ser mudado para um domínio personalizado, como `u:r:app1:s0`, e uma série de regras podem ser definidas para esse domínio:
|
||||
|
||||
```sh
|
||||
type app1
|
||||
@ -91,10 +91,10 @@ Observe que a regra `allow app1 * * *` é usada apenas para fins de demonstraç
|
||||
|
||||
Se a configuração do Perfil root não estiver definida corretamente, poderá ocorrer um cenário de escalação. As restrições impostas pelo Perfil root poderão falhar involuntariamente.
|
||||
|
||||
Por exemplo, se você conceder permissão root a um usuário ADB shell (que é um caso comum) e, em seguida, conceder permissão root a um app normal, mas configurar seu Perfil root com UID 2000 (que é o UID do usuário ADB shell), o app pode obter acesso root completo executando o comando `su` duas vezes:
|
||||
Por exemplo, se você conceder permissão root a um usuário ADB shell (que é um caso comum) e, em seguida, conceder permissão root a um app normal, mas configurar seu Perfil root com o UID 2000 (o UID do usuário ADB shell), o app pode obter acesso root completo ao executar o comando `su` duas vezes:
|
||||
|
||||
1. A primeira execução `su` está sujeita à aplicação do Perfil do Aplicativo e mudará para UID `2000` (ADB shell) em vez de `0` (root).
|
||||
2. A segunda execução `su`, como o UID é `2000` e você concedeu acesso root ao UID `2000` (ADB shell) na configuração, o app obterá privilégios root completo.
|
||||
1. A primeira execução de `su` será sujeita ao Perfil do Aplicativo, e mudará para o UID `2000` (ADB shell) em vez de `0` (root).
|
||||
2. A segunda execução de `su`, como o UID é `2000` e você concedeu acesso root ao UID `2000` (ADB shell) na configuração, o app obterá privilégios root completo.
|
||||
|
||||
::: warning OBSERVAÇÃO
|
||||
Este comportamento é totalmente esperado e não é um bug. Portanto, recomendamos o seguinte:
|
||||
@ -106,13 +106,13 @@ Se você realmente precisa conceder privilégios root ao ADB (por exemplo, como
|
||||
|
||||
### Desmontar módulos
|
||||
|
||||
O KernelSU fornece um mecanismo sem sistema para modificar partições do sistema, obtido através da montagem de OverlayFS. No entanto, alguns apps podem ser sensíveis a esse comportamento. Assim, podemos descarregar módulos montados nesses apps configurando a opção "Desmontar módulos".
|
||||
O KernelSU fornece um mecanismo sem sistema para modificar partições do sistema, obtido através da montagem do OverlayFS. No entanto, alguns apps podem ser sensíveis a esse comportamento. Nesse caso, podemos descarregar módulos montados nesses apps configurando a opção "Desmontar módulos".
|
||||
|
||||
Além disso, a interface de configurações do gerenciador do KernelSU fornece uma opção para "Desmontar módulos por padrão". Por padrão, essa opção está **ativada**, o que significa que o KernelSU ou alguns módulos descarregarão módulos para este app, a menos que configurações adicionais sejam aplicadas. Se você não preferir esta configuração ou se ela afetar determinados apps, você terá as seguintes opções:
|
||||
Além disso, a interface de configurações do gerenciador do KernelSU oferece a opção "Desmontar módulos por padrão". Por padrão, essa opção está **ativada**, o que significa que o KernelSU ou alguns módulos descarregarão módulos para este app, a menos que configurações adicionais sejam aplicadas. Se você não preferir esta configuração ou se ela afetar determinados apps, você terá as seguintes opções:
|
||||
|
||||
1. Mantenha a opção "Desmontar módulos por padrão" e desative individualmente a opção "Desmontar módulos" no Perfil do Aplicativo para apps que exigem carregamento do módulo (agindo como uma "lista de permissões").
|
||||
2. Desative a opção "Desmontar módulos por padrão" e ative individualmente a opção "Desmontar módulos" no Perfil do Aplicativo para apps que exigem descarregamento do módulo (agindo como uma "lista negra").
|
||||
1. Manter a opção "Desmontar módulos por padrão" ativada e desative individualmente a opção "Desmontar módulos" no Perfil do Aplicativo para apps que exigem o carregamento do módulo (agindo como uma "lista de permissões").
|
||||
2. Desativar a opção "Desmontar módulos por padrão" e ativar individualmente a opção "Desmontar módulos" no Perfil do Aplicativo para apps que exigem o descarregamento do módulo (agindo como uma "lista negra").
|
||||
|
||||
::: info INFORMAÇÕES
|
||||
Em dispositivos que utilizam a versão do kernel 5.10 e superior, o kernel realiza qualquer ação adicional do descarregamento de módulos. No entanto, para dispositivos que executam versões do kernel abaixo de 5.10, essa opção é apenas uma opção de configuração e o próprio KernelSU não executa nenhuma ação. Se você quiser usar a opção "Desmontar módulos" em versões do kernel anteriores a 5.10 você precisa portar a função `path_umount` em `fs/namespace.c`, você pode obter mais informações no final da página [Como integrar o KernelSU para kernels não GKI](https://kernelsu.org/pt_BR/guide/how-to-integrate-for-non-gki.html). Alguns módulos, como ZygiskNext, também podem usar essa opção para determinar se o descarregamento do módulo é necessário.
|
||||
Em dispositivos que utilizam a versão do kernel 5.10 ou superior, o kernel realiza qualquer ação adicional do descarregamento de módulos. No entanto, para dispositivos que executam versões do kernel abaixo de 5.10, essa opção é apenas uma opção de configuração e o próprio KernelSU não executa nenhuma ação. Se você quiser usar a opção "Desmontar módulos" em versões do kernel anteriores a 5.10, é necessário portar a função `path_umount` em `fs/namespace.c`. Você pode obter mais informações no final da página [Integração para dispositivos não-GKI](https://kernelsu.org/pt_BR/guide/how-to-integrate-for-non-gki.html). Alguns módulos, como ZygiskNext, também podem usar essa opção para determinar se o descarregamento do módulo é necessário.
|
||||
:::
|
||||
|
@ -1,28 +1,28 @@
|
||||
# Diferenças com Magisk
|
||||
|
||||
Embora existam muitas semelhanças entre os módulos KernelSU e os módulos Magisk, existem inevitavelmente algumas diferenças devido aos seus mecanismos de implementação completamente diferentes. Se você deseja que seu módulo seja executado no Magisk e no KernelSU, você deve entender essas diferenças.
|
||||
Embora os módulos do KernelSU e do Magisk tenham muitas semelhanças, existem inevitavelmente algumas diferenças devido aos seus mecanismos de implementação completamente diferentes. Se você deseja que seu módulo funcione tanto no Magisk quanto no KernelSU, é essencial compreender essas diferenças.
|
||||
|
||||
## Semelhanças
|
||||
|
||||
- Formato de arquivo do módulo: ambos usam o formato ZIP para organizar os módulos, e o formato dos módulos é quase o mesmo.
|
||||
- Diretório de instalação do módulo: ambos localizados em `/data/adb/modules`.
|
||||
- Sem sistema: ambos suportam a modificação de `/system` de maneira sem sistema por meio de módulos.
|
||||
- post-fs-data.sh: o tempo de execução e a semântica são exatamente os mesmos.
|
||||
- service.sh: o tempo de execução e a semântica são exatamente os mesmos.
|
||||
- system.prop: completamente o mesmo.
|
||||
- sepolicy.rule: completamente o mesmo.
|
||||
- BusyBox: os scripts são executados no BusyBox com o "Modo Autônomo" ativado em ambos os casos.
|
||||
- Formato de arquivo do módulo: Ambos usam o formato ZIP para organizar os módulos, e o formato dos módulos é praticamente o mesmo.
|
||||
- Diretório de instalação do módulo: Ambos estão localizados em `/data/adb/modules`.
|
||||
- Sem sistema: Ambos suportam a modificação de `/system` de forma sem sistema por meio de módulos.
|
||||
- post-fs-data.sh: O tempo de execução e a semântica são exatamente os mesmos.
|
||||
- service.sh: O tempo de execução e a semântica são exatamente os mesmos.
|
||||
- system.prop: Completamente o mesmo.
|
||||
- sepolicy.rule: Completamente o mesmo.
|
||||
- BusyBox: Os scripts são executados no BusyBox com o "Modo Autônomo" ativado em ambos os casos.
|
||||
|
||||
## Diferenças
|
||||
|
||||
Antes de entender as diferenças, você precisa saber diferenciar se o seu módulo está rodando no KernelSU ou Magisk. Você pode usar a variável de ambiente `KSU` para diferenciá-la em todos os locais onde você pode executar os scripts do módulo (`customize.sh`, `post-fs-data.sh`, `service.sh`). No KernelSU, esta variável de ambiente será definida como `true`.
|
||||
Antes de entender as diferenças, é importante saber como identificar se o seu módulo está sendo executado no KernelSU ou no Magisk. Você pode usar a variável de ambiente `KSU` para diferenciá-lo em todos os locais onde você pode executar os scripts do módulo (`customize.sh`, `post-fs-data.sh`, `service.sh`). No KernelSU, essa variável de ambiente será definida como `true`.
|
||||
|
||||
Aqui estão algumas diferenças:
|
||||
|
||||
- Os módulos KernelSU não podem ser instalados no modo Recovery.
|
||||
- Os módulos KernelSU não têm suporte integrado para Zygisk (mas você pode usar módulos Zygisk através do [ZygiskNext](https://github.com/Dr-TSNG/ZygiskNext).
|
||||
- O método para substituir ou excluir arquivos nos módulos KernelSU é completamente diferente do Magisk. O KernelSU não suporta o método `.replace`. Em vez disso, você precisa criar um arquivo com o mesmo nome `mknod filename c 0 0` para excluir o arquivo correspondente.
|
||||
- Os módulos KernelSU não oferece suporte nativo ao Zygisk, mas você pode usar módulos Zygisk através do [ZygiskNext](https://github.com/Dr-TSNG/ZygiskNext).
|
||||
- O método para substituir ou excluir arquivos nos módulos do KernelSU é completamente diferente do Magisk. O KernelSU não suporta o método `.replace`. Em vez disso, você deve criar um arquivo com o comando `mknod filename c 0 0` para excluir o arquivo correspondente.
|
||||
- Os diretórios do BusyBox são diferentes. O BusyBox integrado no KernelSU está localizado em `/data/adb/ksu/bin/busybox`, enquanto no Magisk está em `/data/adb/magisk/busybox`. **Observe que este é um comportamento interno do KernelSU e pode mudar no futuro!**
|
||||
- O KernelSU não suporta arquivos `.replace`, entretanto, o KernelSU suporta as variáveis `REMOVE` e `REPLACE` para remover ou substituir arquivos e pastas.
|
||||
- O KernelSU adiciona o estágio `boot-completed` para executar alguns scripts na inicialização concluída.
|
||||
- O KernelSU adiciona o estágio `post-mount` para executar alguns scripts após montar OverlayFS.
|
||||
- O KernelSU não suporta arquivos `.replace`, mas oferece suporte às variáveis `REMOVE` e `REPLACE` para remover ou substituir arquivos e pastas.
|
||||
- O KernelSU adiciona o estágio `boot-completed` para executar scripts após a inicialização ser concluída.
|
||||
- O KernelSU adiciona o estágio `post-mount` para executar scripts após o OverlayFS ser montado.
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
Primeiro, seu dispositivo deve ser capaz de desbloquear o bootloader. Se não, então não há suporte.
|
||||
|
||||
Em seguida, instale o gerenciador do KernelSU em seu dispositivo e abra-o, se mostrar `Sem suporte` então seu dispositivo não pode ser suportado imediatamente, mas você pode compilar a fonte do kernel e integrar o KernelSU para fazê-lo funcionar ou usar [Dispositivos com suporte não oficial](unofficially-support-devices).
|
||||
Em seguida, instale o gerenciador do KernelSU no seu dispositivo e abra-o. Se aparecer `Sem suporte` então seu dispositivo não pode ser suportado imediatamente. No entanto, você pode compilar a fonte do kernel e integrar o KernelSU para fazê-lo funcionar ou usar [Dispositivos com suporte não oficial](unofficially-support-devices).
|
||||
|
||||
## Para usar o KernelSU precisa desbloquear o bootloader?
|
||||
|
||||
@ -24,15 +24,15 @@ KernelSU não tem suporte integrado ao Zygisk, mas você pode usar [ZygiskNext](
|
||||
|
||||
## KernelSU é compatível com o Magisk?
|
||||
|
||||
O sistema de módulos do KernelSU está em conflito com a montagem mágica do Magisk, se houver algum módulo ativado no KernelSU, então todo o Magisk não funcionaria.
|
||||
O sistema de módulos do KernelSU está em conflito com a montagem mágica do Magisk. Se houver algum módulo ativado no KernelSU, todo o Magisk deixará de funcionar.
|
||||
|
||||
Mas se você usar apenas o `su` do KernelSU, então funcionará bem com o Magisk. KernelSU modifica o `kernel` e o Magisk modifica o `ramdisk`, eles podem trabalhar juntos.
|
||||
No entanto, se você usar apenas o `su` do KernelSU, ele funcionará bem com o Magisk. O KernelSU modifica o `kernel`, enquanto o Magisk modifica o `ramdisk`, permitindo que ambos trabalhem juntos.
|
||||
|
||||
## KernelSU substituirá o Magisk?
|
||||
|
||||
Achamos que não e esse não é o nosso objetivo. O Magisk é bom o suficiente para solução root do espaço do usuário e terá uma longa vida. O objetivo do KernelSU é fornecer uma interface de kernel aos usuários, não substituindo o Magisk.
|
||||
Acreditamos que não, e esse não é o nosso objetivo. O Magisk é bom o suficiente para solução root do espaço do usuário e terá uma longa vida. O objetivo do KernelSU é fornecer uma interface de kernel aos usuários, não substituindo o Magisk.
|
||||
|
||||
## KernelSU oferece suporte a dispositivos não GKI?
|
||||
## KernelSU oferece suporte a dispositivos não-GKI?
|
||||
|
||||
É possível. Mas você deve baixar o código-fonte do kernel e integrar o KernelSU à árvore do código-fonte e compilar o kernel você mesmo.
|
||||
|
||||
@ -45,15 +45,15 @@ Achamos que não e esse não é o nosso objetivo. O Magisk é bom o suficiente p
|
||||
|
||||
## KernelSU suporta kernel antigo?
|
||||
|
||||
É possível, o KernelSU é portado para o kernel 4.14 agora, para o kernel mais antigo, você precisa portar manualmente e PRs são sempre bem-vindas!
|
||||
É possível, o KernelSU é portado para o kernel 4.14 agora. Para kernels mais antigo, você precisa portar manualmente e PRs são sempre bem-vindas!
|
||||
|
||||
## Como integrar o KernelSU para um kernel antigo?
|
||||
|
||||
Por favor, consulte a guia [Como integrar o KernelSU para kernels não GKI](how-to-integrate-for-non-gki).
|
||||
Por favor, verifique o guia [Integração para dispositivos não-GKI](how-to-integrate-for-non-gki).
|
||||
|
||||
## Por que a minha versão do Android é 13 e o kernel mostra “android12-5.10”?
|
||||
## Por que a minha versão do Android é 13 e o kernel mostra "android12-5.10"?
|
||||
|
||||
A versão do Kernel não tem nada a ver com a versão do Android, se você precisar fazer o flash do kernel, use sempre a versão do kernel, a versão do Android não é tão importante.
|
||||
A versão do Kernel não tem nada a ver com a versão do Android. Se você precisar fazer o flash do kernel, use sempre a versão do kernel, a versão do Android não é tão importante.
|
||||
|
||||
## Eu sou GKI 1.0, posso usar isso?
|
||||
|
||||
@ -69,10 +69,10 @@ Claro. Mas o KernelSU não tem suporte a hosts integrados, você pode instalar [
|
||||
|
||||
## Por que existe um enorme arquivo de 1 TB?
|
||||
|
||||
O arquivo `modules.img` de 1 TB é um arquivo de imagem de disco, **não se preocupe com seu tamanho**, é um tipo especial de arquivo conhecido como [arquivo esparso](https://en.wikipedia.org/wiki/Sparse_file), seu tamanho real é apenas o tamanho do módulo que você usa e diminuirá dinamicamente após você excluir o módulo. Na verdade, ele não ocupa 1 TB de espaço em disco (seu celular pode não ter tanto espaço).
|
||||
O arquivo `modules.img` de 1 TB é um arquivo de imagem de disco. **Não se preocupe com seu tamanho**; ele é um tipo especial de arquivo conhecido como [arquivo esparso](https://en.wikipedia.org/wiki/Sparse_file). Seu tamanho real é apenas o tamanho do módulo que você usa e diminuirá dinamicamente após a exclusão do módulo. Na verdade, ele não ocupa 1 TB de espaço em disco (seu celular pode não ter tanto espaço).
|
||||
|
||||
Se você estiver realmente insatisfeito com o tamanho deste arquivo, você pode usar o comando `resize2fs -M` para torná-lo seu tamanho real, mas o módulo pode não funcionar corretamente neste momento e não forneceremos nenhum suporte para isso.
|
||||
Se você realmente se incomodar com o tamanho desse arquivo, você pode usar o comando `resize2fs -M` para ajustá-lo ao tamanho real. Porém, o módulo pode não funcionar corretamente nesse caso, e não forneceremos suporte para isso.
|
||||
|
||||
## Por que meu dispositivo mostra o tamanho de armazenamento errado?
|
||||
|
||||
Certos dispositivos usam métodos não padrão para calcular o tamanho de armazenamento do dispositivo, potencialmente levando a cálculos de armazenamento imprecisos em apps e menus do sistema, especialmente ao lidar com arquivos esparsos de 1 TB. Embora esse problema pareça ser específico para os dispositivos Samsung, afetando apenas apps e serviços da Samsung, é essencial observar que a discrepância está principalmente no tamanho total do armazenamento, e o cálculo do espaço livre permanece preciso.
|
||||
Certos dispositivos usam métodos não padrão para calcular o tamanho de armazenamento do dispositivo, o que pode levar a cálculos imprecisos nos apps e menus do sistema, especialmente ao lidar com arquivos esparsos de 1 TB. Embora esse problema pareça ser específico para os dispositivos Samsung, afetando principalmente os apps e serviços da Samsung, é importante observar que a discrepância está principalmente no tamanho total do armazenamento, enquanto o cálculo do espaço livre permanece preciso.
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Como compilar o KernelSU?
|
||||
# Como compilar
|
||||
|
||||
Primeiro, você deve ler a documentação oficial do Android para compilação do kernel:
|
||||
|
||||
@ -6,7 +6,7 @@ Primeiro, você deve ler a documentação oficial do Android para compilação d
|
||||
2. [Builds de versão de imagem genérica do kernel (GKI)](https://source.android.com/docs/core/architecture/kernel/gki-release-builds)
|
||||
|
||||
::: warning AVISO
|
||||
Esta página é para dispositivos GKI, se você usa um kernel antigo, consulte [Como integrar o KernelSU para kernels não GKI](how-to-integrate-for-non-gki).
|
||||
Esta página é para dispositivos GKI, se você usa um kernel antigo, consulte [Integração para dispositivos não-GKI](how-to-integrate-for-non-gki).
|
||||
:::
|
||||
|
||||
## Compilar o kernel
|
||||
@ -20,7 +20,7 @@ repo init -m manifest.xml
|
||||
repo sync
|
||||
```
|
||||
|
||||
O `<kernel_manifest.xml>` é um arquivo de manifesto que pode determinar uma compilação exclusivamente, você pode usar o manifesto para fazer uma compilação re-preduzível. Você deve baixar o arquivo de manifesto em [Builds de versão de imagem genérica do kernel (GKI)](https://source.android.com/docs/core/architecture/kernel/gki-release-builds).
|
||||
O arquivo `<kernel_manifest.xml>` é um manifesto que pode determinar exclusivamente uma compilação, permitindo que você a torne reprodutível. Para isso, você deve baixar o arquivo de manifesto em [Builds de versão de imagem genérica do kernel (GKI)](https://source.android.com/docs/core/architecture/kernel/gki-release-builds).
|
||||
|
||||
### Construir
|
||||
|
||||
@ -50,7 +50,7 @@ rm common/android/abi_gki_protected_exports_*
|
||||
|
||||
## Compilar o kernel com KernelSU
|
||||
|
||||
Se você conseguir compilar o kernel com sucesso, adicionar suporte ao KernelSU a ele será relativamente fácil. Na raiz do diretório de origem do kernel, execute qualquer uma das opções listadas abaixo:
|
||||
Se você conseguir compilar o kernel com sucesso, adicionar suporte ao KernelSU será relativamente simples. Na raiz do diretório de origem do kernel, execute qualquer uma das opções listadas abaixo:
|
||||
|
||||
::: code-group
|
||||
|
||||
@ -68,4 +68,4 @@ curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh
|
||||
|
||||
:::
|
||||
|
||||
E então reconstrua o kernel e você obterá uma imagem do kernel com KernelSU!
|
||||
Então, reconstrua o kernel e você obterá uma imagem do kernel com o KernelSU!
|
||||
|
@ -1,10 +1,10 @@
|
||||
# Como integrar o KernelSU para kernels não GKI?
|
||||
# Integração para dispositivos não-GKI
|
||||
|
||||
O KernelSU pode ser integrado em kernels não GKI e foi portado para 4.14 e versões anteriores.
|
||||
O KernelSU pode ser integrado a kernels não-GKI e foi portado para 4.14 e versões anteriores.
|
||||
|
||||
Devido à fragmentação de kernels não GKI, não temos uma maneira universal de construí-lo, portanto não podemos fornecer o boot.img não GKI. Mas você mesmo pode compilar o kernel com o KernelSU integrado.
|
||||
Devido à fragmentação dos kernels não-GKI, não temos um método universal para construí-lo, portanto, não podemos fornecer o boot.img não-GKI. No entanto, você pode compilar o kernel com o KernelSU integrado por conta própria.
|
||||
|
||||
Primeiro, você deve ser capaz de compilar um kernel inicializável a partir do código-fonte do kernel. Se o kernel não for de código aberto, será difícil executar o KernelSU no seu dispositivo.
|
||||
Primeiro, você deve ser capaz de compilar um kernel inicializável a partir do código-fonte do kernel. Se o kernel não for de código aberto, será difícil executar o KernelSU para o seu dispositivo.
|
||||
|
||||
Se você puder compilar um kernel inicializável, existem duas maneiras de integrar o KernelSU ao código-fonte do kernel:
|
||||
|
||||
@ -22,10 +22,10 @@ curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh
|
||||
```
|
||||
|
||||
::: info INFORMAÇÕES
|
||||
[KernelSU 1.0 e versões posteriores não suportam mais kernels não GKI](https://github.com/tiann/KernelSU/issues/1705). A última versão suportada é a `v0.9.5`, por favor, certifique-se de usar a versão correta.
|
||||
[KernelSU 1.0 e versões posteriores não suportam mais kernels não-GKI](https://github.com/tiann/KernelSU/issues/1705). A última versão suportada é a `v0.9.5`, portanto, certifique-se de usar a versão correta.
|
||||
:::
|
||||
|
||||
Então, você deve verificar se o kprobe está ativado na configuração do seu kernel, se não estiver, adicione estas configurações a ele:
|
||||
Então, você deve verificar se o kprobe está ativado na configuração do seu kernel. Caso não esteja, adicione estas configurações a ele:
|
||||
|
||||
```txt
|
||||
CONFIG_KPROBES=y
|
||||
@ -33,25 +33,23 @@ CONFIG_HAVE_KPROBES=y
|
||||
CONFIG_KPROBE_EVENTS=y
|
||||
```
|
||||
|
||||
E agora, quando você recompilar seu kernel, o KernelSU deve funcionar bem.
|
||||
Agora, ao recompilar seu kernel, o KernelSU deve funcionar corretamente.
|
||||
|
||||
Se você descobrir que o KPROBES ainda não está ativado, você pode tentar ativar `CONFIG_MODULES`. Se ainda assim não surtir efeito, use `make menuconfig` para procurar outras dependências do KPROBES.
|
||||
Se você descobrir que o KPROBES ainda não está ativado, pode tentar ativar `CONFIG_MODULES`. Se isso não resolver, use `make menuconfig` para procurar outras dependências do KPROBES.
|
||||
|
||||
Mas se você entrar em um bootloop quando o KernelSU for integrado, pode ser porque o **kprobe esteja quebrado em seu kernel**, o que significa que você deve corrigir o bug do kprobe ou usar outra maneira.
|
||||
Porém, se você entrar em um bootloop após integrar o KernelSU, isso pode indicar que o **kprobe está quebrado no seu kernel**, o que significa que você precisará corrigir o bug do kprobe ou usar outra maneira.
|
||||
|
||||
::: tip COMO VERIFICAR SE O KPROBE ESTÁ QUEBRADO?
|
||||
|
||||
Comente `ksu_enable_sucompat()` e `ksu_enable_ksud()` em `KernelSU/kernel/ksu.c`, se o dispositivo inicializar normalmente, então o kprobe pode estar quebrado.
|
||||
:::
|
||||
|
||||
::: info COMO FAZER COM QUE O RECURSO DE DESMONTAR MÓDULOS FUNCIONE NO PRÉ-GKI?
|
||||
|
||||
Se o seu kernel for inferior a 5.9, você deve portar `path_umount` para `fs/namespace.c`. Isso é necessário para que o recurso de quantidade do módulo funcione. Se você não portar `path_umount`, o recurso "Desmontar módulos" não funcionará. Você pode obter mais informações sobre como conseguir isso no final desta página.
|
||||
Se o seu kernel for inferior a 5.9, você deve portar `path_umount` para `fs/namespace.c`. Isso é necessário para que o recurso "Desmontar módulos" funcione corretamente. Caso você não porte `path_umount`, o recurso "Desmontar módulos" não funcionará. Você pode obter mais informações sobre como conseguir isso no final desta página.
|
||||
:::
|
||||
|
||||
## Modifique manualmente a fonte do kernel
|
||||
|
||||
Se o kprobe não funcionar no seu kernel (pode ser um bug do upstream ou do kernel abaixo de 4.8), então você pode tentar o seguinte:
|
||||
Se o kprobe não funcionar no seu kernel (isso pode ser causado por um bug no upstream ou do kernel abaixo de 4.8), então você pode tentar o seguinte:
|
||||
|
||||
Primeiro, adicione o KernelSU à árvore de origem do kernel:
|
||||
|
||||
@ -59,14 +57,14 @@ Primeiro, adicione o KernelSU à árvore de origem do kernel:
|
||||
curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash -s v0.9.5
|
||||
```
|
||||
|
||||
Tenha em mente que em alguns dispositivos, seu defconfig pode estar em `arch/arm64/configs` ou em outros casos `arch/arm64/configs/vendor/your_defconfig`. Para qualquer defconfig que você estiver usando, certifique-se de ativar `CONFIG_KSU` com `y` para ativa-lo ou `n` para desativa-lo. Por exemplo, caso você opte por ativa-lo, seu defconfig deverá conter a seguinte string:
|
||||
Tenha em mente que, em alguns dispositivos, seu defconfig pode estar localizado em `arch/arm64/configs` ou em outros casos pode estar em `arch/arm64/configs/vendor/your_defconfig`. Independentemente do defconfig que você estiver usando, certifique-se de ativar `CONFIG_KSU` com `y` para ativa-lo ou `n` para desativa-lo. Por exemplo, se optar por ativá-lo, seu defconfig deverá conter a seguinte linha:
|
||||
|
||||
```txt
|
||||
# KernelSU
|
||||
CONFIG_KSU=y
|
||||
```
|
||||
|
||||
Em seguida, adicione chamadas do KernelSU à fonte do kernel. Aqui estão alguns patches para referência:
|
||||
Em seguida, adicione chamadas do KernelSU à fonte do kernel. Abaixo estão alguns patches para referência:
|
||||
|
||||
::: code-group
|
||||
|
||||
@ -258,7 +256,7 @@ index 2ff887661237..e758d7db7663 100644
|
||||
|
||||
### Modo de Segurança
|
||||
|
||||
Para ativar o Modo de Segurança integrado do KernelSU, você também deve modificar a função `input_handle_event` em `drivers/input/input.c`:
|
||||
Para ativar o Modo de Segurança integrado do KernelSU, você deve modificar a função `input_handle_event` em `drivers/input/input.c`:
|
||||
|
||||
::: tip DICA
|
||||
É altamente recomendável ativar este recurso, é muito útil para evitar bootloops!
|
||||
@ -292,7 +290,7 @@ index 45306f9ef247..815091ebfca4 100755
|
||||
```
|
||||
|
||||
::: info ENTRANDO NO MODO DE SEGURANÇA ACIDENTALMENTE?
|
||||
Se você estiver usando a integração manual e não desabilitar `CONFIG_KPROBES`, o usuário poderá acionar o Modo de Segurança pressionando o botão de diminuir volume após a inicialização! Portanto, se estiver usando a integração manual, você precisa desabilitar `CONFIG_KPROBES`!
|
||||
Se você estiver usando a integração manual e não desativar `CONFIG_KPROBES`, o usuário poderá acionar o Modo de Segurança pressionando o botão de diminuir volume após a inicialização! Portanto, se estiver usando a integração manual, é necessário desativar `CONFIG_KPROBES`!
|
||||
:::
|
||||
|
||||
### Falha ao executar `pm` no terminal?
|
||||
@ -376,4 +374,4 @@ Você pode fazer com que o recurso "Desmontar módulos" funcione em kernels pré
|
||||
* Isto é importante para filesystems que usam dispositivos bloqueados sem nome.
|
||||
```
|
||||
|
||||
Finalmente, construa seu kernel novamente, e então, o KernelSU deve funcionar bem.
|
||||
Finalmente, compile seu kernel novamente e o KernelSU deverá funcionar corretamente.
|
||||
|
@ -2,21 +2,21 @@
|
||||
|
||||
## Verifique se o seu dispositivo é compatível
|
||||
|
||||
Baixe o gerenciador do KernelSU em [GitHub Releases](https://github.com/tiann/KernelSU/releases), e instale-o no seu dispositivo:
|
||||
Baixe o gerenciador do KernelSU em [GitHub Releases](https://github.com/tiann/KernelSU/releases) e instale-o no seu dispositivo:
|
||||
|
||||
- Se o app mostrar `Sem suporte`, significa que **você deve compilar o kernel sozinho**. O KernelSU não fornecerá e nunca fornecerá um boot.img para você instalar.
|
||||
- Se o app mostrar `Sem suporte`, significa que **você precisará compilar o kernel por conta própria**. O KernelSU não fornecerá e nunca fornecerá um arquivo boot.img para você instalar.
|
||||
- Se o app mostrar `Não instalado`, então seu dispositivo é oficialmente suportado pelo KernelSU.
|
||||
|
||||
::: info INFORMAÇÕES
|
||||
Para dispositivos mostrando `Sem suporte`, aqui está os [Dispositivos com suporte não oficial](unofficially-support-devices.md). Você mesmo pode compilar o kernel.
|
||||
Para dispositivos que mostram `Sem suporte`, você pode conferir a lista de [Dispositivos com suporte não oficial](unofficially-support-devices.md). Você mesmo pode compilar o kernel.
|
||||
:::
|
||||
|
||||
## Backup padrão do boot.img
|
||||
|
||||
Antes de fazer o flash, você deve primeiro fazer backup de seu boot.img padrão. Se você encontrar algum bootloop, você sempre pode restaurar o sistema voltando para o boot padrão de fábrica usando o fastboot.
|
||||
Antes de fazer o flash, é essencial que você faça o backup do seu boot.img padrão. Se encontrar algum bootloop, você sempre pode restaurar o sistema voltando ao boot padrão de fábrica usando o fastboot.
|
||||
|
||||
::: warning AVISO
|
||||
Flashar pode causar perda de dados, certifique-se de executar esta etapa bem antes de prosseguir para a próxima! Você também pode fazer backup de todos os dados do seu dispositivo, se necessário.
|
||||
O flash pode causar perda de dados. Certifique-se de executar esta etapa bem antes de prosseguir para a próxima! Se necessário, também é recomendável fazer backup de todos os dados do seu dispositivo.
|
||||
:::
|
||||
|
||||
## Conhecimento necessário
|
||||
@ -45,9 +45,9 @@ Observe que o SubLevel na versão do kernel não faz parte do KMI! Isso signific
|
||||
|
||||
### Nível do patch de segurança {#security-patch-level}
|
||||
|
||||
Dispositivos Android mais recentes podem ter mecanismos anti-rollback que não permitem flashar um boot.img com um nível do patch de segurança antigo. Por exemplo, se o kernel do seu dispositivo for `5.10.101-android12-9-g30979850fc20`, o patch de segurança será `2023-11`, mesmo se você atualizar o kernel correspondente ao KMI do kernel, se o nível do patch de segurança for anterior a `2023-11` (como `2023-06`), então isso pode causar bootloop.
|
||||
Dispositivos Android mais recentes podem ter mecanismos anti-rollback que impedem o flash de um boot.img com um nível de patch de segurança antigo. Por exemplo, se o kernel do seu dispositivo for `5.10.101-android12-9-g30979850fc20`, o patch de segurança será `2023-11`, mesmo se você atualizar o kernel correspondente ao KMI do kernel, se o nível do patch de segurança for anterior a `2023-11` (como `2023-06`), isso pode causar um bootloop.
|
||||
|
||||
Portanto, os kernels com os níveis do patch de segurança mais recentes são preferidos para manter a correspondência com o KMI.
|
||||
Portanto, kernels com os níveis de patch de segurança mais recentes são preferidos para manter a compatibilidade com o KMI.
|
||||
|
||||
### Versão do kernel vs Versão do Android
|
||||
|
||||
@ -57,19 +57,19 @@ Se você descobrir que a versão do seu kernel é `android12-5.10.101`, mas a ve
|
||||
|
||||
## Introdução
|
||||
|
||||
Desde a versão [0.9.0](https://github.com/tiann/KernelSU/releases/tag/v0.9.0), KernelSU suporta dois modos de execução em dispositivos GKI:
|
||||
Desde a versão [0.9.0](https://github.com/tiann/KernelSU/releases/tag/v0.9.0), o KernelSU suporta dois modos de execução em dispositivos GKI:
|
||||
|
||||
1. `GKI`: Substitua o kernel original do dispositivo pelo **Generic Kernel Image** (GKI) fornecido pelo KernelSU.
|
||||
1. `GKI`: Substitue o kernel original do dispositivo pelo **Generic Kernel Image** (GKI) fornecido pelo KernelSU.
|
||||
2. `LKM`: Carregue o **Loadable Kernel Module** (LKM) no kernel do dispositivo sem substituir o kernel original.
|
||||
|
||||
Esses dois modos são adequados para diferentes cenários e você pode escolher de acordo com suas necessidades.
|
||||
Esses dois modos são adequados para diferentes cenários, e você pode escolher o mais adequado conforme suas necessidades.
|
||||
|
||||
### Modo GKI {#gki-mode}
|
||||
|
||||
No modo GKI, o kernel original do dispositivo será substituído pela imagem genérica do kernel fornecida pelo KernelSU. As vantagens do modo GKI são:
|
||||
|
||||
1. Forte universalidade, adequada para a maioria dos dispositivos. Por exemplo, a Samsung ativou dispositivos KNOX e o modo LKM não pode funcionar. Existem também alguns dispositivos modificados de nicho que só podem usar o modo GKI.
|
||||
2. Pode ser usado sem depender de firmware oficial e não há necessidade de esperar por atualizações oficiais de firmware, desde que o KMI seja consistente, ele pode ser usado.
|
||||
1. Forte universalidade, adequada para a maioria dos dispositivos. Por exemplo, a Samsung ativou dispositivos KNOX, e o modo LKM não pode funcionar. Existem também alguns dispositivos modificados de nicho que só podem usar o modo GKI.
|
||||
2. Pode ser usado sem depender de firmware oficial, e não há necessidade de esperar por atualizações oficiais de firmware, desde que o KMI seja consistente, ele pode ser usado.
|
||||
|
||||
### Modo LKM {#lkm-mode}
|
||||
|
||||
@ -77,8 +77,8 @@ No modo LKM, o kernel original do dispositivo não será substituído, mas o mó
|
||||
|
||||
1. Não substituirá o kernel original do dispositivo. Se você tiver os requisitos especiais para o kernel original do dispositivo ou quiser usar o KernelSU enquanto usa um kernel de terceiros, poderá usar o modo LKM.
|
||||
2. É mais conveniente atualizar o OTA. Ao atualizar o KernelSU, você pode instalá-lo diretamente no gerenciador sem flashar manualmente. Após o sistema OTA, você pode instalá-lo diretamente no segundo slot sem flashar manualmente.
|
||||
3. Adequado para alguns cenários especiais, por exemplo, o LKM também pode ser carregado com privilégios root temporários. Como não é necessário substituir a partição boot, ele não acionará o AVB e não causará o bloqueio do dispositivo.
|
||||
4. O LKM pode ser desinstalado temporariamente. Se você deseja desativar temporariamente o acesso root, você pode desinstalar o LKM, este processo não requer o flash de partições, nem mesmo a reinicialização do dispositivo. Se quiser ativar o root novamente, basta reiniciar o dispositivo.
|
||||
3. Adequado para alguns cenários especiais. Por exemplo, o LKM também pode ser carregado com privilégios root temporários. Como não é necessário substituir a partição boot, ele não acionará o AVB e não causará o bloqueio do dispositivo.
|
||||
4. O LKM pode ser desinstalado temporariamente. Se você deseja desativar temporariamente o acesso root, você pode desinstalar o LKM. Este processo não requer o flash de partições, nem mesmo a reinicialização do dispositivo. Se quiser ativar o root novamente, basta reiniciar o dispositivo.
|
||||
|
||||
::: tip COEXISTÊNCIA DE DOIS MODOS
|
||||
Após abrir o gerenciador, você pode ver o modo atual do dispositivo na página inicial. Observe que a prioridade do modo GKI é maior que a do LKM. Por exemplo, se você usar o kernel GKI para substituir o kernel original e usar LKM para corrigir o kernel GKI, o LKM será ignorado e o dispositivo sempre será executado no modo GKI.
|
||||
@ -94,19 +94,19 @@ Se o seu aparelho for um celular, recomendamos que você priorize o modo LKM. Se
|
||||
|
||||
Para usar o modo LKM, você precisa obter o firmware oficial e corrigi-lo com base no firmware oficial. Se você usar um kernel de terceiros, poderá usar o `boot.img` do kernel de terceiros como firmware oficial.
|
||||
|
||||
Existem muitas maneiras de obter o firmware oficial. Se o seu dispositivo suportar `fastboot boot`, então recomendamos **o método mais recomendado e o mais simples** que é usar `fastboot boot` para inicializar temporariamente o kernel GKI fornecido pelo KernelSU, depois instalar o gerenciador e, finalmente, instalá-lo diretamente no gerenciador. Este método não exige que você baixe manualmente o firmware oficial, nem extraia manualmente o boot.
|
||||
Existem muitas maneiras de obter o firmware oficial. Se o seu dispositivo suportar `fastboot boot`, então recomendamos **o método mais simples e indicado**, que consiste em usar `fastboot boot` para inicializar temporariamente o kernel GKI fornecido pelo KernelSU, depois instalar o gerenciador e, finalmente, instalá-lo diretamente pelo gerenciador. Este método não exige o download manual do firmware oficial nem a extração manual do boot.
|
||||
|
||||
Se o seu dispositivo não suportar `fastboot boot`, pode ser necessário baixar manualmente o pacote de firmware oficial e extrair o boot dele.
|
||||
|
||||
Ao contrário do modo GKI, o modo LKM modificará o `ramdisk`, portanto, em dispositivos com Android 13, ele precisa corrigir a partição `init_boot` em vez da partição `boot`, enquanto isso, o modo GKI sempre opera a partição `boot`.
|
||||
Ao contrário do modo GKI, o modo LKM modifica o `ramdisk`. Portanto, em dispositivos com Android 13, ele precisa corrigir a partição `init_boot` em vez da partição `boot`, enquanto o modo GKI sempre opera sobre a partição `boot`.
|
||||
|
||||
### Use o gerenciador
|
||||
|
||||
Abra o gerenciador, clique no ícone de instalação no canto superior direito e diversas opções aparecerão:
|
||||
|
||||
1. Selecione e corrija um arquivo. Se o seu dispositivo não tiver privilégios root, você pode escolher esta opção e, em seguida, selecionar seu firmware oficial, o gerenciador irá corrigi-lo automaticamente. Você só precisa flashar este arquivo corrigido para obter privilégios root permanentemente.
|
||||
2. Instale diretamente. Se o seu dispositivo já estiver rooteado, você pode escolher esta opção, o gerenciador obterá automaticamente as informações do seu dispositivo e, em seguida, corrigirá o firmware oficial e irá fazer o flash automaticamente. Você pode considerar usar `fastboot boot` e o kernel GKI do KernelSU para obter root temporário e instalar o gerenciador, e então usar esta opção. Esta também é a principal forma de atualizar o KernelSU.
|
||||
3. Instale em outra partição. Se o seu dispositivo suportar partição A/B, você pode escolher esta opção, o gerenciador irá corrigir automaticamente o firmware oficial e, em seguida, instalá-lo em outra partição. Este método é adequado para dispositivos após o OTA, você pode instalá-lo diretamente em outra partição após o OTA e, em seguida, reiniciar o dispositivo.
|
||||
1. Selecione um arquivo. Se o seu dispositivo não tiver privilégios root, você pode escolher esta opção e, em seguida, selecionar o seu firmware oficial. O gerenciador corrigirá automaticamente o firmware. Após isso, basta fazer o flash deste arquivo corrigido para obter privilégios root permanentemente.
|
||||
2. Instalação direta. Se o seu dispositivo já estiver rooteado, você pode escolher esta opção. O gerenciador obterá automaticamente as informações do seu dispositivo, corrigirá o firmware oficial e realizará o flash automaticamente. Você também pode usar o comando `fastboot boot` junto com o kernel GKI do KernelSU para obter root temporário e instalar o gerenciador, e então usar esta opção. Esta também é a principal forma de atualizar o KernelSU.
|
||||
3. Instalar no slot inativo. Se o seu dispositivo suportar partição A/B, você pode escolher esta opção. O gerenciador corrigirá automaticamente o firmware oficial e o instalará em outra partição. Esse método é adequado para dispositivos após o OTA, você pode instalá-lo diretamente em outra partição após o OTA e, em seguida, reiniciar o dispositivo.
|
||||
|
||||
### Use a linha de comando
|
||||
|
||||
@ -123,21 +123,21 @@ Patch boot ou imagens init_boot para aplicar o KernelSU
|
||||
Uso: ksud boot-patch [OPTIONS]
|
||||
|
||||
Opções:
|
||||
-b, --boot <BOOT> Caminho da imagem boot, se não for especificado, tentará encontrar a imagem boot automaticamente
|
||||
-k, --kernel <KERNEL> Caminho da imagem do kernel para substituir
|
||||
-m, --module <MODULE> O caminho do módulo LKM a ser substituído, se não for especificado, usará o integrado
|
||||
-b, --boot <BOOT> Caminho da imagem boot. Se não especificado, tentará encontrar a imagem boot automaticamente
|
||||
-k, --kernel <KERNEL> Caminho da imagem do kernel a ser substituída
|
||||
-m, --module <MODULE> Caminho do módulo LKM a ser substituído. Se não especificado, usará o módulo integrado
|
||||
-i, --init <INIT> init a ser substituído
|
||||
-u, --ota Usará outro slot quando a imagem boot não for especificada
|
||||
-u, --ota Usará outro slot se a imagem boot não for especificada
|
||||
-f, --flash Flash para a partição boot após o patch
|
||||
-o, --out <OUT> Caminho de saída, se não for especificado, usará o diretório atual
|
||||
--magiskboot <MAGISKBOOT> Caminho do magiskboot, se não for especificado, usará um integrado
|
||||
--kmi <KMI> A versão do KMI, se especificada, usará o KMI especificado
|
||||
-o, --out <OUT> Caminho de saída. Se não especificado, usará o diretório atual
|
||||
--magiskboot <MAGISKBOOT> Caminho do magiskboot. Se não especificado, usará a versão integrada
|
||||
--kmi <KMI> Versão do KMI. Se especificada, usará o KMI indicado
|
||||
-h, --help Imprimir ajuda
|
||||
```
|
||||
|
||||
Algumas opções que precisam ser explicadas:
|
||||
|
||||
1. A opção `--magiskboot` pode especificar o caminho do magiskboot. Se não for especificado, o ksud irá procurá-lo nas variáveis de ambiente. Se você não sabe como obter o magiskboot, você pode verificar [aqui](#patch-boot-image).
|
||||
1. A opção `--magiskboot` pode especificar o caminho do magiskboot. Se não for especificado, o ksud irá procurá-lo nas variáveis de ambiente. Se você não souber como obter o magiskboot, você pode verificar [aqui](#patch-boot-image).
|
||||
2. A opção `--kmi` pode especificar a versão do `KMI`. Se o nome do kernel do seu dispositivo não seguir a especificação KMI, você poderá especificá-lo através desta opção.
|
||||
|
||||
O uso mais comum é:
|
||||
@ -150,10 +150,10 @@ ksud boot-patch -b <boot.img> --kmi android13-5.10
|
||||
|
||||
Existem vários métodos de instalação para o modo GKI, cada um adequado para um cenário diferente, portanto escolha conforme necessário.
|
||||
|
||||
1. Instalar com fastboot usando o boot.img fornecido pelo KernelSU
|
||||
2. Instalar com um app kernel flash, como o Kernel Flasher
|
||||
3. Corrigir boot.img manualmente e instala-lo
|
||||
4. Instalar com Recovery personalizado (por exemplo, TWRP)
|
||||
1. Instalar com fastboot usando o boot.img fornecido pelo KernelSU.
|
||||
2. Instalar com um app kernel flash, como o [Kernel Flasher](https://github.com/capntrips/KernelFlasher/releases).
|
||||
3. Corrigir manualmente o boot.img e instalá-lo.
|
||||
4. Instalar com Recovery personalizado (por exemplo, TWRP).
|
||||
|
||||
## Instalar com o boot.img fornecido pelo KernelSU
|
||||
|
||||
@ -161,15 +161,15 @@ Se o `boot.img` do seu dispositivo usa um formato de compactação comumente usa
|
||||
|
||||
### Encontre o boot.img adequado
|
||||
|
||||
O KernelSU fornece um boot.img genérico para dispositivos GKI e você deve flashar o boot.img para a partição boot do dispositivo.
|
||||
O KernelSU fornece um boot.img genérico para dispositivos GKI, e você deve fazer o flash do boot.img na partição boot do dispositivo.
|
||||
|
||||
Você pode baixar o boot.img em [GitHub Release](https://github.com/tiann/KernelSU/releases), por favor, observe que você deve usar a versão correta do boot.img. Se você não sabe qual arquivo baixar, leia atentamente a descrição do [KMI](#kmi) e [Nível do patch de segurança](#security-patch-level) neste documento.
|
||||
Você pode baixar o boot.img em [GitHub Release](https://github.com/tiann/KernelSU/releases). Por favor, observe que você deve usar a versão correta do boot.img. Se você não sabe qual arquivo baixar, leia atentamente a descrição do [KMI](#kmi) e [Nível do patch de segurança](#security-patch-level) neste documento.
|
||||
|
||||
Normalmente, existem três arquivos de inicialização em formatos diferentes no mesmo KMI e nível do patch de segurança. Eles são todos iguais, exceto pelo formato de compactação do kernel. Por favor, verifique o formato de compactação do kernel de seu boot.img original. Você deve usar o formato correto, como `lz4` ou `gz`. Se você usar um formato de compactação incorreto, poderá encontrar bootloop após flashar o boot.img.
|
||||
Normalmente, existem três arquivos de inicialização em formatos diferentes para o mesmo KMI e nível de patch de segurança. Eles são idênticos, exceto pelo formato de compactação do kernel. Por favor, verifique o formato de compactação do kernel de seu boot.img original. Você deve usar o formato correto, como `lz4` ou `gz`. Se você usar um formato de compactação incorreto, poderá encontrar bootloop após o flash do boot.img.
|
||||
|
||||
::: info FORMATO DE COMPACTAÇÃO DO BOOT.IMG
|
||||
1. Você pode usar o magiskboot para obter o formato de compactação de seu boot original; alternativamente, você também pode solicitá-lo a membros/desenvolvedores da comunidade com o mesmo modelo do seu dispositivo. Além disso, o formato de compactação do kernel geralmente não muda, portanto, se você inicializar com êxito com um determinado formato de compactação, poderá tentar esse formato mais tarde.
|
||||
2. Os dispositivos Xiaomi geralmente usam `gz` ou `uncompressed`.
|
||||
1. Você pode usar o magiskboot para obter o formato de compactação do seu boot.img original. Alternativamente, você também pode perguntar a membros ou desenvolvedores da comunidade que possuam o mesmo modelo de dispositivo. Além disso, o formato de compactação do kernel geralmente não muda, portanto, se você inicializar com êxito com um determinado formato de compactação, poderá tentar esse formato mais tarde.
|
||||
2. Dispositivos Xiaomi geralmente usam `gz` ou `uncompressed`.
|
||||
3. Para dispositivos Pixel, siga as instruções abaixo:
|
||||
:::
|
||||
|
||||
@ -198,13 +198,15 @@ fastboot reboot
|
||||
Etapa:
|
||||
|
||||
1. Baixe o ZIP AnyKernel3. Se você não sabe qual arquivo baixar, leia atentamente a descrição do [KMI](#kmi) e [Nível do patch de segurança](#security-patch-level) neste documento.
|
||||
2. Abra o app Kernel Flasher (conceda as permissões de root necessárias) e use o ZIP AnyKernel3 fornecido para fazer o flash.
|
||||
2. Abra o app Kernel Flasher, conceda as permissões de root necessárias e use o ZIP AnyKernel3 fornecido para fazer o flash.
|
||||
|
||||
Dessa forma, é necessário que o app Kernel Flasher tenha privilégios root. Você pode usar os seguintes métodos para conseguir isso:
|
||||
|
||||
1. Seu dispositivo está rooteado. Por exemplo, você instalou o KernelSU e deseja atualizar para a versão mais recente ou fez o root por meio de outros métodos (como Magisk).
|
||||
2. Se o seu dispositivo não estiver rooteado, mas suportar o método de inicialização temporária como `fastboot boot boot.img`, você pode usar a imagem GKI fornecida pelo KernelSU para inicializar temporariamente o seu dispositivo, obter privilégios root temporário e, em seguida, usar o Kernel Flasher para obter privilégios root permanente.
|
||||
|
||||
Aqui estão alguns apps que podem ser usados para realizar o flash do kernel:
|
||||
|
||||
1. [Kernel Flasher](https://github.com/capntrips/KernelFlasher/releases)
|
||||
2. [Franco Kernel Manager](https://play.google.com/store/apps/details?id=com.franco.kernel)
|
||||
3. [Ex Kernel Manager](https://play.google.com/store/apps/details?id=flar2.exkernelmanager)
|
||||
@ -213,14 +215,14 @@ Observação: Este método é mais conveniente ao atualizar o KernelSU e pode se
|
||||
|
||||
## Corrigir boot.img manualmente {#patch-boot-image}
|
||||
|
||||
Para alguns dispositivos, o formato boot.img não é tão comum como `lz4`, `gz` e `uncompressed`. O mais típico é o Pixel, seu formato boot.img é `lz4_legacy` compactado, ramdisk pode ser `gz` e também pode ser compactado `lz4_legacy`. Atualmente, se você flashar diretamente o boot.img fornecido pelo KernelSU, o dispositivo pode não conseguir inicializar. Neste momento, você pode corrigir manualmente o boot.img para conseguir isso.
|
||||
Para alguns dispositivos, o formato boot.img não é tão comum como `lz4`, `gz` e `uncompressed`. Um exemplo típico é o Pixel, cujo boot.img é compactado no formato `lz4_legacy`, enquanto o ramdisk pode estar em `gz` ou também comprimido em `lz4_legacy`. Atualmente, se você flashar diretamente o boot.img fornecido pelo KernelSU, o dispositivo pode não conseguir inicializar. Nesse caso, é necessário corrigir manualmente o boot.img para conseguir isso.
|
||||
|
||||
É sempre recomendado usar `magiskboot` para corrigir imagens, existem duas maneiras:
|
||||
|
||||
1. [magiskboot](https://github.com/topjohnwu/Magisk/releases)
|
||||
2. [magiskboot_build](https://github.com/ookiineko/magiskboot_build/releases/tag/last-ci)
|
||||
|
||||
A versão oficial do `magiskboot` só pode rodar em dispositivos Android, se você quiser rodar no PC, você pode tentar a segunda opção.
|
||||
A versão oficial do `magiskboot` só pode ser executada em dispositivos Android, se você quiser rodar no PC, você pode tentar a segunda opção.
|
||||
|
||||
::: tip DICA
|
||||
Android-Image-Kitchen não é recomendado por enquanto, porque ele não lida corretamente com os metadados de inicialização (como o nível do patch de segurança). Portanto, pode não funcionar em alguns dispositivos.
|
||||
@ -238,8 +240,8 @@ Android-Image-Kitchen não é recomendado por enquanto, porque ele não lida cor
|
||||
2. Renomeie o `Magisk-*(versão).apk` para `Magisk-*.zip` e descompacte-o.
|
||||
3. Envie `Magisk-*/lib/arm64-v8a/libmagiskboot.so` para o seu dispositivo por ADB: `adb push Magisk-*/lib/arm64-v8a/libmagiskboot.so /data/local/tmp/magiskboot`.
|
||||
4. Envie o boot.img padrão e Image em AnyKernel3 para o seu dispositivo.
|
||||
5. Entre no ADB shell e no diretório cd `/data/local/tmp/`, em seguida, `chmod +x magiskboot`.
|
||||
6. Entre no ADB shell e no diretório cd `/data/local/tmp/`, execute `./magiskboot unpack boot.img` para descompactar `boot.img`, você obterá um arquivo `kernel`, este é o seu kernel padrão.
|
||||
5. Entre no ADB shell e execute o diretório `cd /data/local/tmp/`, em seguida, `chmod +x magiskboot`.
|
||||
6. Entre no ADB shell e execute o diretório `cd /data/local/tmp/`, execute `./magiskboot unpack boot.img` para descompactar `boot.img`, você obterá um arquivo `kernel`, este é o seu kernel padrão.
|
||||
7. Substitua `kernel` por `Image` executando o comando: `mv -f Image kernel`.
|
||||
8. Execute `./magiskboot repack boot.img` para reembalar o boot.img, e você obterá um arquivo `new-boot.img`, faça o flash deste arquivo para o dispositivo por fastboot.
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Módulo WebUI
|
||||
|
||||
Além de executar scripts de inicialização e modificar arquivos do sistema, os módulos do KernelSU também suportam a exibição de interfaces da UI e a interação com os usuários.
|
||||
Além de executar scripts de inicialização e modificar arquivos do sistema, os módulos do KernelSU também suportam a exibição de interfaces da UI e à interação direta com os usuários.
|
||||
|
||||
O módulo pode escrever páginas HTML + CSS + JavaScript através de qualquer tecnologia web. O gerenciador do KernelSU exibirá essas páginas através do WebView. Ele também fornece algumas APIs para interagir com o sistema, como executar comandos shell.
|
||||
|
||||
@ -24,9 +24,9 @@ Se sua página contém CSS e JavaScript, você também precisa colocá-la neste
|
||||
|
||||
## API JavaScript
|
||||
|
||||
Se for apenas uma página de exibição, não será diferente de uma página web normal. Mais importante ainda, KernelSU fornece uma série de APIs de sistema que permitem implementar as funções exclusivas do módulo.
|
||||
Se for apenas uma página de exibição, ela funcionará como uma página web comum. No entanto, o mais importante é que o KernelSU oferece uma série de APIs de sistema, permitindo a implementação de funções exclusivas do módulo.
|
||||
|
||||
KernelSU fornece uma biblioteca JavaScript e publica-a no [npm](https://www.npmjs.com/package/kernelsu), que você pode usar no código JavaScript de suas páginas da web.
|
||||
O KernelSU disponibiliza uma biblioteca JavaScript, que está publicada no [npm](https://www.npmjs.com/package/kernelsu) e pode ser usada no código JavaScript das suas páginas web.
|
||||
|
||||
Por exemplo, você pode executar um comando shell para obter uma configuração específica ou modificar uma propriedade:
|
||||
|
||||
@ -44,5 +44,5 @@ Se você achar que a API existente não atende às suas necessidades ou é incon
|
||||
|
||||
## Algumas dicas
|
||||
|
||||
1. Você pode usar `localStorage` normalmente para armazenar alguns dados, mas eles serão perdidos após a desinstalação do app gerenciador. Se precisar salvar persistentemente, você mesmo pode gravar os dados em algum diretório.
|
||||
2. Para páginas simples, recomendo que você use [parceljs](https://parceljs.org/) para o empacotamento. Não requer configuração do zero e é muito conveniente de usar. Porém, se você é um mestre do front-end ou tem suas próprias preferências, basta escolher o que você gosta!
|
||||
1. Você pode usar `localStorage` normalmente para armazenar alguns dados, mas tenha em mente que eles serão perdidos caso o app gerenciador seja desinstalado. Se precisar de armazenamento persistente, será necessário gravar os dados manualmente em algum diretório.
|
||||
2. Para páginas simples, recomendamos o uso do [parceljs](https://parceljs.org/) para empacotamento. Ele não exige configuração inicial e é extremamente prático de usar. No entanto, se você é um especialista em front-end ou possui suas próprias preferências, sinta-se à vontade para usar a ferramenta de sua escolha!
|
||||
|
@ -1,12 +1,12 @@
|
||||
# Guias de módulo
|
||||
|
||||
O KernelSU fornece um mecanismo de módulo que consegue modificar o diretório do sistema enquanto mantém a integridade da partição do sistema. Este mecanismo é conhecido como "sem sistema".
|
||||
O KernelSU fornece um mecanismo de módulo que consegue modificar o diretório do sistema enquanto mantém a integridade da partição do sistema. Esse mecanismo é conhecido como "sem sistema".
|
||||
|
||||
O mecanismo de módulos do KernelSU é quase o mesmo do Magisk. Se você está familiarizado com o desenvolvimento de módulos Magisk, o desenvolvimento de módulos KernelSU é muito semelhante. Você pode pular a introdução dos módulos abaixo e só precisa ler [Diferenças com Magisk](difference-with-magisk.md).
|
||||
O mecanismo de módulos do KernelSU é quase o mesmo do Magisk. Se você já está familiarizado com o desenvolvimento de módulos Magisk, o desenvolvimento de módulos KernelSU é muito semelhante. Você pode pular a introdução dos módulos abaixo e só precisa ler [Diferenças com Magisk](difference-with-magisk.md).
|
||||
|
||||
## WebUI
|
||||
|
||||
Os módulos do KernelSU suportam a exibição de interfaces e a interação com os usuários. Para mais, consulte a [documentação do WebUI](module-webui.md).
|
||||
Os módulos do KernelSU suportam a exibição de interfaces e a interação com os usuários. Para mais detalhes, consulte a [documentação do WebUI](module-webui.md).
|
||||
|
||||
## BusyBox
|
||||
|
||||
@ -22,7 +22,6 @@ Para aqueles que desejam usar o recurso Modo Autônomo fora do KernelSU, existem
|
||||
Para garantir que todos os shells `sh` subsequentes executados também sejam executados no Modo Autônomo, a opção 1 é o método preferido (e é isso que o KernelSU e o gerenciador do KernelSU usam internamente), pois as variáveis de ambiente são herdadas para os subprocesso.
|
||||
|
||||
::: tip DIFERENÇAS COM MAGISK
|
||||
|
||||
O BusyBox do KernelSU agora está usando o arquivo binário compilado diretamente do projeto Magisk. **Obrigado ao Magisk!** Portanto, você não precisa se preocupar com problemas de compatibilidade entre scripts BusyBox no Magisk e KernelSU porque eles são exatamente iguais!
|
||||
:::
|
||||
|
||||
@ -61,6 +60,7 @@ Um módulo KernelSU é uma pasta colocada em `/data/adb/modules` com a estrutura
|
||||
│ ├── service.sh <--- Este script será executado no serviço late_start
|
||||
│ ├── boot-completed.sh <--- Este script será executado na inicialização concluída
|
||||
| ├── uninstall.sh <--- Este script será executado quando o KernelSU remover seu módulo
|
||||
| ├── action.sh <--- Este script será executado quando o usuário clicar no botão Ação no KernelSU
|
||||
│ ├── system.prop <--- As propriedades neste arquivo serão carregadas como propriedades do sistema por resetprop
|
||||
│ ├── sepolicy.rule <--- Regras adicionais do sepolicy personalizadas
|
||||
│ │
|
||||
@ -150,7 +150,6 @@ REPLACE="
|
||||
Esta lista criará automaticamente os diretórios `$MODPATH/system/app/YouTube` e `$MODPATH/system/app/Bloatware` e, em seguida, executará `setfattr -n trusted.overlay.opaque -v y $MODPATH/system/app/YouTube` e `setfattr -n trusted.overlay.opaque -v y $MODPATH/system/app/Bloatware`. Após o módulo entrar em vigor, `/system/app/YouTube` e `/system/app/Bloatware` serão substituídos por diretórios vazios.
|
||||
|
||||
::: tip DIFERENÇAS COM MAGISK
|
||||
|
||||
O mecanismo sem sistema do KernelSU é implementado através do OverlayFS do kernel, enquanto o Magisk atualmente usa montagem mágica (montagem de ligação). Os dois métodos de implementação têm diferenças significativas, mas o objetivo final é o mesmo: modificar os arquivos /system sem modificar fisicamente a partição /system.
|
||||
:::
|
||||
|
||||
@ -239,11 +238,11 @@ set_perm_recursive <directory> <owner> <group> <dirpermission> <filepermission>
|
||||
No KernelSU, os scripts são divididos em dois tipos com base em seu modo de execução: modo post-fs-data e modo de serviço late_start.
|
||||
|
||||
- modo post-fs-data
|
||||
- Esta etapa está BLOQUEANDO. O processo de inicialização é pausado antes da execução ser concluída ou 10 segundos se passaram.
|
||||
- Esta etapa está BLOQUEANDO. O processo de inicialização é pausado antes da conclusão da execução ou após 10 segundos.
|
||||
- Os scripts são executados antes de qualquer módulo ser montado. Isso permite que um desenvolvedor de módulo ajuste dinamicamente seus módulos antes de serem montados.
|
||||
- Este estágio acontece antes do início do Zygote, o que significa praticamente tudo no Android.
|
||||
- **AVISO:** Usar `setprop` irá bloquear o processo de inicialização! Por favor, use `resetprop -n <prop_name> <prop_value>` em vez disso.
|
||||
- **Execute scripts neste modo apenas se necessário.**
|
||||
- **Execute scripts neste modo apenas se necessário**.
|
||||
- modo de serviço late_start
|
||||
- Esta etapa é SEM BLOQUEIO. Seu script é executado em paralelo com o restante do processo de inicialização.
|
||||
- **Este é o estágio recomendado para executar a maioria dos scripts**.
|
||||
@ -273,7 +272,8 @@ load kernel:
|
||||
- Modo GKI: kernel GKI com KernelSU integrado
|
||||
- Modo LKM: kernel stock
|
||||
...
|
||||
1. kernel exec init (logotipo oem na tela):
|
||||
|
||||
1. kernel exec init (logo OEM na tela):
|
||||
- Modo GKI: stock init
|
||||
- Modo LKM: exec ksuinit, insmod kernelsu.ko, exec stock init
|
||||
mount /dev, /dev/pts, /proc, /sys, etc.
|
||||
@ -284,7 +284,7 @@ early-init -> init -> late_init
|
||||
early-fs
|
||||
start vold
|
||||
fs
|
||||
montar /vendor, /system, /persist, etc.
|
||||
mount /vendor, /system, /persist, etc.
|
||||
post-fs-data
|
||||
*verificação do modo de segurança
|
||||
*executar scripts gerais em post-fs-data.d/
|
||||
@ -304,7 +304,8 @@ load_all_props_action
|
||||
start-service logd, console, vold, etc.
|
||||
class_start main
|
||||
start-service adb, netd (iptables), zygote, etc.
|
||||
2. kernel2user init (animação da rom na tela, inicie pelo serviço bootanim)
|
||||
|
||||
2. kernel2user init (animação da ROM na tela, inicie pelo serviço bootanim)
|
||||
*executar scripts gerais em service.d/
|
||||
*executar scripts de módulo service.sh
|
||||
*definir adereços para resetprop sem a opção -p
|
||||
@ -315,6 +316,7 @@ iniciar apps do sistema (início automático)
|
||||
inicialização completa (transmitir evento ACTION_BOOT_COMPLETED)
|
||||
*executar scripts gerais em boot-completed.d/
|
||||
*executar scripts de módulo boot-completed.sh
|
||||
|
||||
3. Operável pelo usuário (tela de bloqueio)
|
||||
insira a senha para descriptografar /data/data
|
||||
*conjunto real de adereços para resetprop com opção -p
|
||||
|
@ -1,20 +1,20 @@
|
||||
# Resgate do bootloop
|
||||
|
||||
Ao atualizar um dispositivo, podemos encontrar situações em que o dispositivo fica "bloqueado". Em teoria, se você usar o fastboot apenas para atualizar a partição boot ou instalar módulos inadequados que causam falha na inicialização do dispositivo, isso poderá ser restaurado por meio de operações apropriadas. Este documento tem como objetivo fornecer alguns métodos de emergência para ajudá-lo a se recuperar de um dispositivo "bloqueado".
|
||||
Ao atualizar um dispositivo, podem ocorrer situações em que o dispositivo fica "bloqueado". Em teoria, se você usar o fastboot apenas para atualizar a partição boot ou instalar módulos inadequados que causam falha na inicialização do dispositivo, isso pode ser restaurado por meio de operações apropriadas. Este documento tem como objetivo fornecer alguns métodos de emergência para ajudá-lo a recuperar um dispositivo "bloqueado".
|
||||
|
||||
## Bloqueio por flashar partição boot
|
||||
|
||||
No KernelSU, as seguintes situações podem causar bloqueio de inicialização ao flashar a partição boot:
|
||||
|
||||
1. Você flashou uma imagem boot no formato errado. Por exemplo, se o formato de boot do seu dispositivo for `gz`, mas você flashou uma imagem no formato `lz4`, o dispositivo não será capaz de inicializar.
|
||||
2. Seu dispositivo precisa desativar a verificação AVB para inicializar corretamente (geralmente exigindo a limpeza de todos os dados do dispositivo).
|
||||
1. Você flashou uma imagem boot no formato errado. Por exemplo, se o formato de boot do seu dispositivo for `gz`, mas você flashou uma imagem no formato `lz4`, o dispositivo não inicializá.
|
||||
2. Seu dispositivo precisa desativar a verificação AVB para inicializar corretamente, o que geralmente exige a limpeza de todos os dados do dispositivo.
|
||||
3. Seu kernel tem alguns bugs ou não é adequado para o flash do seu dispositivo.
|
||||
|
||||
Não importa qual seja a situação, você pode recuperar **flashando a imagem de boot padrão**. Portanto, no início do tutorial de instalação, recomendamos fortemente que você faça backup de seu boot padrão antes de fazer o flash. Se você não fez backup, poderá obter o boot original de fábrica de outros usuários com o mesmo dispositivo que você ou do firmware oficial.
|
||||
Não importa qual seja a situação, você pode recuperar **flashando a imagem de boot padrão**. Portanto, no início do guia de instalação, recomendamos fortemente que você faça backup de seu boot padrão antes de realizar o flash. Se você não fez backup, poderá obter o boot original de fábrica de outros usuários com o mesmo dispositivo ou do firmware oficial.
|
||||
|
||||
## Bloqueio por módulos
|
||||
|
||||
A instalação de módulos pode ser uma causa mais comum de bloqueio do seu dispositivo, mas devemos avisá-lo seriamente: **NÃO INSTALE MÓDULOS DE FONTES DESCONHECIDAS!** Como os módulos têm privilégios root, eles podem causar danos irreversíveis ao seu dispositivo!
|
||||
A instalação de módulos pode ser uma das causas mais comuns de bloqueio do seu dispositivo, mas devemos alertá-lo seriamente: **NÃO INSTALE MÓDULOS DE FONTES DESCONHECIDAS!** Como os módulos têm privilégios root, eles podem causar danos irreversíveis ao seu dispositivo!
|
||||
|
||||
### Módulos normais
|
||||
|
||||
@ -25,26 +25,26 @@ Se você instalou um módulo que foi comprovadamente seguro, mas faz com que seu
|
||||
|
||||
#### Atualização AB
|
||||
|
||||
As atualizações do módulo KernelSU inspiram-se no mecanismo de atualização AB do sistema Android usado em atualizações OTA. Se você instalar um novo módulo ou atualizar um existente, isso não modificará diretamente o arquivo do módulo usado atualmente. Em vez disso, todos os módulos serão integrados em outra imagem de atualização. Depois que o sistema for reiniciado, ele tentará começar a usar esta imagem de atualização. Se o sistema Android inicializar com sucesso, os módulos serão realmente atualizados.
|
||||
As atualizações do módulo KernelSU são baseadas no mecanismo de atualização AB do sistema Android usado em atualizações OTA. Quando você instala um novo módulo ou atualiza um existente, isso não modifica diretamente o arquivo do módulo atualmente em uso. Em vez disso, todos os módulos são integrados em uma nova imagem de atualização. Após o sistema ser reiniciado, ele tentará iniciar usando essa nova imagem de atualização. Se o sistema Android inicializar com sucesso, os módulos serão efetivamente atualizados.
|
||||
|
||||
Portanto, o método mais simples e comumente usado para recuperar seu dispositivo é **forçar uma reinicialização**. Se você não conseguir iniciar o sistema após instalar um módulo, você pode pressionar e segurar o botão liga/desliga por mais de 10 segundos e o sistema será reinicializado automaticamente. Após a reinicialização, ele retornará ao estado anterior à atualização do módulo e os módulos atualizados anteriormente serão desativados automaticamente.
|
||||
Portanto, o método mais simples e comumente usado para recuperar seu dispositivo é **forçar uma reinicialização**. Se você não conseguir iniciar o sistema após instalar um módulo, pode pressionar e segurar o botão liga/desliga por mais de 10 segundos, e o sistema será reiniciado automaticamente. Após a reinicialização, ele retornará ao estado anterior à atualização do módulo, e os módulos atualizados serão desativados automaticamente.
|
||||
|
||||
#### Recupere pressionando o botão de diminuir volume
|
||||
|
||||
Se a Atualização AB ainda não resolveu o problema, você pode tentar usar o **Modo de Segurança**. No Modo de Segurança, todos os módulos estão desativados.
|
||||
Se a Atualização AB ainda não resolveu o problema, você pode tentar usar o **Modo de Segurança**. Nesse modo, todos os módulos são desativados.
|
||||
|
||||
Existem duas maneiras de entrar no Modo de Segurança:
|
||||
|
||||
1. O Modo de Segurança integrado de alguns sistemas. Alguns sistemas possuem um Modo de Segurança integrado que pode ser acessado pressionando longamente o botão de diminuir volume, enquanto outros (como a MIUI) podem ativar o Modo de Segurança no Recovery. Ao entrar no Modo de Segurança do sistema, o KernelSU também entrará no Modo de Segurança e desativará automaticamente os módulos.
|
||||
2. O Modo de Segurança integrado do KernelSU. O método de operação é **pressionar a tecla de diminuir volume continuamente por mais de três vezes** após a primeira tela de inicialização.
|
||||
1. O Modo de Segurança integrado de alguns sistemas: Alguns sistemas possuem um Modo de Segurança integrado que pode ser acessado pressionando longamente o botão de diminuir volume. Em outros sistemas (como o HyperOS), o Modo de Segurança pode ser ativado a partir do Recovery. Ao entrar no Modo de Segurança do sistema, o KernelSU também entrará nesse modo e desativará automaticamente os módulos.
|
||||
2. O Modo de Segurança integrado do KernelSU: Nesse caso, o método é **pressionar a tecla de diminuir volume continuamente por mais de três vezes** após a primeira tela de inicialização.
|
||||
|
||||
Após entrar no Modo de Segurança, todos os módulos na página de módulos do gerenciador do KernelSU são desativados, mas você pode executar as operações de "desinstalação" para desinstalar quaisquer módulos que possam estar causando problemas.
|
||||
Após entrar no Modo de Segurança, todos os módulos na página Módulos do gerenciador do KernelSU serão desativados. Porém, você ainda pode realizar a operação de "desinstalação" para desinstalar quaisquer módulos que possam estar causando problemas.
|
||||
|
||||
O Modo de Segurança integrado é implementado no kernel, portanto não há possibilidade de perder eventos importantes devido à interceptação. No entanto, para kernels não GKI, a integração manual do código pode ser necessária e você pode consultar a documentação oficial para obter orientação.
|
||||
O Modo de Segurança integrado é implementado no kernel, portanto não há possibilidade de perder eventos importantes devido à interceptação. No entanto, para kernels não-GKI, pode ser necessária uma integração manual do código. Para isso, consulte a documentação oficial para orientações.
|
||||
|
||||
### Módulos maliciosos
|
||||
|
||||
Se os métodos acima não conseguirem recuperar seu dispositivo, é muito provável que o módulo que você instalou tenha operações maliciosas ou tenha danificado seu dispositivo por outros meios. Neste caso, existem apenas duas sugestões:
|
||||
Se os métodos acima não conseguirem recuperar seu dispositivo, é muito provável que o módulo que você instalou tenha operações maliciosas ou tenha danificado seu dispositivo de outra forma. Nesse caso, há apenas duas sugestões:
|
||||
|
||||
1. Limpar os dados e instalar o sistema oficial.
|
||||
2. Consultar o serviço pós-venda.
|
||||
|
@ -1,11 +1,11 @@
|
||||
# Dispositivos com suporte não oficial
|
||||
|
||||
::: warning AVISO
|
||||
Nesta página, existem kernels para dispositivos não GKI que suportam o KernelSU mantidos por outros desenvolvedores.
|
||||
Nesta página, existem kernels para dispositivos não-GKI que suportam o KernelSU mantidos por outros desenvolvedores.
|
||||
:::
|
||||
|
||||
::: warning AVISO
|
||||
Esta página é apenas para você encontrar o código-fonte correspondente ao seu dispositivo, **NÃO** significa que o código-fonte foi revisado pelos desenvolvedores do KernelSU. Você deve usá-lo por sua própria conta e risco.
|
||||
Esta página é destinada apenas para ajudá-lo a encontrar o código-fonte correspondente ao seu dispositivo. **NÃO** significa que o código-fonte foi revisado pelos desenvolvedores do KernelSU. Você deve usá-lo por sua própria conta e risco.
|
||||
:::
|
||||
|
||||
<script setup>
|
||||
|
@ -4,7 +4,7 @@ O KernelSU é uma solução root para dispositivos Android GKI, funciona no modo
|
||||
|
||||
## Características
|
||||
|
||||
A principal característica do KernelSU é que ele é **baseado em kernel**. O KernelSU funciona no modo kernel, portanto pode fornecer uma interface de kernel que nunca tivemos antes. Por exemplo, podemos adicionar um ponto de interrupção de hardware a qualquer processo no modo kernel, podemos acessar a memória física de qualquer processo sem que ninguém perceba, podemos interceptar qualquer syscall no espaço do kernel, etc.
|
||||
A principal característica do KernelSU é que ele é baseado em kernel. O KernelSU funciona no modo kernel, portanto pode fornecer uma interface de kernel que nunca tivemos antes. Por exemplo, é possível adicionar pontos de interrupção de hardware a qualquer processo no modo kernel, acessar a memória física de qualquer processo de forma invisível, interceptar qualquer chamada de sistema (syscall) no espaço do kernel, entre outras funcionalidades.
|
||||
|
||||
E também, o KernelSU fornece um sistema de módulos via OverlayFS, que permite carregar seu plugin personalizado no sistema. Ele também fornece um mecanismo para modificar arquivos na partição `/system`.
|
||||
|
||||
@ -14,7 +14,7 @@ Por favor, consulte: [Instalação](installation)
|
||||
|
||||
## Como compilar o KernelSU?
|
||||
|
||||
Por favor, consulte: [Como compilar?](how-to-build)
|
||||
Por favor, consulte: [Como compilar](how-to-build)
|
||||
|
||||
## Discussão
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
layout: home
|
||||
title: Uma solução root baseada em kernel para Android
|
||||
title: Início
|
||||
|
||||
hero:
|
||||
name: KernelSU
|
||||
@ -25,4 +25,4 @@ features:
|
||||
- title: Privilégios root personalizáveis
|
||||
details: KernelSU permite a personalização de su, uid, gid, grupos, capacidades e regras do SELinux, bloqueando privilégios root.
|
||||
- title: Módulos
|
||||
details: Os módulos podem modificar /system sem sistema usando OverlayFS permitindo uma grande potência.
|
||||
details: Os módulos podem modificar /system sem sistema usando OverlayFS proporcionando flexibilidade significativa.
|
||||
|
Loading…
x
Reference in New Issue
Block a user