├── .gitattributes
├── .github
├── FUNDING.yml
├── ISSUE_TEMPLATE
│ ├── add_device.yml
│ ├── bug_report.yml
│ ├── config.yml
│ └── custom.yml
├── manifests
│ ├── android-14-avd_x86_64.xml
│ ├── android-15-avd_aarch64.xml
│ └── android-15-avd_x86_64.xml
├── scripts
│ ├── build_a12.sh
│ └── build_a13.sh
└── workflows
│ ├── add-device.yml
│ ├── avd-kernel.yml
│ ├── build-debug-kernel.yml
│ ├── build-kernel-a12.yml
│ ├── build-kernel-a13.yml
│ ├── build-kernel-a14.yml
│ ├── build-kernel-a15.yml
│ ├── build-kernel-arcvm.yml
│ ├── build-kernel-avd.yml
│ ├── build-kernel-wsa.yml
│ ├── build-lkm.yml
│ ├── build-manager.yml
│ ├── build-su.yml
│ ├── clippy.yml
│ ├── deploy-website.yml
│ ├── gki-kernel.yml
│ ├── ksud.yml
│ ├── release.yml
│ ├── rustfmt.yml
│ ├── shellcheck.yml
│ └── wsa-kernel.yml
├── .gitignore
├── LICENSE
├── SECURITY.md
├── docs
├── README.md
├── README_CN.md
├── README_ES.md
├── README_ID.md
├── README_IN.md
├── README_IT.md
├── README_IW.md
├── README_JP.md
├── README_KR.md
├── README_PL.md
├── README_PT-BR.md
├── README_RU.md
├── README_TR.md
├── README_TW.md
└── README_VI.md
├── js
├── README.md
├── index.d.ts
├── index.js
└── package.json
├── justfile
├── kernel
├── .clang-format
├── .clangd
├── Kconfig
├── LICENSE
├── Makefile
├── allowlist.c
├── allowlist.h
├── apk_sign.c
├── apk_sign.h
├── arch.h
├── core_hook.c
├── core_hook.h
├── embed_ksud.c
├── export_symbol.txt
├── include
│ └── ksu_hook.h
├── kernel_compat.c
├── kernel_compat.h
├── klog.h
├── ksu.c
├── ksu.h
├── ksud.c
├── ksud.h
├── manager.h
├── selinux
│ ├── Makefile
│ ├── rules.c
│ ├── selinux.c
│ ├── selinux.h
│ ├── sepolicy.c
│ └── sepolicy.h
├── setup.sh
├── sucompat.c
├── throne_tracker.c
└── throne_tracker.h
├── manager
├── .gitignore
├── app
│ ├── .gitignore
│ ├── build.gradle.kts
│ ├── proguard-rules.pro
│ └── src
│ │ └── main
│ │ ├── AndroidManifest.xml
│ │ ├── aidl
│ │ └── me
│ │ │ └── weishu
│ │ │ └── kernelsu
│ │ │ └── IKsuInterface.aidl
│ │ ├── cpp
│ │ ├── CMakeLists.txt
│ │ ├── jni.cc
│ │ ├── ksu.cc
│ │ └── ksu.h
│ │ ├── java
│ │ └── me
│ │ │ └── weishu
│ │ │ └── kernelsu
│ │ │ ├── KernelSUApplication.kt
│ │ │ ├── Kernels.kt
│ │ │ ├── Natives.kt
│ │ │ ├── profile
│ │ │ ├── Capabilities.kt
│ │ │ └── Groups.kt
│ │ │ └── ui
│ │ │ ├── KsuService.java
│ │ │ ├── MainActivity.kt
│ │ │ ├── component
│ │ │ ├── AboutCard.kt
│ │ │ ├── Dialog.kt
│ │ │ ├── KeyEventBlocker.kt
│ │ │ ├── SearchBar.kt
│ │ │ ├── SettingsItem.kt
│ │ │ └── profile
│ │ │ │ ├── AppProfileConfig.kt
│ │ │ │ ├── RootProfileConfig.kt
│ │ │ │ └── TemplateConfig.kt
│ │ │ ├── screen
│ │ │ ├── AppProfile.kt
│ │ │ ├── BottomBarDestination.kt
│ │ │ ├── ExecuteModuleAction.kt
│ │ │ ├── Flash.kt
│ │ │ ├── Home.kt
│ │ │ ├── Install.kt
│ │ │ ├── Module.kt
│ │ │ ├── Settings.kt
│ │ │ ├── SuperUser.kt
│ │ │ ├── Template.kt
│ │ │ └── TemplateEditor.kt
│ │ │ ├── theme
│ │ │ ├── Color.kt
│ │ │ ├── Theme.kt
│ │ │ └── Type.kt
│ │ │ ├── util
│ │ │ ├── CompositionProvider.kt
│ │ │ ├── Downloader.kt
│ │ │ ├── HanziToPinyin.java
│ │ │ ├── HyperlinkText.kt
│ │ │ ├── KsuCli.kt
│ │ │ ├── LogEvent.kt
│ │ │ ├── SELinuxChecker.kt
│ │ │ └── module
│ │ │ │ └── LatestVersionInfo.kt
│ │ │ ├── viewmodel
│ │ │ ├── ModuleViewModel.kt
│ │ │ ├── SuperUserViewModel.kt
│ │ │ └── TemplateViewModel.kt
│ │ │ └── webui
│ │ │ ├── MimeUtil.java
│ │ │ ├── SuFilePathHandler.java
│ │ │ ├── WebUIActivity.kt
│ │ │ └── WebViewInterface.kt
│ │ ├── jniLibs
│ │ ├── .gitignore
│ │ └── arm64-v8a
│ │ │ └── libmagiskboot.so
│ │ └── res
│ │ ├── drawable
│ │ ├── ic_launcher_foreground.xml
│ │ └── ic_launcher_monochrome.xml
│ │ ├── mipmap-anydpi
│ │ └── ic_launcher.xml
│ │ ├── mipmap-hdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-ldpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-mdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xhdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xxhdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xxxhdpi
│ │ └── ic_launcher.png
│ │ ├── resources.properties
│ │ ├── values-ar
│ │ └── strings.xml
│ │ ├── values-az
│ │ └── strings.xml
│ │ ├── values-bn-rBD
│ │ └── strings.xml
│ │ ├── values-bn
│ │ └── strings.xml
│ │ ├── values-bs
│ │ └── strings.xml
│ │ ├── values-da
│ │ └── strings.xml
│ │ ├── values-de
│ │ └── strings.xml
│ │ ├── values-es
│ │ └── strings.xml
│ │ ├── values-et
│ │ └── strings.xml
│ │ ├── values-fa
│ │ └── strings.xml
│ │ ├── values-fil
│ │ └── strings.xml
│ │ ├── values-fr
│ │ └── strings.xml
│ │ ├── values-gl
│ │ └── strings.xml
│ │ ├── values-hi
│ │ └── strings.xml
│ │ ├── values-hr
│ │ └── strings.xml
│ │ ├── values-hu
│ │ └── strings.xml
│ │ ├── values-in
│ │ └── strings.xml
│ │ ├── values-it
│ │ └── strings.xml
│ │ ├── values-iw
│ │ └── strings.xml
│ │ ├── values-ja
│ │ └── strings.xml
│ │ ├── values-kn
│ │ └── strings.xml
│ │ ├── values-ko
│ │ └── strings.xml
│ │ ├── values-lt
│ │ └── strings.xml
│ │ ├── values-lv
│ │ └── strings.xml
│ │ ├── values-mr
│ │ └── strings.xml
│ │ ├── values-ms
│ │ └── strings.xml
│ │ ├── values-night
│ │ └── themes.xml
│ │ ├── values-nl
│ │ └── strings.xml
│ │ ├── values-pl
│ │ └── strings.xml
│ │ ├── values-pt-rBR
│ │ └── strings.xml
│ │ ├── values-pt
│ │ └── strings.xml
│ │ ├── values-ro
│ │ └── strings.xml
│ │ ├── values-ru
│ │ └── strings.xml
│ │ ├── values-sl
│ │ └── strings.xml
│ │ ├── values-sr
│ │ └── strings.xml
│ │ ├── values-te
│ │ └── strings.xml
│ │ ├── values-th
│ │ └── strings.xml
│ │ ├── values-tr
│ │ └── strings.xml
│ │ ├── values-uk
│ │ └── strings.xml
│ │ ├── values-vi
│ │ └── strings.xml
│ │ ├── values-zh-rCN
│ │ └── strings.xml
│ │ ├── values-zh-rHK
│ │ └── strings.xml
│ │ ├── values-zh-rTW
│ │ └── strings.xml
│ │ ├── values
│ │ ├── colors.xml
│ │ ├── strings.xml
│ │ └── themes.xml
│ │ └── xml
│ │ ├── backup_rules.xml
│ │ ├── data_extraction_rules.xml
│ │ ├── filepaths.xml
│ │ └── network_security_config.xml
├── build.gradle.kts
├── gradle.properties
├── gradle
│ ├── libs.versions.toml
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── settings.gradle.kts
└── sign.example.properties
├── scripts
├── abi_gki_all.py
├── add_device_handler.py
├── allowlist.bt
├── bin2c.py
└── ksubot.py
├── userspace
├── ksud
│ ├── .gitignore
│ ├── Cargo.lock
│ ├── Cargo.toml
│ ├── bin
│ │ ├── .gitignore
│ │ ├── aarch64
│ │ │ ├── bootctl
│ │ │ ├── busybox
│ │ │ ├── ksuinit
│ │ │ └── resetprop
│ │ └── x86_64
│ │ │ ├── busybox
│ │ │ ├── ksuinit
│ │ │ └── resetprop
│ ├── build.rs
│ └── src
│ │ ├── apk_sign.rs
│ │ ├── assets.rs
│ │ ├── banner
│ │ ├── boot_patch.rs
│ │ ├── cli.rs
│ │ ├── debug.rs
│ │ ├── defs.rs
│ │ ├── init_event.rs
│ │ ├── installer.sh
│ │ ├── ksucalls.rs
│ │ ├── main.rs
│ │ ├── module.rs
│ │ ├── mount.rs
│ │ ├── profile.rs
│ │ ├── restorecon.rs
│ │ ├── sepolicy.rs
│ │ ├── su.rs
│ │ └── utils.rs
└── su
│ ├── .gitignore
│ └── jni
│ ├── Android.mk
│ ├── Application.mk
│ └── su.c
└── website
├── .gitignore
├── docs
├── .vitepress
│ ├── config.ts
│ └── locales
│ │ ├── en.ts
│ │ ├── id_ID.ts
│ │ ├── index.ts
│ │ ├── ja_JP.ts
│ │ ├── pt_BR.ts
│ │ ├── ru_RU.ts
│ │ ├── vi_VN.ts
│ │ ├── zh_CN.ts
│ │ └── zh_TW.ts
├── guide
│ ├── app-profile.md
│ ├── difference-with-magisk.md
│ ├── faq.md
│ ├── hidden-features.md
│ ├── how-to-build.md
│ ├── how-to-integrate-for-non-gki.md
│ ├── installation.md
│ ├── module-webui.md
│ ├── module.md
│ ├── rescue-from-bootloop.md
│ ├── unofficially-support-devices.md
│ └── what-is-kernelsu.md
├── id_ID
│ ├── guide
│ │ ├── difference-with-magisk.md
│ │ ├── faq.md
│ │ ├── how-to-build.md
│ │ ├── how-to-integrate-for-non-gki.md
│ │ ├── installation.md
│ │ ├── module.md
│ │ ├── rescue-from-bootloop.md
│ │ ├── unofficially-support-devices.md
│ │ └── what-is-kernelsu.md
│ └── index.md
├── index.md
├── ja_JP
│ ├── guide
│ │ ├── difference-with-magisk.md
│ │ ├── faq.md
│ │ ├── hidden-features.md
│ │ ├── how-to-build.md
│ │ ├── how-to-integrate-for-non-gki.md
│ │ ├── installation.md
│ │ ├── module-webui.md
│ │ ├── module.md
│ │ ├── rescue-from-bootloop.md
│ │ ├── unofficially-support-devices.md
│ │ └── what-is-kernelsu.md
│ └── index.md
├── pt_BR
│ ├── guide
│ │ ├── app-profile.md
│ │ ├── difference-with-magisk.md
│ │ ├── faq.md
│ │ ├── hidden-features.md
│ │ ├── how-to-build.md
│ │ ├── how-to-integrate-for-non-gki.md
│ │ ├── installation.md
│ │ ├── module-webui.md
│ │ ├── module.md
│ │ ├── rescue-from-bootloop.md
│ │ ├── unofficially-support-devices.md
│ │ └── what-is-kernelsu.md
│ └── index.md
├── public
│ ├── ads.txt
│ ├── favicon.ico
│ ├── logo.png
│ └── templates
│ │ ├── .gitkeep
│ │ ├── adaway.root
│ │ ├── adb
│ │ ├── cemiuiler.readproc
│ │ ├── incompetent.root
│ │ ├── kernelmanager.root
│ │ ├── nethunter.root
│ │ ├── rootexploler.root
│ │ ├── shizuku.root
│ │ ├── system
│ │ └── wireguard.root
├── repos.json
├── ru_RU
│ ├── guide
│ │ ├── app-profile.md
│ │ ├── difference-with-magisk.md
│ │ ├── faq.md
│ │ ├── hidden-features.md
│ │ ├── how-to-build.md
│ │ ├── how-to-integrate-for-non-gki.md
│ │ ├── installation.md
│ │ ├── module.md
│ │ ├── rescue-from-bootloop.md
│ │ ├── unofficially-support-devices.md
│ │ └── what-is-kernelsu.md
│ └── index.md
├── vi_VN
│ ├── guide
│ │ ├── app-profile.md
│ │ ├── difference-with-magisk.md
│ │ ├── faq.md
│ │ ├── hidden-features.md
│ │ ├── how-to-build.md
│ │ ├── how-to-integrate-for-non-gki.md
│ │ ├── installation.md
│ │ ├── module.md
│ │ ├── rescue-from-bootloop.md
│ │ ├── unofficially-support-devices.md
│ │ └── what-is-kernelsu.md
│ └── index.md
├── zh_CN
│ ├── guide
│ │ ├── app-profile.md
│ │ ├── difference-with-magisk.md
│ │ ├── faq.md
│ │ ├── hidden-features.md
│ │ ├── how-to-build.md
│ │ ├── how-to-integrate-for-non-gki.md
│ │ ├── installation.md
│ │ ├── module-webui.md
│ │ ├── module.md
│ │ ├── rescue-from-bootloop.md
│ │ ├── unofficially-support-devices.md
│ │ └── what-is-kernelsu.md
│ └── index.md
└── zh_TW
│ ├── guide
│ ├── app-profile.md
│ ├── difference-with-magisk.md
│ ├── faq.md
│ ├── hidden-features.md
│ ├── how-to-build.md
│ ├── how-to-integrate-for-non-gki.md
│ ├── installation.md
│ ├── module-webui.md
│ ├── module.md
│ ├── rescue-from-bootloop.md
│ ├── unofficially-support-devices.md
│ └── what-is-kernelsu.md
│ └── index.md
├── package.json
└── yarn.lock
/.gitattributes:
--------------------------------------------------------------------------------
1 | *.bat eol=crlf
--------------------------------------------------------------------------------
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | # These are supported funding model platforms
2 |
3 | github: tiann
4 | patreon: weishu
5 | custom: https://vxposed.com/donate.html
6 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/add_device.yml:
--------------------------------------------------------------------------------
1 | name: Contribute to Unofficially Supported Device
2 | description: Add your device kernel source to KernelSU's Unofficially Supported Device List
3 | title: "[Add Device]: "
4 | labels: ["add-device"]
5 | body:
6 | - type: markdown
7 | attributes:
8 | value: |
9 | Thanks for supporting KernelSU!
10 | - type: input
11 | id: repo-url
12 | attributes:
13 | label: Repository URL
14 | description: Your repository URL
15 | placeholder: https://github.com/tiann/KernelSU
16 | validations:
17 | required: true
18 | - type: input
19 | id: device
20 | attributes:
21 | label: Device
22 | description: Please describe the device maintained by you.
23 | placeholder: GKI 2.0 Device
24 | validations:
25 | required: true
26 | - type: checkboxes
27 | id: terms
28 | attributes:
29 | label: Code of Conduct
30 | description: By submitting this issue, you should be the maintainer of the repository.
31 | options:
32 | - label: I'm the maintainer of this repository
33 | required: true
34 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug_report.yml:
--------------------------------------------------------------------------------
1 | name: Bug report
2 | description: Create a report to help us improve KernelSU
3 | labels: [Bug]
4 |
5 | body:
6 | - type: checkboxes
7 | attributes:
8 | label: Please check before submitting an issue
9 | options:
10 | - label: I have searched the issues and haven't found anything relevant
11 | required: true
12 |
13 | - label: I will upload bugreport file in KernelSU Manager - Settings - Report log
14 | required: true
15 |
16 | - label: I know how to reproduce the issue which may not be specific to my device
17 | required: false
18 |
19 |
20 | - type: textarea
21 | attributes:
22 | label: Describe the bug
23 | description: A clear and concise description of what the bug is
24 | validations:
25 | required: true
26 |
27 |
28 | - type: textarea
29 | attributes:
30 | label: To Reproduce
31 | description: Steps to reproduce the behaviour
32 | placeholder: |
33 | - 1. Go to '...'
34 | - 2. Click on '....'
35 | - 3. Scroll down to '....'
36 | - 4. See error
37 |
38 |
39 | - type: textarea
40 | attributes:
41 | label: Expected behavior
42 | description: A clear and concise description of what you expected to happen.
43 |
44 |
45 | - type: textarea
46 | attributes:
47 | label: Screenshots
48 | description: If applicable, add screenshots to help explain your problem.
49 |
50 |
51 | - type: textarea
52 | attributes:
53 | label: Logs
54 | description: If applicable, add crash or any other logs to help us figure out the problem.
55 |
56 |
57 | - type: textarea
58 | attributes:
59 | label: Device info
60 | value: |
61 | - Device:
62 | - OS Version:
63 | - KernelSU Version:
64 | - Kernel Version:
65 | validations:
66 | required: true
67 |
68 |
69 | - type: textarea
70 | attributes:
71 | label: Additional context
72 | description: Add any other context about the problem here.
73 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/config.yml:
--------------------------------------------------------------------------------
1 | blank_issues_enabled: false
2 | contact_links:
3 | - name: Feature Request
4 | url: https://github.com/tiann/KernelSU/issues/1705
5 | about: "We do not accept external Feature Requests, see this link for more details."
6 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/custom.yml:
--------------------------------------------------------------------------------
1 | name: Custom issue template
2 | description: WARNING! If you are reporting a bug but use this template, the issue will be closed directly.
3 | title: '[Custom]'
4 | body:
5 | - type: textarea
6 | id: description
7 | attributes:
8 | label: "Describe your problem."
9 | validations:
10 | required: true
11 |
12 |
--------------------------------------------------------------------------------
/.github/scripts/build_a13.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -euo pipefail
3 |
4 | build_from_image() {
5 | export TITLE
6 | TITLE=kernel-aarch64-${1//Image-/}
7 |
8 | echo "[+] title: $TITLE"
9 | echo '[+] Building Image.gz'
10 | $GZIP -n -k -f -9 Image >Image.gz
11 |
12 | echo '[+] Building boot.img'
13 | $MKBOOTIMG --header_version 4 --kernel Image --output boot.img
14 | $AVBTOOL add_hash_footer --partition_name boot --partition_size $((64 * 1024 * 1024)) --image boot.img --algorithm SHA256_RSA2048 --key ../kernel-build-tools/linux-x86/share/avb/testkey_rsa2048.pem
15 |
16 | echo '[+] Building boot-gz.img'
17 | $MKBOOTIMG --header_version 4 --kernel Image.gz --output boot-gz.img
18 | $AVBTOOL add_hash_footer --partition_name boot --partition_size $((64 * 1024 * 1024)) --image boot-gz.img --algorithm SHA256_RSA2048 --key ../kernel-build-tools/linux-x86/share/avb/testkey_rsa2048.pem
19 |
20 | echo '[+] Building boot-lz4.img'
21 | $MKBOOTIMG --header_version 4 --kernel Image.lz4 --output boot-lz4.img
22 | $AVBTOOL add_hash_footer --partition_name boot --partition_size $((64 * 1024 * 1024)) --image boot-lz4.img --algorithm SHA256_RSA2048 --key ../kernel-build-tools/linux-x86/share/avb/testkey_rsa2048.pem
23 |
24 | echo '[+] Compress images'
25 | for image in boot*.img; do
26 | $GZIP -n -f -9 "$image"
27 | mv "$image".gz "${1//Image-/}"-"$image".gz
28 | done
29 |
30 | echo '[+] Images to upload'
31 | find . -type f -name "*.gz"
32 |
33 | # find . -type f -name "*.gz" -exec python3 "$GITHUB_WORKSPACE"/KernelSU/scripts/ksubot.py {} +
34 | }
35 |
36 | for dir in Image*; do
37 | if [ -d "$dir" ]; then
38 | echo "----- Building $dir -----"
39 | cd "$dir"
40 | build_from_image "$dir"
41 | cd ..
42 | fi
43 | done
44 |
--------------------------------------------------------------------------------
/.github/workflows/build-debug-kernel.yml:
--------------------------------------------------------------------------------
1 | name: Build debug kernel
2 | on:
3 | workflow_dispatch:
4 |
5 | jobs:
6 | build-debug-kernel-a12:
7 | uses: ./.github/workflows/gki-kernel.yml
8 | with:
9 | version: android12-5.10
10 | version_name: android12-5.10.226
11 | tag: android12-5.10-2024-11
12 | os_patch_level: 2024-11
13 | patch_path: "5.10"
14 | debug: true
15 | build-debug-kernel-a13:
16 | strategy:
17 | matrix:
18 | include:
19 | - version: "5.10"
20 | sub_level: 223
21 | os_patch_level: 2024-11
22 | - version: "5.15"
23 | sub_level: 167
24 | os_patch_level: 2024-11
25 | uses: ./.github/workflows/gki-kernel.yml
26 | with:
27 | version: android13-${{ matrix.version }}
28 | version_name: android13-${{ matrix.version }}.${{ matrix.sub_level }}
29 | tag: android13-${{ matrix.version }}-${{ matrix.os_patch_level }}
30 | patch_path: ${{ matrix.version }}
31 | debug: true
32 | build-debug-kernel-a14:
33 | strategy:
34 | matrix:
35 | include:
36 | - version: "5.15"
37 | sub_level: 167
38 | os_patch_level: 2024-11
39 | - version: "6.1"
40 | sub_level: 115
41 | os_patch_level: 2024-12
42 | uses: ./.github/workflows/gki-kernel.yml
43 | with:
44 | version: android14-${{ matrix.version }}
45 | version_name: android14-${{ matrix.version }}.${{ matrix.sub_level }}
46 | tag: android14-${{ matrix.version }}-${{ matrix.os_patch_level }}
47 | patch_path: ${{ matrix.version }}
48 | debug: true
49 | build-debug-kernel-a15:
50 | strategy:
51 | matrix:
52 | include:
53 | - version: "6.6"
54 | sub_level: 57
55 | os_patch_level: 2024-12
56 | uses: ./.github/workflows/gki-kernel.yml
57 | with:
58 | version: android15-${{ matrix.version }}
59 | version_name: android15-${{ matrix.version }}.${{ matrix.sub_level }}
60 | tag: android15-${{ matrix.version }}-${{ matrix.os_patch_level }}
61 | patch_path: ${{ matrix.version }}
62 | debug: true
--------------------------------------------------------------------------------
/.github/workflows/build-kernel-avd.yml:
--------------------------------------------------------------------------------
1 | name: Build Kernel - AVD
2 | on:
3 | push:
4 | branches: ["main", "ci", "checkci"]
5 | paths:
6 | - ".github/workflows/build-kernel-avd.yml"
7 | - ".github/workflows/avd-kernel.yml"
8 | - ".github/workflows/manifests/*xml"
9 | - "kernel/**"
10 | pull_request:
11 | branches: ["main"]
12 | paths:
13 | - ".github/workflows/build-kernel-avd.yml"
14 | - ".github/workflows/avd-kernel.yml"
15 | - ".github/workflows/manifests/*.xml"
16 | - "kernel/**"
17 | workflow_call:
18 | workflow_dispatch:
19 | jobs:
20 | build-kernel:
21 | if: github.event_name != 'pull_request' && github.ref != 'refs/heads/checkci'
22 | uses: ./.github/workflows/avd-kernel.yml
23 | secrets: inherit
24 | strategy:
25 | matrix:
26 | include:
27 | - version: "android-14-avd_x86_64"
28 | manifest: "android-14-avd_x86_64.xml"
29 | arch: "x86_64"
30 | - version: "android-15-avd_aarch64"
31 | manifest: "android-15-avd_aarch64.xml"
32 | arch: "aarch64"
33 | - version: "android-15-avd_x86_64"
34 | manifest: "android-15-avd_x86_64.xml"
35 | arch: "x86_64"
36 | with:
37 | version_name: ${{ matrix.version }}
38 | manifest_name: ${{ matrix.manifest }}
39 | arch: ${{ matrix.arch }}
40 | debug: true
41 |
--------------------------------------------------------------------------------
/.github/workflows/build-kernel-wsa.yml:
--------------------------------------------------------------------------------
1 | name: Build Kernel - WSA
2 | on:
3 | push:
4 | branches: ["main", "ci", "checkci"]
5 | paths:
6 | - ".github/workflows/build-kernel-wsa.yml"
7 | - ".github/workflows/wsa-kernel.yml"
8 | - "kernel/**"
9 | pull_request:
10 | branches: ["main"]
11 | paths:
12 | - ".github/workflows/build-kernel-wsa.yml"
13 | - ".github/workflows/wsa-kernel.yml"
14 | - "kernel/**"
15 | workflow_call:
16 | workflow_dispatch:
17 |
18 | jobs:
19 | build:
20 | if: github.event_name != 'pull_request' && github.ref != 'refs/heads/checkci'
21 | strategy:
22 | matrix:
23 | arch: [x86_64, arm64]
24 | version: ["5.15.94.2", "5.15.104.1", "5.15.104.2", "5.15.104.3", "5.15.104.4"]
25 | uses: ./.github/workflows/wsa-kernel.yml
26 | with:
27 | arch: ${{ matrix.arch }}
28 | version: ${{ matrix.version }}
29 |
30 | check_build:
31 | if: (github.event_name == 'pull_request' && !github.event.pull_request.draft) || github.ref == 'refs/heads/checkci'
32 | uses: ./.github/workflows/wsa-kernel.yml
33 | strategy:
34 | matrix:
35 | arch: [x86_64, arm64]
36 | with:
37 | arch: ${{ matrix.arch }}
38 | version: "5.15.104.4"
--------------------------------------------------------------------------------
/.github/workflows/build-lkm.yml:
--------------------------------------------------------------------------------
1 | name: Build LKM for KernelSU
2 | on:
3 | push:
4 | branches: ["main", "ci", "checkci"]
5 | paths:
6 | - ".github/workflows/build-lkm.yml"
7 | pull_request:
8 | branches: ["main"]
9 | paths:
10 | - ".github/workflows/build-lkm.yml"
11 | workflow_call:
12 | jobs:
13 | build-lkm:
14 | strategy:
15 | matrix:
16 | include:
17 | - version: "android12-5.10"
18 | sub_level: 226
19 | os_patch_level: 2024-11
20 | - version: "android13-5.10"
21 | sub_level: 223
22 | os_patch_level: 2024-11
23 | - version: "android13-5.15"
24 | sub_level: 167
25 | os_patch_level: 2024-11
26 | - version: "android14-5.15"
27 | sub_level: 167
28 | os_patch_level: 2024-11
29 | - version: "android14-6.1"
30 | sub_level: 115
31 | os_patch_level: 2024-12
32 | - version: "android15-6.6"
33 | sub_level: 57
34 | os_patch_level: 2024-12
35 | uses: ./.github/workflows/gki-kernel.yml
36 | with:
37 | version: ${{ matrix.version }}
38 | version_name: ${{ matrix.version }}.${{ matrix.sub_level }}
39 | tag: ${{ matrix.version }}-${{ matrix.os_patch_level }}
40 | os_patch_level: ${{ matrix.os_patch_level }}
41 | build_lkm: true
--------------------------------------------------------------------------------
/.github/workflows/build-su.yml:
--------------------------------------------------------------------------------
1 | name: Build SU
2 | on:
3 | push:
4 | branches: [ "main", "ci" ]
5 | paths:
6 | - '.github/workflows/build-su.yml'
7 | - 'userspace/su/**'
8 | - 'scripts/ksubot.py'
9 | pull_request:
10 | branches: [ "main" ]
11 | paths:
12 | - 'userspace/su/**'
13 | jobs:
14 | build-su:
15 | name: Build userspace su
16 | runs-on: ubuntu-latest
17 | steps:
18 | - uses: actions/checkout@v4
19 | with:
20 | fetch-depth: 0
21 | - name: Setup need_upload
22 | id: need_upload
23 | run: |
24 | if [ ! -z "${{ secrets.BOT_TOKEN }}" ]; then
25 | echo "UPLOAD=true" >> $GITHUB_OUTPUT
26 | else
27 | echo "UPLOAD=false" >> $GITHUB_OUTPUT
28 | fi
29 | - name: Build su
30 | working-directory: ./userspace/su
31 | run: $ANDROID_NDK/ndk-build
32 | - name: Upload a Build Artifact
33 | uses: actions/upload-artifact@v4
34 | with:
35 | name: su
36 | path: ./userspace/su/libs
37 |
--------------------------------------------------------------------------------
/.github/workflows/clippy.yml:
--------------------------------------------------------------------------------
1 | name: Clippy check
2 |
3 | on:
4 | push:
5 | branches:
6 | - main
7 | paths:
8 | - '.github/workflows/clippy.yml'
9 | - 'userspace/ksud/**'
10 | pull_request:
11 | branches:
12 | - main
13 | paths:
14 | - '.github/workflows/clippy.yml'
15 | - 'userspace/ksud/**'
16 |
17 | env:
18 | RUSTFLAGS: '-Dwarnings'
19 |
20 | jobs:
21 | clippy:
22 | runs-on: ubuntu-latest
23 | steps:
24 | - uses: actions/checkout@v4
25 | - run: rustup update stable
26 | - uses: Swatinem/rust-cache@v2
27 | with:
28 | workspaces: userspace/ksud
29 |
30 | - name: Install cross
31 | run: |
32 | RUSTFLAGS="" cargo install cross --git https://github.com/cross-rs/cross --rev 66845c1
33 |
34 | - name: Run clippy
35 | run: |
36 | cross clippy --manifest-path userspace/ksud/Cargo.toml --target aarch64-linux-android --release
37 | cross clippy --manifest-path userspace/ksud/Cargo.toml --target x86_64-linux-android --release
38 |
--------------------------------------------------------------------------------
/.github/workflows/deploy-website.yml:
--------------------------------------------------------------------------------
1 | name: Deploy Website
2 |
3 | on:
4 | push:
5 | branches:
6 | - main
7 | - website
8 | paths:
9 | - '.github/workflows/deploy-website.yml'
10 | - 'website/**'
11 | workflow_dispatch:
12 |
13 | # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
14 | permissions:
15 | contents: read
16 | pages: write
17 | id-token: write
18 |
19 | # Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
20 | # However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
21 | concurrency:
22 | group: pages
23 | cancel-in-progress: false
24 |
25 | jobs:
26 | # Build job
27 | build:
28 | runs-on: ubuntu-latest
29 | defaults:
30 | run:
31 | working-directory: ./website
32 | steps:
33 | - name: Checkout
34 | uses: actions/checkout@v4
35 | with:
36 | fetch-depth: 0 # Not needed if lastUpdated is not enabled
37 | - name: Setup Node
38 | uses: actions/setup-node@v4
39 | with:
40 | node-version: 20
41 | cache: yarn # or pnpm / yarn
42 | cache-dependency-path: website/yarn.lock
43 | - name: Setup Pages
44 | uses: actions/configure-pages@v5
45 | - name: Install dependencies
46 | run: yarn install --frozen-lockfile
47 | - name: Build with VitePress
48 | run: |
49 | yarn docs:build
50 | touch docs/.vitepress/dist/.nojekyll
51 | - name: Upload artifact
52 | uses: actions/upload-pages-artifact@v3
53 | with:
54 | path: website/docs/.vitepress/dist
55 |
56 | # Deployment job
57 | deploy:
58 | environment:
59 | name: github-pages
60 | url: ${{ steps.deployment.outputs.page_url }}
61 | needs: build
62 | runs-on: ubuntu-latest
63 | name: Deploy
64 | steps:
65 | - name: Deploy to GitHub Pages
66 | id: deployment
67 | uses: actions/deploy-pages@v4
68 |
--------------------------------------------------------------------------------
/.github/workflows/ksud.yml:
--------------------------------------------------------------------------------
1 | name: Build ksud
2 | on:
3 | workflow_call:
4 | inputs:
5 | target:
6 | required: true
7 | type: string
8 | os:
9 | required: false
10 | type: string
11 | default: ubuntu-latest
12 | pack_lkm:
13 | required: false
14 | type: boolean
15 | default: true
16 | use_cache:
17 | required: false
18 | type: boolean
19 | default: true
20 | jobs:
21 | build:
22 | runs-on: ${{ inputs.os }}
23 | steps:
24 | - uses: actions/checkout@v4
25 | with:
26 | fetch-depth: 0
27 |
28 | - name: Download artifacts
29 | uses: actions/download-artifact@v4
30 |
31 | - name: Prepare LKM fies
32 | if: ${{ inputs.pack_lkm }}
33 | run: |
34 | cp android*-lkm/*_kernelsu.ko ./userspace/ksud/bin/aarch64/
35 |
36 | - name: Setup rustup
37 | run: |
38 | rustup update stable
39 | rustup target add x86_64-apple-darwin
40 | rustup target add aarch64-apple-darwin
41 | - uses: Swatinem/rust-cache@v2
42 | with:
43 | workspaces: userspace/ksud
44 | cache-targets: false
45 |
46 | - name: Install cross
47 | run: |
48 | RUSTFLAGS="" cargo install cross --git https://github.com/cross-rs/cross --rev 66845c1
49 |
50 | - name: Build ksud
51 | run: CROSS_NO_WARNINGS=0 cross build --target ${{ inputs.target }} --release --manifest-path ./userspace/ksud/Cargo.toml
52 |
53 | - name: Upload ksud artifact
54 | uses: actions/upload-artifact@v4
55 | with:
56 | name: ksud-${{ inputs.target }}
57 | path: userspace/ksud/target/**/release/ksud*
58 |
--------------------------------------------------------------------------------
/.github/workflows/rustfmt.yml:
--------------------------------------------------------------------------------
1 | name: Rustfmt check
2 |
3 | on:
4 | push:
5 | branches:
6 | - 'main'
7 | paths:
8 | - '.github/workflows/rustfmt.yml'
9 | - 'userspace/ksud/**'
10 | pull_request:
11 | branches:
12 | - 'main'
13 | paths:
14 | - '.github/workflows/rustfmt.yml'
15 | - 'userspace/ksud/**'
16 |
17 | permissions:
18 | checks: write
19 |
20 | jobs:
21 | format:
22 | runs-on: ubuntu-latest
23 | steps:
24 | - uses: actions/checkout@v4
25 |
26 | - uses: dtolnay/rust-toolchain@nightly
27 | with:
28 | components: rustfmt
29 |
30 | - uses: LoliGothick/rustfmt-check@master
31 | with:
32 | token: ${{ github.token }}
33 | working-directory: userspace/ksud
34 |
--------------------------------------------------------------------------------
/.github/workflows/shellcheck.yml:
--------------------------------------------------------------------------------
1 | name: ShellCheck
2 |
3 | on:
4 | push:
5 | branches:
6 | - 'main'
7 | paths:
8 | - '.github/workflows/shellcheck.yml'
9 | - '**/*.sh'
10 | pull_request:
11 | branches:
12 | - 'main'
13 | paths:
14 | - '.github/workflows/shellcheck.yml'
15 | - '**/*.sh'
16 |
17 | jobs:
18 | shellcheck:
19 | runs-on: ubuntu-latest
20 | steps:
21 | - uses: actions/checkout@v4
22 |
23 | - name: Run ShellCheck
24 | uses: ludeeus/action-shellcheck@2.0.0
25 | with:
26 | ignore_names: gradlew
27 | ignore_paths: ./userspace/ksud/src/installer.sh
28 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .idea
2 | .vscode
3 | *.zip
4 | *.patch
5 |
--------------------------------------------------------------------------------
/SECURITY.md:
--------------------------------------------------------------------------------
1 | # Reporting Security Issues
2 |
3 | The KernelSU team and community take security bugs in KernelSU seriously. We appreciate your efforts to responsibly disclose your findings, and will make every effort to acknowledge your contributions.
4 |
5 | To report a security issue, please use the GitHub Security Advisory ["Report a Vulnerability"](https://github.com/tiann/KernelSU/security/advisories/new) tab, or you can mailto [weishu](mailto:twsxtd@gmail.com) directly.
6 |
7 | The KernelSU team will send a response indicating the next steps in handling your report. After the initial reply to your report, the security team will keep you informed of the progress towards a fix and full announcement, and may ask for additional information or guidance.
8 |
--------------------------------------------------------------------------------
/docs/README_CN.md:
--------------------------------------------------------------------------------
1 | [English](README.md) | [Español](README_ES.md) | **简体中文** | [繁體中文](README_TW.md) | [日本語](README_JP.md) | [한국어](README_KR.md) | [Polski](README_PL.md) | [Português (Brasil)](README_PT-BR.md) | [Türkçe](README_TR.md) | [Русский](README_RU.md) | [Tiếng Việt](README_VI.md) | [Indonesia](README_ID.md) | [עברית](README_IW.md) | [हिंदी](README_IN.md) | [Italiano](README_IT.md)
2 |
3 | # KernelSU
4 |
5 |
6 |
7 | 一个 Android 上基于内核的 root 方案。
8 |
9 | [](https://github.com/tiann/KernelSU/releases/latest)
10 | [](https://hosted.weblate.org/engage/kernelsu)
11 | [](https://t.me/KernelSU)
12 | [](https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html)
13 | [](/LICENSE)
14 |
15 | ## 特性
16 |
17 | - 基于内核的 `su` 和权限管理。
18 | - 基于 [OverlayFS](https://en.wikipedia.org/wiki/OverlayFS) 的模块系统。
19 | - [App Profile](https://kernelsu.org/zh_CN/guide/app-profile.html): 把 Root 权限关进笼子里。
20 |
21 | ## 兼容状态
22 |
23 | KernelSU 官方支持 GKI 2.0 的设备(内核版本5.10以上);旧内核也是兼容的(最低4.14+),不过需要自己编译内核。
24 |
25 | WSA, ChromeOS 和运行在容器上的 Android 也可以与 KernelSU 一起工作。
26 |
27 | 目前支持架构 : `arm64-v8a` 和 `x86_64`。
28 |
29 | ## 使用方法
30 |
31 | - [安装教程](https://kernelsu.org/zh_CN/guide/installation.html)
32 | - [如何构建?](https://kernelsu.org/zh_CN/guide/how-to-build.html)
33 | - [官方网站](https://kernelsu.org/zh_CN/)
34 |
35 | ## 参与翻译
36 |
37 | 要将 KernelSU 翻译成您的语言,或完善现有的翻译,请使用 [Weblate](https://hosted.weblate.org/engage/kernelsu/)。现已不再接受有关管理器翻译的PR,因为这会与Weblate冲突。
38 |
39 | ## 讨论
40 |
41 | - Telegram: [@KernelSU](https://t.me/KernelSU)
42 |
43 | ## 安全性
44 |
45 | 有关报告 KernelSU 安全漏洞的信息,请参阅 [SECURITY.md](/SECURITY.md)。
46 |
47 | ## 许可证
48 |
49 | - 目录 `kernel` 下所有文件为 [GPL-2.0-only](https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html)。
50 | - 除 `kernel` 目录的其他部分均为 [GPL-3.0-or-later](https://www.gnu.org/licenses/gpl-3.0.html)。
51 |
52 | ## 鸣谢
53 |
54 | - [kernel-assisted-superuser](https://git.zx2c4.com/kernel-assisted-superuser/about/):KernelSU 的灵感。
55 | - [Magisk](https://github.com/topjohnwu/Magisk):强大的 root 工具箱。
56 | - [genuine](https://github.com/brevent/genuine/):apk v2 签名验证。
57 | - [Diamorphine](https://github.com/m0nad/Diamorphine):一些 rootkit 技巧。
58 |
--------------------------------------------------------------------------------
/docs/README_JP.md:
--------------------------------------------------------------------------------
1 | [English](README.md) | [Español](README_ES.md) | [简体中文](README_CN.md) | [繁體中文](README_TW.md) | **日本語** | [한국어](README_KR.md) | [Polski](README_PL.md) | [Português (Brasil)](README_PT-BR.md) | [Türkçe](README_TR.md) | [Русский](README_RU.md) | [Tiếng Việt](README_VI.md) | [Indonesia](README_ID.md) | [עברית](README_IW.md) | [हिंदी](README_IN.md) | [Italiano](README_IT.md)
2 |
3 | # KernelSU
4 |
5 |
6 |
7 | Android におけるカーネルベースの root ソリューションです。
8 |
9 | [](https://github.com/tiann/KernelSU/releases/latest)
10 | [](https://hosted.weblate.org/engage/kernelsu)
11 | [](https://t.me/KernelSU)
12 | [](https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html)
13 | [](/LICENSE)
14 |
15 | ## 特徴
16 |
17 | 1. カーネルベースの `su` と権限管理。
18 | 2. [OverlayFS](https://en.wikipedia.org/wiki/OverlayFS) に基づくモジュールシステム。
19 | 3. [アプリのプロファイル](https://kernelsu.org/guide/app-profile.html): root の権限をケージ内に閉じ込めます。
20 |
21 | ## 対応状況
22 |
23 | KernelSU は GKI 2.0 デバイス(カーネルバージョン 5.10 以上)を公式にサポートしています。古いカーネル(4.14以上)とも互換性がありますが、自分でカーネルをビルドする必要があります。
24 |
25 | WSA 、ChromeOS とコンテナ上で動作する Android でも KernelSU を統合して動かせます。
26 |
27 | 現在サポートしているアーキテクチャは `arm64-v8a` および `x86_64` です。
28 |
29 | ## 使用方法
30 |
31 | - [インストール方法はこちら](https://kernelsu.org/ja_JP/guide/installation.html)
32 | - [ビルド方法はこちら](https://kernelsu.org/guide/how-to-build.html)
33 | - [公式サイト](https://kernelsu.org/ja_JP/)
34 |
35 | ## 翻訳
36 |
37 | KernelSU をあなたの言語に翻訳するか、既存の翻訳を改善するには、[Weblate](https://hosted.weblate.org/engage/kernelsu/) を使用してください。Manager翻訳した PR は、Weblate と競合するため受け入れられなくなりました。
38 |
39 | ## ディスカッション
40 |
41 | - Telegram: [@KernelSU](https://t.me/KernelSU)
42 |
43 | ## ライセンス
44 |
45 | - `kernel` ディレクトリの下にあるすべてのファイル: [GPL-2-only](https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html)。
46 | - `kernel` ディレクトリ以外のすべてのファイル: [GPL-3.0-or-later](https://www.gnu.org/licenses/gpl-3.0.html)。
47 |
48 | ## クレジット
49 |
50 | - [kernel-assisted-superuser](https://git.zx2c4.com/kernel-assisted-superuser/about/):KernelSU のアイデア元。
51 | - [Magisk](https://github.com/topjohnwu/Magisk):強力な root ツール。
52 | - [genuine](https://github.com/brevent/genuine/):apk v2 の署名検証。
53 | - [Diamorphine](https://github.com/m0nad/Diamorphine): rootkit のスキル。
54 |
--------------------------------------------------------------------------------
/js/index.d.ts:
--------------------------------------------------------------------------------
1 | interface ExecOptions {
2 | cwd?: string,
3 | env?: { [key: string]: string }
4 | }
5 |
6 | interface ExecResults {
7 | errno: number,
8 | stdout: string,
9 | stderr: string
10 | }
11 |
12 | declare function exec(command: string): Promise;
13 | declare function exec(command: string, options: ExecOptions): Promise;
14 |
15 | interface SpawnOptions {
16 | cwd?: string,
17 | env?: { [key: string]: string }
18 | }
19 |
20 | interface Stdio {
21 | on(event: 'data', callback: (data: string) => void)
22 | }
23 |
24 | interface ChildProcess {
25 | stdout: Stdio,
26 | stderr: Stdio,
27 | on(event: 'exit', callback: (code: number) => void)
28 | on(event: 'error', callback: (err: any) => void)
29 | }
30 |
31 | declare function spawn(command: string): ChildProcess;
32 | declare function spawn(command: string, args: string[]): ChildProcess;
33 | declare function spawn(command: string, options: SpawnOptions): ChildProcess;
34 | declare function spawn(command: string, args: string[], options: SpawnOptions): ChildProcess;
35 |
36 | declare function fullScreen(isFullScreen: boolean);
37 |
38 | declare function toast(message: string);
39 |
40 | declare function moduleInfo(): string;
41 |
42 | export {
43 | exec,
44 | spawn,
45 | fullScreen,
46 | toast,
47 | moduleInfo
48 | }
49 |
--------------------------------------------------------------------------------
/js/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "kernelsu",
3 | "version": "1.0.7",
4 | "description": "Library for KernelSU's module WebUI",
5 | "main": "index.js",
6 | "types": "index.d.ts",
7 | "scripts": {
8 | "test": "npm run test"
9 | },
10 | "repository": {
11 | "type": "git",
12 | "url": "git+https://github.com/tiann/KernelSU.git"
13 | },
14 | "keywords": [
15 | "su",
16 | "kernelsu",
17 | "module",
18 | "webui"
19 | ],
20 | "author": "weishu",
21 | "license": "Apache-2.0",
22 | "bugs": {
23 | "url": "https://github.com/tiann/KernelSU/issues"
24 | },
25 | "homepage": "https://github.com/tiann/KernelSU#readme"
26 | }
27 |
--------------------------------------------------------------------------------
/justfile:
--------------------------------------------------------------------------------
1 | alias bk := build_ksud
2 | alias bm := build_manager
3 |
4 | build_ksud:
5 | cross build --target aarch64-linux-android --release --manifest-path ./userspace/ksud/Cargo.toml
6 |
7 | build_manager: build_ksud
8 | cp userspace/ksud/target/aarch64-linux-android/release/ksud manager/app/src/main/jniLibs/arm64-v8a/libksud.so
9 | cd manager && ./gradlew aDebug
10 |
11 | clippy:
12 | cargo fmt --manifest-path ./userspace/ksud/Cargo.toml
13 | cross clippy --target x86_64-pc-windows-gnu --release --manifest-path ./userspace/ksud/Cargo.toml
14 | cross clippy --target aarch64-linux-android --release --manifest-path ./userspace/ksud/Cargo.toml
15 |
--------------------------------------------------------------------------------
/kernel/.clangd:
--------------------------------------------------------------------------------
1 | Diagnostics:
2 | UnusedIncludes: Strict
3 | ClangTidy:
4 | Remove: bugprone-sizeof-expression
5 |
--------------------------------------------------------------------------------
/kernel/allowlist.h:
--------------------------------------------------------------------------------
1 | #ifndef __KSU_H_ALLOWLIST
2 | #define __KSU_H_ALLOWLIST
3 |
4 | #include
5 | #include "ksu.h"
6 |
7 | void ksu_allowlist_init(void);
8 |
9 | void ksu_allowlist_exit(void);
10 |
11 | bool ksu_load_allow_list(void);
12 |
13 | void ksu_show_allow_list(void);
14 |
15 | bool __ksu_is_allow_uid(uid_t uid);
16 | #define ksu_is_allow_uid(uid) unlikely(__ksu_is_allow_uid(uid))
17 |
18 | bool ksu_get_allow_list(int *array, int *length, bool allow);
19 |
20 | void ksu_prune_allowlist(bool (*is_uid_exist)(uid_t, char *, void *), void *data);
21 |
22 | bool ksu_get_app_profile(struct app_profile *);
23 | bool ksu_set_app_profile(struct app_profile *, bool persist);
24 |
25 | bool ksu_uid_should_umount(uid_t uid);
26 | struct root_profile *ksu_get_root_profile(uid_t uid);
27 | #endif
28 |
--------------------------------------------------------------------------------
/kernel/apk_sign.h:
--------------------------------------------------------------------------------
1 | #ifndef __KSU_H_APK_V2_SIGN
2 | #define __KSU_H_APK_V2_SIGN
3 |
4 | #include
5 |
6 | bool ksu_is_manager_apk(char *path);
7 |
8 | #endif
9 |
--------------------------------------------------------------------------------
/kernel/core_hook.h:
--------------------------------------------------------------------------------
1 | #ifndef __KSU_H_KSU_CORE
2 | #define __KSU_H_KSU_CORE
3 |
4 | #include
5 |
6 | void __init ksu_core_init(void);
7 | void ksu_core_exit(void);
8 |
9 | #endif
10 |
--------------------------------------------------------------------------------
/kernel/embed_ksud.c:
--------------------------------------------------------------------------------
1 | // WARNING: THIS IS A STUB FILE
2 | // This file will be regenerated by CI
3 |
4 | unsigned int ksud_size = 0;
5 | const char ksud[0] = {};
6 |
--------------------------------------------------------------------------------
/kernel/export_symbol.txt:
--------------------------------------------------------------------------------
1 | register_kprobe
2 | unregister_kprobe
3 |
--------------------------------------------------------------------------------
/kernel/include/ksu_hook.h:
--------------------------------------------------------------------------------
1 | #ifndef __KSU_H_KSHOOK
2 | #define __KSU_H_KSHOOK
3 |
4 | #include
5 | #include
6 |
7 | // For sucompat
8 |
9 | int ksu_handle_faccessat(int *dfd, const char __user **filename_user, int *mode,
10 | int *flags);
11 |
12 | int ksu_handle_stat(int *dfd, const char __user **filename_user, int *flags);
13 |
14 | // For ksud
15 |
16 | int ksu_handle_vfs_read(struct file **file_ptr, char __user **buf_ptr,
17 | size_t *count_ptr, loff_t **pos);
18 |
19 | // For ksud and sucompat
20 |
21 | int ksu_handle_execveat(int *fd, struct filename **filename_ptr, void *argv,
22 | void *envp, int *flags);
23 |
24 | // For volume button
25 | int ksu_handle_input_handle_event(unsigned int *type, unsigned int *code,
26 | int *value);
27 |
28 | #endif
29 |
--------------------------------------------------------------------------------
/kernel/kernel_compat.h:
--------------------------------------------------------------------------------
1 | #ifndef __KSU_H_KERNEL_COMPAT
2 | #define __KSU_H_KERNEL_COMPAT
3 |
4 | #include
5 | #include
6 | #include "ss/policydb.h"
7 | #include "linux/key.h"
8 |
9 | /*
10 | * Adapt to Huawei HISI kernel without affecting other kernels ,
11 | * Huawei Hisi Kernel EBITMAP Enable or Disable Flag ,
12 | * From ss/ebitmap.h
13 | */
14 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)) && \
15 | (LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)) || \
16 | (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0)) && \
17 | (LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0))
18 | #ifdef HISI_SELINUX_EBITMAP_RO
19 | #define CONFIG_IS_HW_HISI
20 | #endif
21 | #endif
22 |
23 | extern long ksu_strncpy_from_user_nofault(char *dst,
24 | const void __user *unsafe_addr,
25 | long count);
26 |
27 | #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) || defined(CONFIG_IS_HW_HISI)
28 | extern struct key *init_session_keyring;
29 | #endif
30 |
31 | extern void ksu_android_ns_fs_check();
32 | extern int ksu_access_ok(const void *addr, unsigned long size);
33 | extern struct file *ksu_filp_open_compat(const char *filename, int flags,
34 | umode_t mode);
35 | extern ssize_t ksu_kernel_read_compat(struct file *p, void *buf, size_t count,
36 | loff_t *pos);
37 | extern ssize_t ksu_kernel_write_compat(struct file *p, const void *buf,
38 | size_t count, loff_t *pos);
39 |
40 | #endif
41 |
--------------------------------------------------------------------------------
/kernel/klog.h:
--------------------------------------------------------------------------------
1 | #ifndef __KSU_H_KLOG
2 | #define __KSU_H_KLOG
3 |
4 | #include
5 |
6 | #ifdef pr_fmt
7 | #undef pr_fmt
8 | #define pr_fmt(fmt) "KernelSU: " fmt
9 | #endif
10 |
11 | #endif
12 |
--------------------------------------------------------------------------------
/kernel/ksu.h:
--------------------------------------------------------------------------------
1 | #ifndef __KSU_H_KSU
2 | #define __KSU_H_KSU
3 |
4 | #include
5 | #include
6 |
7 | #define KERNEL_SU_VERSION KSU_VERSION
8 | #define KERNEL_SU_OPTION 0xDEADBEEF
9 |
10 | #define CMD_GRANT_ROOT 0
11 | #define CMD_BECOME_MANAGER 1
12 | #define CMD_GET_VERSION 2
13 | #define CMD_ALLOW_SU 3
14 | #define CMD_DENY_SU 4
15 | #define CMD_GET_ALLOW_LIST 5
16 | #define CMD_GET_DENY_LIST 6
17 | #define CMD_REPORT_EVENT 7
18 | #define CMD_SET_SEPOLICY 8
19 | #define CMD_CHECK_SAFEMODE 9
20 | #define CMD_GET_APP_PROFILE 10
21 | #define CMD_SET_APP_PROFILE 11
22 | #define CMD_UID_GRANTED_ROOT 12
23 | #define CMD_UID_SHOULD_UMOUNT 13
24 |
25 | #define EVENT_POST_FS_DATA 1
26 | #define EVENT_BOOT_COMPLETED 2
27 | #define EVENT_MODULE_MOUNTED 3
28 |
29 | #define KSU_APP_PROFILE_VER 2
30 | #define KSU_MAX_PACKAGE_NAME 256
31 | // NGROUPS_MAX for Linux is 65535 generally, but we only supports 32 groups.
32 | #define KSU_MAX_GROUPS 32
33 | #define KSU_SELINUX_DOMAIN 64
34 |
35 | struct root_profile {
36 | int32_t uid;
37 | int32_t gid;
38 |
39 | int32_t groups_count;
40 | int32_t groups[KSU_MAX_GROUPS];
41 |
42 | // kernel_cap_t is u32[2] for capabilities v3
43 | struct {
44 | u64 effective;
45 | u64 permitted;
46 | u64 inheritable;
47 | } capabilities;
48 |
49 | char selinux_domain[KSU_SELINUX_DOMAIN];
50 |
51 | int32_t namespaces;
52 | };
53 |
54 | struct non_root_profile {
55 | bool umount_modules;
56 | };
57 |
58 | struct app_profile {
59 | // It may be utilized for backward compatibility, although we have never explicitly made any promises regarding this.
60 | u32 version;
61 |
62 | // this is usually the package of the app, but can be other value for special apps
63 | char key[KSU_MAX_PACKAGE_NAME];
64 | int32_t current_uid;
65 | bool allow_su;
66 |
67 | union {
68 | struct {
69 | bool use_default;
70 | char template_name[KSU_MAX_PACKAGE_NAME];
71 |
72 | struct root_profile profile;
73 | } rp_config;
74 |
75 | struct {
76 | bool use_default;
77 |
78 | struct non_root_profile profile;
79 | } nrp_config;
80 | };
81 | };
82 |
83 | bool ksu_queue_work(struct work_struct *work);
84 |
85 | static inline int startswith(char *s, char *prefix)
86 | {
87 | return strncmp(s, prefix, strlen(prefix));
88 | }
89 |
90 | static inline int endswith(const char *s, const char *t)
91 | {
92 | size_t slen = strlen(s);
93 | size_t tlen = strlen(t);
94 | if (tlen > slen)
95 | return 1;
96 | return strcmp(s + slen - tlen, t);
97 | }
98 |
99 | #endif
100 |
--------------------------------------------------------------------------------
/kernel/ksud.h:
--------------------------------------------------------------------------------
1 | #ifndef __KSU_H_KSUD
2 | #define __KSU_H_KSUD
3 |
4 | #include
5 |
6 | #define KSUD_PATH "/data/adb/ksud"
7 |
8 | void ksu_on_post_fs_data(void);
9 |
10 | bool ksu_is_safe_mode(void);
11 |
12 | extern u32 ksu_devpts_sid;
13 |
14 | #endif
15 |
--------------------------------------------------------------------------------
/kernel/manager.h:
--------------------------------------------------------------------------------
1 | #ifndef __KSU_H_KSU_MANAGER
2 | #define __KSU_H_KSU_MANAGER
3 |
4 | #include
5 | #include
6 |
7 | #define KSU_INVALID_UID -1
8 |
9 | extern uid_t ksu_manager_uid; // DO NOT DIRECT USE
10 |
11 | static inline bool ksu_is_manager_uid_valid()
12 | {
13 | return ksu_manager_uid != KSU_INVALID_UID;
14 | }
15 |
16 | static inline bool ksu_is_manager()
17 | {
18 | return unlikely(ksu_manager_uid == current_uid().val);
19 | }
20 |
21 | static inline uid_t ksu_get_manager_uid()
22 | {
23 | return ksu_manager_uid;
24 | }
25 |
26 | static inline void ksu_set_manager_uid(uid_t uid)
27 | {
28 | ksu_manager_uid = uid;
29 | }
30 |
31 | static inline void ksu_invalidate_manager_uid()
32 | {
33 | ksu_manager_uid = KSU_INVALID_UID;
34 | }
35 |
36 | #endif
37 |
--------------------------------------------------------------------------------
/kernel/selinux/Makefile:
--------------------------------------------------------------------------------
1 | obj-y += selinux.o
2 | obj-y += sepolicy.o
3 | obj-y += rules.o
4 |
5 | ifeq ($(shell grep -q " current_sid(void)" $(srctree)/security/selinux/include/objsec.h; echo $$?),0)
6 | ccflags-y += -DKSU_COMPAT_HAS_CURRENT_SID
7 | endif
8 |
9 | ifeq ($(shell grep -q "struct selinux_state " $(srctree)/security/selinux/include/security.h; echo $$?),0)
10 | ccflags-y += -DKSU_COMPAT_HAS_SELINUX_STATE
11 | endif
12 |
13 | ccflags-y += -Wno-implicit-function-declaration -Wno-strict-prototypes -Wno-int-conversion
14 | ccflags-y += -Wno-declaration-after-statement -Wno-unused-function
15 | ccflags-y += -I$(srctree)/security/selinux -I$(srctree)/security/selinux/include
16 | ccflags-y += -I$(objtree)/security/selinux -include $(srctree)/include/uapi/asm-generic/errno.h
17 |
--------------------------------------------------------------------------------
/kernel/selinux/selinux.h:
--------------------------------------------------------------------------------
1 | #ifndef __KSU_H_SELINUX
2 | #define __KSU_H_SELINUX
3 |
4 | #include "linux/types.h"
5 | #include "linux/version.h"
6 |
7 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)) || defined(KSU_COMPAT_HAS_SELINUX_STATE)
8 | #define KSU_COMPAT_USE_SELINUX_STATE
9 | #endif
10 |
11 | void ksu_setup_selinux(const char *);
12 |
13 | void ksu_setenforce(bool);
14 |
15 | bool ksu_getenforce();
16 |
17 | bool ksu_is_ksu_domain();
18 |
19 | bool ksu_is_zygote(void *cred);
20 |
21 | void ksu_apply_kernelsu_rules();
22 |
23 | #ifdef CONFIG_KSU_SUSFS_SUS_MOUNT
24 | bool susfs_is_sid_equal(void *sec, u32 sid2);
25 | u32 susfs_get_sid_from_name(const char *secctx_name);
26 | u32 susfs_get_current_sid(void);
27 | void susfs_set_zygote_sid(void);
28 | bool susfs_is_current_zygote_domain(void);
29 | void susfs_set_ksu_sid(void);
30 | bool susfs_is_current_ksu_domain(void);
31 | void susfs_set_init_sid(void);
32 | bool susfs_is_current_init_domain(void);
33 | #endif
34 |
35 | u32 ksu_get_devpts_sid();
36 |
37 | #endif
38 |
--------------------------------------------------------------------------------
/kernel/selinux/sepolicy.h:
--------------------------------------------------------------------------------
1 | #ifndef __KSU_H_SEPOLICY
2 | #define __KSU_H_SEPOLICY
3 |
4 | #include
5 |
6 | #include "ss/policydb.h"
7 |
8 | // Operation on types
9 | bool ksu_type(struct policydb *db, const char *name, const char *attr);
10 | bool ksu_attribute(struct policydb *db, const char *name);
11 | bool ksu_permissive(struct policydb *db, const char *type);
12 | bool ksu_enforce(struct policydb *db, const char *type);
13 | bool ksu_typeattribute(struct policydb *db, const char *type, const char *attr);
14 | bool ksu_exists(struct policydb *db, const char *type);
15 |
16 | // Access vector rules
17 | bool ksu_allow(struct policydb *db, const char *src, const char *tgt,
18 | const char *cls, const char *perm);
19 | bool ksu_deny(struct policydb *db, const char *src, const char *tgt,
20 | const char *cls, const char *perm);
21 | bool ksu_auditallow(struct policydb *db, const char *src, const char *tgt,
22 | const char *cls, const char *perm);
23 | bool ksu_dontaudit(struct policydb *db, const char *src, const char *tgt,
24 | const char *cls, const char *perm);
25 |
26 | // Extended permissions access vector rules
27 | bool ksu_allowxperm(struct policydb *db, const char *src, const char *tgt,
28 | const char *cls, const char *range);
29 | bool ksu_auditallowxperm(struct policydb *db, const char *src, const char *tgt,
30 | const char *cls, const char *range);
31 | bool ksu_dontauditxperm(struct policydb *db, const char *src, const char *tgt,
32 | const char *cls, const char *range);
33 |
34 | // Type rules
35 | bool ksu_type_transition(struct policydb *db, const char *src, const char *tgt,
36 | const char *cls, const char *def, const char *obj);
37 | bool ksu_type_change(struct policydb *db, const char *src, const char *tgt,
38 | const char *cls, const char *def);
39 | bool ksu_type_member(struct policydb *db, const char *src, const char *tgt,
40 | const char *cls, const char *def);
41 |
42 | // File system labeling
43 | bool ksu_genfscon(struct policydb *db, const char *fs_name, const char *path,
44 | const char *ctx);
45 |
46 | #endif
47 |
--------------------------------------------------------------------------------
/kernel/throne_tracker.h:
--------------------------------------------------------------------------------
1 | #ifndef __KSU_H_UID_OBSERVER
2 | #define __KSU_H_UID_OBSERVER
3 |
4 | void ksu_throne_tracker_init();
5 |
6 | void ksu_throne_tracker_exit();
7 |
8 | void ksu_track_throne();
9 |
10 | #endif
11 |
--------------------------------------------------------------------------------
/manager/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | .idea
4 | .kotlin
5 | .DS_Store
6 | build
7 | captures
8 | .cxx
9 | local.properties
10 | key.jks
11 |
--------------------------------------------------------------------------------
/manager/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 | /release/
3 |
--------------------------------------------------------------------------------
/manager/app/proguard-rules.pro:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-sm8350/susfs4ksu/9e9b053f634894eddfe26501564dbef6aa0f3b65/manager/app/proguard-rules.pro
--------------------------------------------------------------------------------
/manager/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
19 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
35 |
36 |
41 |
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/manager/app/src/main/aidl/me/weishu/kernelsu/IKsuInterface.aidl:
--------------------------------------------------------------------------------
1 | // IKsuInterface.aidl
2 | package me.weishu.kernelsu;
3 |
4 | import android.content.pm.PackageInfo;
5 | import rikka.parcelablelist.ParcelableListSlice;
6 |
7 | interface IKsuInterface {
8 | ParcelableListSlice getPackages(int flags);
9 | }
--------------------------------------------------------------------------------
/manager/app/src/main/cpp/CMakeLists.txt:
--------------------------------------------------------------------------------
1 |
2 | # For more information about using CMake with Android Studio, read the
3 | # documentation: https://d.android.com/studio/projects/add-native-code.html
4 |
5 | # Sets the minimum version of CMake required to build the native library.
6 | cmake_minimum_required(VERSION 3.18.1)
7 |
8 | project("kernelsu")
9 |
10 | find_package(cxx REQUIRED CONFIG)
11 | link_libraries(cxx::cxx)
12 |
13 | add_library(kernelsu
14 | SHARED
15 | jni.cc
16 | ksu.cc
17 | )
18 |
19 | find_library(log-lib log)
20 |
21 | target_link_libraries(kernelsu ${log-lib})
--------------------------------------------------------------------------------
/manager/app/src/main/cpp/ksu.cc:
--------------------------------------------------------------------------------
1 | //
2 | // Created by weishu on 2022/12/9.
3 | //
4 |
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include
10 |
11 | #include "ksu.h"
12 |
13 | #define KERNEL_SU_OPTION 0xDEADBEEF
14 |
15 | #define CMD_GRANT_ROOT 0
16 |
17 | #define CMD_BECOME_MANAGER 1
18 | #define CMD_GET_VERSION 2
19 | #define CMD_ALLOW_SU 3
20 | #define CMD_DENY_SU 4
21 | #define CMD_GET_SU_LIST 5
22 | #define CMD_GET_DENY_LIST 6
23 | #define CMD_CHECK_SAFEMODE 9
24 |
25 | #define CMD_GET_APP_PROFILE 10
26 | #define CMD_SET_APP_PROFILE 11
27 |
28 | #define CMD_IS_UID_GRANTED_ROOT 12
29 | #define CMD_IS_UID_SHOULD_UMOUNT 13
30 |
31 | static bool ksuctl(int cmd, void* arg1, void* arg2) {
32 | int32_t result = 0;
33 | prctl(KERNEL_SU_OPTION, cmd, arg1, arg2, &result);
34 | return result == KERNEL_SU_OPTION;
35 | }
36 |
37 | bool become_manager(const char* pkg) {
38 | char param[128];
39 | uid_t uid = getuid();
40 | uint32_t userId = uid / 100000;
41 | if (userId == 0) {
42 | sprintf(param, "/data/data/%s", pkg);
43 | } else {
44 | snprintf(param, sizeof(param), "/data/user/%d/%s", userId, pkg);
45 | }
46 |
47 | return ksuctl(CMD_BECOME_MANAGER, param, nullptr);
48 | }
49 |
50 | // cache the result to avoid unnecessary syscall
51 | static bool is_lkm;
52 | int get_version() {
53 | int32_t version = -1;
54 | int32_t lkm = 0;
55 | ksuctl(CMD_GET_VERSION, &version, &lkm);
56 | if (!is_lkm && lkm != 0) {
57 | is_lkm = true;
58 | }
59 | return version;
60 | }
61 |
62 | bool get_allow_list(int *uids, int *size) {
63 | return ksuctl(CMD_GET_SU_LIST, uids, size);
64 | }
65 |
66 | bool is_safe_mode() {
67 | return ksuctl(CMD_CHECK_SAFEMODE, nullptr, nullptr);
68 | }
69 |
70 | bool is_lkm_mode() {
71 | // you should call get_version first!
72 | return is_lkm;
73 | }
74 |
75 | bool uid_should_umount(int uid) {
76 | bool should;
77 | return ksuctl(CMD_IS_UID_SHOULD_UMOUNT, reinterpret_cast(uid), &should) && should;
78 | }
79 |
80 | bool set_app_profile(const app_profile *profile) {
81 | return ksuctl(CMD_SET_APP_PROFILE, (void*) profile, nullptr);
82 | }
83 |
84 | bool get_app_profile(p_key_t key, app_profile *profile) {
85 | return ksuctl(CMD_GET_APP_PROFILE, (void*) profile, nullptr);
86 | }
87 |
--------------------------------------------------------------------------------
/manager/app/src/main/cpp/ksu.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by weishu on 2022/12/9.
3 | //
4 |
5 | #ifndef KERNELSU_KSU_H
6 | #define KERNELSU_KSU_H
7 |
8 | #include
9 |
10 | bool become_manager(const char *);
11 |
12 | int get_version();
13 |
14 | bool get_allow_list(int *uids, int *size);
15 |
16 | bool uid_should_umount(int uid);
17 |
18 | bool is_safe_mode();
19 |
20 | bool is_lkm_mode();
21 |
22 | #define KSU_APP_PROFILE_VER 2
23 | #define KSU_MAX_PACKAGE_NAME 256
24 | // NGROUPS_MAX for Linux is 65535 generally, but we only supports 32 groups.
25 | #define KSU_MAX_GROUPS 32
26 | #define KSU_SELINUX_DOMAIN 64
27 |
28 | using p_key_t = char[KSU_MAX_PACKAGE_NAME];
29 |
30 | struct root_profile {
31 | int32_t uid;
32 | int32_t gid;
33 |
34 | int32_t groups_count;
35 | int32_t groups[KSU_MAX_GROUPS];
36 |
37 | // kernel_cap_t is u32[2] for capabilities v3
38 | struct {
39 | uint64_t effective;
40 | uint64_t permitted;
41 | uint64_t inheritable;
42 | } capabilities;
43 |
44 | char selinux_domain[KSU_SELINUX_DOMAIN];
45 |
46 | int32_t namespaces;
47 | };
48 |
49 | struct non_root_profile {
50 | bool umount_modules;
51 | };
52 |
53 | struct app_profile {
54 | // It may be utilized for backward compatibility, although we have never explicitly made any promises regarding this.
55 | uint32_t version;
56 |
57 | // this is usually the package of the app, but can be other value for special apps
58 | char key[KSU_MAX_PACKAGE_NAME];
59 | int32_t current_uid;
60 | bool allow_su;
61 |
62 | union {
63 | struct {
64 | bool use_default;
65 | char template_name[KSU_MAX_PACKAGE_NAME];
66 |
67 | struct root_profile profile;
68 | } rp_config;
69 |
70 | struct {
71 | bool use_default;
72 |
73 | struct non_root_profile profile;
74 | } nrp_config;
75 | };
76 | };
77 |
78 | bool set_app_profile(const app_profile *profile);
79 |
80 | bool get_app_profile(p_key_t key, app_profile *profile);
81 |
82 | #endif //KERNELSU_KSU_H
83 |
--------------------------------------------------------------------------------
/manager/app/src/main/java/me/weishu/kernelsu/KernelSUApplication.kt:
--------------------------------------------------------------------------------
1 | package me.weishu.kernelsu
2 |
3 | import android.app.Application
4 | import coil.Coil
5 | import coil.ImageLoader
6 | import me.zhanghai.android.appiconloader.coil.AppIconFetcher
7 | import me.zhanghai.android.appiconloader.coil.AppIconKeyer
8 | import java.io.File
9 |
10 | lateinit var ksuApp: KernelSUApplication
11 |
12 | class KernelSUApplication : Application() {
13 |
14 | override fun onCreate() {
15 | super.onCreate()
16 | ksuApp = this
17 |
18 | val context = this
19 | val iconSize = resources.getDimensionPixelSize(android.R.dimen.app_icon_size)
20 | Coil.setImageLoader(
21 | ImageLoader.Builder(context)
22 | .components {
23 | add(AppIconKeyer())
24 | add(AppIconFetcher.Factory(iconSize, false, context))
25 | }
26 | .build()
27 | )
28 |
29 | val webroot = File(dataDir, "webroot")
30 | if (!webroot.exists()) {
31 | webroot.mkdir()
32 | }
33 | }
34 |
35 |
36 | }
--------------------------------------------------------------------------------
/manager/app/src/main/java/me/weishu/kernelsu/Kernels.kt:
--------------------------------------------------------------------------------
1 | package me.weishu.kernelsu
2 |
3 | import android.system.Os
4 |
5 | /**
6 | * @author weishu
7 | * @date 2022/12/10.
8 | */
9 |
10 | data class KernelVersion(val major: Int, val patchLevel: Int, val subLevel: Int) {
11 | override fun toString(): String {
12 | return "$major.$patchLevel.$subLevel"
13 | }
14 |
15 | fun isGKI(): Boolean {
16 |
17 | // kernel 6.x
18 | if (major > 5) {
19 | return true
20 | }
21 |
22 | // kernel 5.10.x
23 | if (major == 5) {
24 | return patchLevel >= 10
25 | }
26 |
27 | return false
28 | }
29 | }
30 |
31 | fun parseKernelVersion(version: String): KernelVersion {
32 | val find = "(\\d+)\\.(\\d+)\\.(\\d+)".toRegex().find(version)
33 | return if (find != null) {
34 | KernelVersion(find.groupValues[1].toInt(), find.groupValues[2].toInt(), find.groupValues[3].toInt())
35 | } else {
36 | KernelVersion(-1, -1, -1)
37 | }
38 | }
39 |
40 | fun getKernelVersion(): KernelVersion {
41 | Os.uname().release.let {
42 | return parseKernelVersion(it)
43 | }
44 | }
--------------------------------------------------------------------------------
/manager/app/src/main/java/me/weishu/kernelsu/ui/component/KeyEventBlocker.kt:
--------------------------------------------------------------------------------
1 | package me.weishu.kernelsu.ui.component
2 |
3 | import androidx.compose.foundation.focusable
4 | import androidx.compose.foundation.layout.Box
5 | import androidx.compose.runtime.Composable
6 | import androidx.compose.runtime.LaunchedEffect
7 | import androidx.compose.runtime.remember
8 | import androidx.compose.ui.Modifier
9 | import androidx.compose.ui.focus.FocusRequester
10 | import androidx.compose.ui.focus.focusRequester
11 | import androidx.compose.ui.input.key.KeyEvent
12 | import androidx.compose.ui.input.key.onKeyEvent
13 |
14 | @Composable
15 | fun KeyEventBlocker(predicate: (KeyEvent) -> Boolean) {
16 | val requester = remember { FocusRequester() }
17 | Box(
18 | Modifier
19 | .onKeyEvent {
20 | predicate(it)
21 | }
22 | .focusRequester(requester)
23 | .focusable()
24 | )
25 | LaunchedEffect(Unit) {
26 | requester.requestFocus()
27 | }
28 | }
--------------------------------------------------------------------------------
/manager/app/src/main/java/me/weishu/kernelsu/ui/component/SettingsItem.kt:
--------------------------------------------------------------------------------
1 | package me.weishu.kernelsu.ui.component
2 |
3 | import androidx.compose.foundation.LocalIndication
4 | import androidx.compose.foundation.interaction.MutableInteractionSource
5 | import androidx.compose.foundation.selection.toggleable
6 | import androidx.compose.material3.Icon
7 | import androidx.compose.material3.ListItem
8 | import androidx.compose.material3.RadioButton
9 | import androidx.compose.material3.Switch
10 | import androidx.compose.material3.Text
11 | import androidx.compose.runtime.Composable
12 | import androidx.compose.runtime.remember
13 | import androidx.compose.ui.Modifier
14 | import androidx.compose.ui.graphics.vector.ImageVector
15 | import androidx.compose.ui.semantics.Role
16 |
17 | @Composable
18 | fun SwitchItem(
19 | icon: ImageVector? = null,
20 | title: String,
21 | summary: String? = null,
22 | checked: Boolean,
23 | enabled: Boolean = true,
24 | onCheckedChange: (Boolean) -> Unit
25 | ) {
26 | val interactionSource = remember { MutableInteractionSource() }
27 |
28 | ListItem(
29 | modifier = Modifier
30 | .toggleable(
31 | value = checked,
32 | interactionSource = interactionSource,
33 | role = Role.Switch,
34 | enabled = enabled,
35 | indication = LocalIndication.current,
36 | onValueChange = onCheckedChange
37 | ),
38 | headlineContent = {
39 | Text(title)
40 | },
41 | leadingContent = icon?.let {
42 | { Icon(icon, title) }
43 | },
44 | trailingContent = {
45 | Switch(
46 | checked = checked,
47 | enabled = enabled,
48 | onCheckedChange = onCheckedChange,
49 | interactionSource = interactionSource
50 | )
51 | },
52 | supportingContent = {
53 | if (summary != null) {
54 | Text(summary)
55 | }
56 | }
57 | )
58 | }
59 |
60 | @Composable
61 | fun RadioItem(
62 | title: String,
63 | selected: Boolean,
64 | onClick: () -> Unit,
65 | ) {
66 | ListItem(
67 | headlineContent = {
68 | Text(title)
69 | },
70 | leadingContent = {
71 | RadioButton(selected = selected, onClick = onClick)
72 | }
73 | )
74 | }
75 |
--------------------------------------------------------------------------------
/manager/app/src/main/java/me/weishu/kernelsu/ui/component/profile/AppProfileConfig.kt:
--------------------------------------------------------------------------------
1 | package me.weishu.kernelsu.ui.component.profile
2 |
3 | import androidx.compose.foundation.layout.Column
4 | import androidx.compose.material3.OutlinedTextField
5 | import androidx.compose.material3.Text
6 | import androidx.compose.runtime.Composable
7 | import androidx.compose.runtime.getValue
8 | import androidx.compose.runtime.mutableStateOf
9 | import androidx.compose.runtime.remember
10 | import androidx.compose.runtime.setValue
11 | import androidx.compose.ui.Modifier
12 | import androidx.compose.ui.res.stringResource
13 | import androidx.compose.ui.tooling.preview.Preview
14 | import me.weishu.kernelsu.Natives
15 | import me.weishu.kernelsu.R
16 | import me.weishu.kernelsu.ui.component.SwitchItem
17 |
18 | @Composable
19 | fun AppProfileConfig(
20 | modifier: Modifier = Modifier,
21 | fixedName: Boolean,
22 | enabled: Boolean,
23 | profile: Natives.Profile,
24 | onProfileChange: (Natives.Profile) -> Unit,
25 | ) {
26 | Column(modifier = modifier) {
27 | if (!fixedName) {
28 | OutlinedTextField(
29 | label = { Text(stringResource(R.string.profile_name)) },
30 | value = profile.name,
31 | onValueChange = { onProfileChange(profile.copy(name = it)) }
32 | )
33 | }
34 |
35 | SwitchItem(
36 | title = stringResource(R.string.profile_umount_modules),
37 | summary = stringResource(R.string.profile_umount_modules_summary),
38 | checked = if (enabled) {
39 | profile.umountModules
40 | } else {
41 | Natives.isDefaultUmountModules()
42 | },
43 | enabled = enabled,
44 | onCheckedChange = {
45 | onProfileChange(
46 | profile.copy(
47 | umountModules = it,
48 | nonRootUseDefault = false
49 | )
50 | )
51 | }
52 | )
53 | }
54 | }
55 |
56 | @Preview
57 | @Composable
58 | private fun AppProfileConfigPreview() {
59 | var profile by remember { mutableStateOf(Natives.Profile("")) }
60 | AppProfileConfig(fixedName = true, enabled = false, profile = profile) {
61 | profile = it
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/BottomBarDestination.kt:
--------------------------------------------------------------------------------
1 | package me.weishu.kernelsu.ui.screen
2 |
3 | import androidx.annotation.StringRes
4 | import androidx.compose.material.icons.Icons
5 | import androidx.compose.material.icons.filled.*
6 | import androidx.compose.material.icons.outlined.*
7 | import androidx.compose.ui.graphics.vector.ImageVector
8 | import com.ramcosta.composedestinations.generated.destinations.HomeScreenDestination
9 | import com.ramcosta.composedestinations.generated.destinations.ModuleScreenDestination
10 | import com.ramcosta.composedestinations.generated.destinations.SuperUserScreenDestination
11 | import com.ramcosta.composedestinations.spec.DirectionDestinationSpec
12 | import me.weishu.kernelsu.R
13 |
14 | enum class BottomBarDestination(
15 | val direction: DirectionDestinationSpec,
16 | @StringRes val label: Int,
17 | val iconSelected: ImageVector,
18 | val iconNotSelected: ImageVector,
19 | val rootRequired: Boolean,
20 | ) {
21 | Home(HomeScreenDestination, R.string.home, Icons.Filled.Home, Icons.Outlined.Home, false),
22 | SuperUser(SuperUserScreenDestination, R.string.superuser, Icons.Filled.Security, Icons.Outlined.Security, true),
23 | Module(ModuleScreenDestination, R.string.module, Icons.Filled.Apps, Icons.Outlined.Apps, true)
24 | }
25 |
--------------------------------------------------------------------------------
/manager/app/src/main/java/me/weishu/kernelsu/ui/theme/Color.kt:
--------------------------------------------------------------------------------
1 | package me.weishu.kernelsu.ui.theme
2 |
3 | import androidx.compose.ui.graphics.Color
4 |
5 | val YELLOW = Color(0xFFeed502)
6 | val YELLOW_LIGHT = Color(0xFFffff52)
7 | val SECONDARY_LIGHT = Color(0xffa9817f)
8 |
9 | val YELLOW_DARK = Color(0xFFb7a400)
10 | val SECONDARY_DARK = Color(0xFF4c2b2b)
--------------------------------------------------------------------------------
/manager/app/src/main/java/me/weishu/kernelsu/ui/theme/Theme.kt:
--------------------------------------------------------------------------------
1 | package me.weishu.kernelsu.ui.theme
2 |
3 | import android.os.Build
4 | import androidx.compose.foundation.isSystemInDarkTheme
5 | import androidx.compose.material3.MaterialTheme
6 | import androidx.compose.material3.darkColorScheme
7 | import androidx.compose.material3.dynamicDarkColorScheme
8 | import androidx.compose.material3.dynamicLightColorScheme
9 | import androidx.compose.material3.lightColorScheme
10 | import androidx.compose.runtime.Composable
11 | import androidx.compose.ui.platform.LocalContext
12 |
13 | private val DarkColorScheme = darkColorScheme(
14 | primary = YELLOW,
15 | secondary = YELLOW_DARK,
16 | tertiary = SECONDARY_DARK
17 | )
18 |
19 | private val LightColorScheme = lightColorScheme(
20 | primary = YELLOW,
21 | secondary = YELLOW_LIGHT,
22 | tertiary = SECONDARY_LIGHT
23 | )
24 |
25 | @Composable
26 | fun KernelSUTheme(
27 | darkTheme: Boolean = isSystemInDarkTheme(),
28 | // Dynamic color is available on Android 12+
29 | dynamicColor: Boolean = true,
30 | content: @Composable () -> Unit
31 | ) {
32 | val colorScheme = when {
33 | dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> {
34 | val context = LocalContext.current
35 | if (darkTheme) dynamicDarkColorScheme(context) else dynamicLightColorScheme(context)
36 | }
37 | darkTheme -> DarkColorScheme
38 | else -> LightColorScheme
39 | }
40 |
41 | MaterialTheme(
42 | colorScheme = colorScheme,
43 | typography = Typography,
44 | content = content
45 | )
46 | }
47 |
--------------------------------------------------------------------------------
/manager/app/src/main/java/me/weishu/kernelsu/ui/theme/Type.kt:
--------------------------------------------------------------------------------
1 | package me.weishu.kernelsu.ui.theme
2 |
3 | import androidx.compose.ui.text.TextStyle
4 | import androidx.compose.ui.text.font.FontFamily
5 | import androidx.compose.ui.text.font.FontWeight
6 | import androidx.compose.ui.unit.sp
7 |
8 | // Set of Material typography styles to start with
9 | val Typography = androidx.compose.material3.Typography(
10 | bodyLarge = TextStyle(
11 | fontFamily = FontFamily.Default,
12 | fontWeight = FontWeight.Normal,
13 | fontSize = 16.sp,
14 | lineHeight = 24.sp,
15 | letterSpacing = 0.5.sp
16 | )
17 | /* Other default text styles to override
18 | titleLarge = TextStyle(
19 | fontFamily = FontFamily.Default,
20 | fontWeight = FontWeight.Normal,
21 | fontSize = 22.sp,
22 | lineHeight = 28.sp,
23 | letterSpacing = 0.sp
24 | ),
25 | labelSmall = TextStyle(
26 | fontFamily = FontFamily.Default,
27 | fontWeight = FontWeight.Medium,
28 | fontSize = 11.sp,
29 | lineHeight = 16.sp,
30 | letterSpacing = 0.5.sp
31 | )
32 | */
33 | )
--------------------------------------------------------------------------------
/manager/app/src/main/java/me/weishu/kernelsu/ui/util/CompositionProvider.kt:
--------------------------------------------------------------------------------
1 | package me.weishu.kernelsu.ui.util
2 |
3 | import androidx.compose.material3.SnackbarHostState
4 | import androidx.compose.runtime.compositionLocalOf
5 |
6 | val LocalSnackbarHost = compositionLocalOf {
7 | error("CompositionLocal LocalSnackbarController not present")
8 | }
--------------------------------------------------------------------------------
/manager/app/src/main/java/me/weishu/kernelsu/ui/util/SELinuxChecker.kt:
--------------------------------------------------------------------------------
1 | package me.weishu.kernelsu.ui.util
2 |
3 | import androidx.compose.runtime.Composable
4 | import androidx.compose.ui.res.stringResource
5 | import com.topjohnwu.superuser.Shell
6 | import me.weishu.kernelsu.R
7 |
8 | @Composable
9 | fun getSELinuxStatus(): String {
10 | val shell = Shell.Builder.create()
11 | .setFlags(Shell.FLAG_REDIRECT_STDERR)
12 | .build("sh")
13 |
14 | val list = ArrayList()
15 | val result = shell.use {
16 | it.newJob().add("getenforce").to(list, list).exec()
17 | }
18 | val output = result.out.joinToString("\n").trim()
19 |
20 | if (result.isSuccess) {
21 | return when (output) {
22 | "Enforcing" -> stringResource(R.string.selinux_status_enforcing)
23 | "Permissive" -> stringResource(R.string.selinux_status_permissive)
24 | "Disabled" -> stringResource(R.string.selinux_status_disabled)
25 | else -> stringResource(R.string.selinux_status_unknown)
26 | }
27 | }
28 |
29 | return if (output.endsWith("Permission denied")) {
30 | stringResource(R.string.selinux_status_enforcing)
31 | } else {
32 | stringResource(R.string.selinux_status_unknown)
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/manager/app/src/main/java/me/weishu/kernelsu/ui/util/module/LatestVersionInfo.kt:
--------------------------------------------------------------------------------
1 | package me.weishu.kernelsu.ui.util.module
2 |
3 | data class LatestVersionInfo(
4 | val versionCode : Int = 0,
5 | val downloadUrl : String = "",
6 | val changelog : String = ""
7 | )
8 |
--------------------------------------------------------------------------------
/manager/app/src/main/jniLibs/.gitignore:
--------------------------------------------------------------------------------
1 | libksud.so
--------------------------------------------------------------------------------
/manager/app/src/main/jniLibs/arm64-v8a/libmagiskboot.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-sm8350/susfs4ksu/9e9b053f634894eddfe26501564dbef6aa0f3b65/manager/app/src/main/jniLibs/arm64-v8a/libmagiskboot.so
--------------------------------------------------------------------------------
/manager/app/src/main/res/drawable/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
11 |
15 |
18 |
21 |
22 |
--------------------------------------------------------------------------------
/manager/app/src/main/res/drawable/ic_launcher_monochrome.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
11 |
15 |
18 |
21 |
22 |
--------------------------------------------------------------------------------
/manager/app/src/main/res/mipmap-anydpi/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/manager/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-sm8350/susfs4ksu/9e9b053f634894eddfe26501564dbef6aa0f3b65/manager/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/manager/app/src/main/res/mipmap-ldpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-sm8350/susfs4ksu/9e9b053f634894eddfe26501564dbef6aa0f3b65/manager/app/src/main/res/mipmap-ldpi/ic_launcher.png
--------------------------------------------------------------------------------
/manager/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-sm8350/susfs4ksu/9e9b053f634894eddfe26501564dbef6aa0f3b65/manager/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/manager/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-sm8350/susfs4ksu/9e9b053f634894eddfe26501564dbef6aa0f3b65/manager/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/manager/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-sm8350/susfs4ksu/9e9b053f634894eddfe26501564dbef6aa0f3b65/manager/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/manager/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-sm8350/susfs4ksu/9e9b053f634894eddfe26501564dbef6aa0f3b65/manager/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/manager/app/src/main/res/resources.properties:
--------------------------------------------------------------------------------
1 | unqualifiedResLocale=en-US
--------------------------------------------------------------------------------
/manager/app/src/main/res/values-gl/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Inicio
4 |
--------------------------------------------------------------------------------
/manager/app/src/main/res/values-ms/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Tidak Diketahui
4 | Lumpuhkan
5 | Permisif
6 | Reboot ke Download
7 | Modul tidak berjaya diaktifkan: %s
8 | Reboot ke EDL
9 | Superusers: %d
10 | Modul: %d
11 | Enforcing
12 | Cap Jari
13 | Reboot ke Recovery
14 | Soft Reboot
15 | Padam
16 | Pasang
17 | Tekan untuk memasang
18 | Modul
19 | Tentang
20 | Versi: %d
21 | Reboot
22 | KernelSU ketika ini hanya menyokong kernel GKI
23 | Status SELinux
24 | Tidak Disokong
25 | Layar Utama
26 | Apakah anda pasti ingin membuang modul %s\?
27 | Superuser
28 | Tetapan
29 | Berjalan
30 | Gagal mematikan modul: %s
31 | Tiada modul dipasang
32 | Pasang
33 | Kernel
34 | Tidak terpasang
35 | Reboot ke Bootloader
36 | Versi manager
37 | Simpan Log
38 |
39 |
--------------------------------------------------------------------------------
/manager/app/src/main/res/values-night/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/manager/app/src/main/res/values-sr/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Superkorisnici
4 | Moduli: %d
5 | Додирните да бисте инсталирали
6 | Почетна
7 | Није инсталирано
8 | Верзија: %d
9 | Ради
10 | Сачувај Дневнике
11 |
--------------------------------------------------------------------------------
/manager/app/src/main/res/values-te/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | తెలియదు
4 | మాడ్యూల్ని ప్రారంభించడంలో విఫలమైంది: %s
5 | బలవంతంగా ఆపడం
6 | పునఃప్రారంభించండి
7 | మాడ్యూల్
8 | గురించి
9 | SELinux స్థితి
10 | హోమ్
11 | సూపర్యూజర్
12 | మాడ్యూల్ని నిలిపివేయడంలో విఫలమైంది: %s
13 | మాడ్యూల్ ఏదీ ఇన్స్టాల్ చేయబడలేదు
14 | ఇన్స్టాల్ చేయలేదు
15 | ఇన్స్టాల్ చేయడానికి క్లిక్ చేయండి
16 | పని చేస్తోంది
17 | వెర్షన్: %d
18 | సూపర్యూజర్లు: %d
19 | మాడ్యూల్స్: %d
20 | లాగ్లు సేవ్ చేయండి
21 |
22 |
--------------------------------------------------------------------------------
/manager/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #FFFFFFFF
4 |
--------------------------------------------------------------------------------
/manager/app/src/main/res/values/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
12 |
13 |
--------------------------------------------------------------------------------
/manager/app/src/main/res/xml/backup_rules.xml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
13 |
--------------------------------------------------------------------------------
/manager/app/src/main/res/xml/data_extraction_rules.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
12 |
13 |
19 |
--------------------------------------------------------------------------------
/manager/app/src/main/res/xml/filepaths.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/manager/app/src/main/res/xml/network_security_config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 127.0.0.1
5 | 0.0.0.0
6 | ::1
7 |
8 |
9 |
--------------------------------------------------------------------------------
/manager/gradle.properties:
--------------------------------------------------------------------------------
1 | android.experimental.enableNewResourceShrinker.preciseShrinking=true
2 | android.enableAppCompileTimeRClass=true
3 | android.useAndroidX=true
4 |
--------------------------------------------------------------------------------
/manager/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-sm8350/susfs4ksu/9e9b053f634894eddfe26501564dbef6aa0f3b65/manager/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/manager/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
4 | networkTimeout=10000
5 | validateDistributionUrl=true
6 | zipStoreBase=GRADLE_USER_HOME
7 | zipStorePath=wrapper/dists
8 |
--------------------------------------------------------------------------------
/manager/settings.gradle.kts:
--------------------------------------------------------------------------------
1 | @file:Suppress("UnstableApiUsage")
2 |
3 | enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
4 |
5 | pluginManagement {
6 | repositories {
7 | google()
8 | mavenCentral()
9 | }
10 | }
11 |
12 | dependencyResolutionManagement {
13 | repositories {
14 | google()
15 | mavenCentral()
16 | maven("https://jitpack.io")
17 | }
18 | }
19 |
20 | rootProject.name = "KernelSU"
21 | include(":app")
22 |
--------------------------------------------------------------------------------
/manager/sign.example.properties:
--------------------------------------------------------------------------------
1 | KEYSTORE_FILE=
2 | KEYSTORE_PASSWORD=
3 | KEY_ALIAS=
4 | KEY_PASSWORD=
5 |
--------------------------------------------------------------------------------
/scripts/abi_gki_all.py:
--------------------------------------------------------------------------------
1 | from xml.dom.minidom import parse
2 | import xml.dom.minidom
3 | import sys
4 |
5 |
6 | DOMTree = xml.dom.minidom.parse(sys.argv[1])
7 | symbols = DOMTree.getElementsByTagName("elf-symbol")
8 | print("[abi_symbol_list]")
9 | for symbol in symbols:
10 | print(" " + symbol.getAttribute("name"))
11 |
--------------------------------------------------------------------------------
/scripts/add_device_handler.py:
--------------------------------------------------------------------------------
1 | import json
2 | import sys
3 | import os
4 |
5 |
6 | def main():
7 | assert len(sys.argv) == 2
8 | file_name = sys.argv[1]
9 | github = "https://github.com/"
10 | issue_content = os.environ["ISSUE_CONTENT"]
11 | lines = issue_content.split("\n\n")
12 | assert len(lines) == 6
13 | url = lines[1]
14 | print(url)
15 | device = lines[3]
16 | print(device)
17 | code_of_conduct = lines[5]
18 | print(code_of_conduct)
19 | assert code_of_conduct.find("[X]") > 0
20 | tmp = url.removesuffix("/").replace(github, "").split("/")
21 | print(tmp)
22 | assert len(tmp) == 2
23 | maintainer = tmp[0]
24 | print(maintainer)
25 | maintainer_link = "%s%s" % (github, maintainer)
26 | print(maintainer_link)
27 | kernel_name = tmp[1]
28 | print(kernel_name)
29 | kernel_link = "%s%s/%s" % (github, maintainer, kernel_name)
30 | print(kernel_link)
31 | with open(file_name, "r") as f:
32 | data = json.loads(f.read())
33 | data.append(
34 | {
35 | "maintainer": maintainer,
36 | "maintainer_link": maintainer_link,
37 | "kernel_name": kernel_name,
38 | "kernel_link": kernel_link,
39 | "devices": device,
40 | }
41 | )
42 | os.remove(file_name)
43 | with open(file_name, "w") as f:
44 | f.write(json.dumps(data, indent=4))
45 | os.system("echo success=true >> $GITHUB_OUTPUT")
46 | os.system("echo device=%s >> $GITHUB_OUTPUT" % device)
47 |
48 |
49 | if __name__ == "__main__":
50 | main()
--------------------------------------------------------------------------------
/scripts/allowlist.bt:
--------------------------------------------------------------------------------
1 | // Define constants as per the provided structure.
2 | #define KSU_MAX_PACKAGE_NAME 256
3 | #define KSU_MAX_GROUPS 32
4 | #define KSU_SELINUX_DOMAIN 64
5 |
6 | // Define the root_profile structure with padding for 64-bit alignment.
7 | struct root_profile {
8 | uint32 uid;
9 | uint32 gid;
10 |
11 | uint32 groups_count;
12 | uint32 groups[KSU_MAX_GROUPS];
13 | char padding1[4]; // Padding for 64-bit alignment.
14 |
15 | struct {
16 | uint64 effective;
17 | uint64 permitted;
18 | uint64 inheritable;
19 | } capabilities;
20 |
21 | char selinux_domain[KSU_SELINUX_DOMAIN];
22 |
23 | uint32 namespaces;
24 | char padding2[4]; // Padding for 64-bit alignment.
25 | };
26 |
27 | // Define the non_root_profile structure with padding for 64-bit alignment.
28 | struct non_root_profile {
29 | byte umount_modules;
30 | char padding[7]; // Padding to make the total size a multiple of 8.
31 | };
32 |
33 | // Define the rp_config structure with padding for 64-bit alignment.
34 | struct rp_config_t {
35 | byte use_default;
36 |
37 | char template_name[KSU_MAX_PACKAGE_NAME];
38 | char padding[7]; // Padding to make the total size a multiple of 8.
39 |
40 | struct root_profile profile;
41 | };
42 |
43 | // Define the nrp_config structure with padding for 64-bit alignment.
44 | struct nrp_config_t {
45 | byte use_default;
46 | char padding1[7]; // Padding to make the total size a multiple of 8.
47 |
48 | struct non_root_profile profile;
49 | char padding2[488]; // Padding to align the union
50 | };
51 |
52 | // Define the main app_profile structure
53 | typedef struct {
54 | uint32 version;
55 | char key[KSU_MAX_PACKAGE_NAME];
56 | int32 current_uid;
57 | int64 allow_su;
58 |
59 | // Based on allow_su, decide which profile to use
60 | if (allow_su != 0) {
61 | rp_config_t rp_config;
62 | } else {
63 | nrp_config_t nrp_config;
64 | }
65 |
66 | } app_profile;
67 |
68 | // Define the file header with magic number and version
69 | typedef struct {
70 | uint32 magic;
71 | uint32 version;
72 | } file_header;
73 |
74 | // Main entry for parsing the file
75 | file_header header;
76 |
77 | if (header.magic != 0x7f4b5355) {
78 | Printf("Invalid file magic number.\n");
79 | return;
80 | }
81 |
82 | FSeek(8); // Skip the header
83 |
84 |
85 | // Continually read app_profile instances until end of file
86 | while (!FEof()) {
87 | app_profile profile;
88 | }
89 |
90 |
--------------------------------------------------------------------------------
/scripts/bin2c.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python3
2 |
3 | import argparse
4 | import os
5 | import re
6 |
7 | line_size = 80
8 |
9 |
10 | def bin2c(filename, varname='data'):
11 | if not os.path.isfile(filename):
12 | print('File "%s" is not found!' % filename)
13 | return ''
14 | if not re.match('[a-zA-Z_][a-zA-Z0-9_]*', varname):
15 | print('Invalid variable name "%s"' % varname)
16 | return
17 | with open(filename, 'rb') as in_file:
18 | data = in_file.read()
19 | # limit the line length
20 | byte_len = 6 # '0x00, '
21 | out = 'unsigned int %s_size = %d;\n' \
22 | 'const char %s[%d] = {\n' % (varname, len(data), varname, len(data))
23 | line = ''
24 | for byte in data:
25 | line += '0x%02x, ' % byte
26 | if len(line) + 4 + byte_len >= line_size:
27 | out += ' ' * 4 + line + '\n'
28 | line = ''
29 | # add the last line
30 | if len(line) + 4 + byte_len < line_size:
31 | out += ' ' * 4 + line + '\n'
32 | # strip the last comma
33 | out = out.rstrip(', \n') + '\n'
34 | out += '};'
35 | return out
36 |
37 |
38 | def main():
39 | """ Main func """
40 | parser = argparse.ArgumentParser()
41 | parser.add_argument(
42 | 'filename', help='filename to convert to C array')
43 | parser.add_argument(
44 | 'varname', nargs='?', help='variable name', default='data')
45 | args = parser.parse_args()
46 | # print out the data
47 | print(bin2c(args.filename, args.varname))
48 |
49 |
50 | if __name__ == '__main__':
51 | main()
52 |
--------------------------------------------------------------------------------
/userspace/ksud/.gitignore:
--------------------------------------------------------------------------------
1 | /target
2 | .cargo/
--------------------------------------------------------------------------------
/userspace/ksud/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "ksud"
3 | version = "0.1.0"
4 | edition = "2021"
5 |
6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
7 |
8 | [dependencies]
9 | anyhow = "1.0"
10 | clap = { version = "4.5", features = ["derive"] }
11 | const_format = "0.2"
12 | zip = { version = "2.2", default-features = false }
13 | zip-extensions = { version = "0.8", features = [
14 | "deflate",
15 | "deflate64",
16 | "time",
17 | "lzma",
18 | "xz",
19 | ], default-features = false }
20 | java-properties = { git = "https://github.com/Kernel-SU/java-properties.git", branch = "master", default-features = false }
21 | log = "0.4"
22 | env_logger = { version = "0.11", default-features = false }
23 | serde = { version = "1.0" }
24 | serde_json = "1.0"
25 | encoding_rs = "0.8"
26 | retry = "2.0"
27 | humansize = "2.1"
28 | libc = "0.2"
29 | extattr = "1.0"
30 | jwalk = "0.8"
31 | is_executable = "1.0"
32 | nom = "7.1"
33 | derive-new = "0.7"
34 | rust-embed = { version = "8.5", features = [
35 | "debug-embed",
36 | "compression", # must clean build after updating binaries
37 | ] }
38 | which = "7.0"
39 | getopts = "0.2"
40 | sha256 = "1"
41 | sha1 = "0.10"
42 | tempfile = "3.14"
43 | chrono = "0.4"
44 | hole-punch = { git = "https://github.com/tiann/hole-punch" }
45 | regex-lite = "0.1"
46 |
47 | [target.'cfg(any(target_os = "android", target_os = "linux"))'.dependencies]
48 | rustix = { git = "https://github.com/Kernel-SU/rustix.git", branch = "main", features = [
49 | "all-apis",
50 | ] }
51 | # some android specific dependencies which compiles under unix are also listed here for convenience of coding
52 | android-properties = { version = "0.2", features = ["bionic-deprecated"] }
53 | procfs = "0.17"
54 | loopdev = { git = "https://github.com/Kernel-SU/loopdev" }
55 |
56 | [target.'cfg(target_os = "android")'.dependencies]
57 | android_logger = { version = "0.14", default-features = false }
58 |
59 | [profile.release]
60 | strip = true
61 | opt-level = "z"
62 | lto = true
63 | codegen-units = 1
64 |
--------------------------------------------------------------------------------
/userspace/ksud/bin/.gitignore:
--------------------------------------------------------------------------------
1 | **/*.ko
--------------------------------------------------------------------------------
/userspace/ksud/bin/aarch64/bootctl:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-sm8350/susfs4ksu/9e9b053f634894eddfe26501564dbef6aa0f3b65/userspace/ksud/bin/aarch64/bootctl
--------------------------------------------------------------------------------
/userspace/ksud/bin/aarch64/busybox:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-sm8350/susfs4ksu/9e9b053f634894eddfe26501564dbef6aa0f3b65/userspace/ksud/bin/aarch64/busybox
--------------------------------------------------------------------------------
/userspace/ksud/bin/aarch64/ksuinit:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-sm8350/susfs4ksu/9e9b053f634894eddfe26501564dbef6aa0f3b65/userspace/ksud/bin/aarch64/ksuinit
--------------------------------------------------------------------------------
/userspace/ksud/bin/aarch64/resetprop:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-sm8350/susfs4ksu/9e9b053f634894eddfe26501564dbef6aa0f3b65/userspace/ksud/bin/aarch64/resetprop
--------------------------------------------------------------------------------
/userspace/ksud/bin/x86_64/busybox:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-sm8350/susfs4ksu/9e9b053f634894eddfe26501564dbef6aa0f3b65/userspace/ksud/bin/x86_64/busybox
--------------------------------------------------------------------------------
/userspace/ksud/bin/x86_64/ksuinit:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-sm8350/susfs4ksu/9e9b053f634894eddfe26501564dbef6aa0f3b65/userspace/ksud/bin/x86_64/ksuinit
--------------------------------------------------------------------------------
/userspace/ksud/bin/x86_64/resetprop:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-sm8350/susfs4ksu/9e9b053f634894eddfe26501564dbef6aa0f3b65/userspace/ksud/bin/x86_64/resetprop
--------------------------------------------------------------------------------
/userspace/ksud/build.rs:
--------------------------------------------------------------------------------
1 | use std::env;
2 | use std::fs::File;
3 | use std::io::Write;
4 | use std::path::Path;
5 | use std::process::Command;
6 |
7 | fn get_git_version() -> Result<(u32, String), std::io::Error> {
8 | let output = Command::new("git")
9 | .args(["rev-list", "--count", "HEAD"])
10 | .output()?;
11 |
12 | let output = output.stdout;
13 | let version_code = String::from_utf8(output).expect("Failed to read git count stdout");
14 | let version_code: u32 = version_code
15 | .trim()
16 | .parse()
17 | .map_err(|_| std::io::Error::new(std::io::ErrorKind::Other, "Failed to parse git count"))?;
18 | let version_code = 10000 + 200 + version_code; // For historical reasons
19 |
20 | let version_name = String::from_utf8(
21 | Command::new("git")
22 | .args(["describe", "--tags", "--always"])
23 | .output()?
24 | .stdout,
25 | )
26 | .map_err(|_| {
27 | std::io::Error::new(
28 | std::io::ErrorKind::Other,
29 | "Failed to read git describe stdout",
30 | )
31 | })?;
32 | let version_name = version_name.trim_start_matches('v').to_string();
33 | Ok((version_code, version_name))
34 | }
35 |
36 | fn main() {
37 | let (code, name) = match get_git_version() {
38 | Ok((code, name)) => (code, name),
39 | Err(_) => {
40 | // show warning if git is not installed
41 | println!("cargo:warning=Failed to get git version, using 0.0.0");
42 | (0, "0.0.0".to_string())
43 | }
44 | };
45 | let out_dir = env::var("OUT_DIR").expect("Failed to get $OUT_DIR");
46 | let out_dir = Path::new(&out_dir);
47 | File::create(Path::new(out_dir).join("VERSION_CODE"))
48 | .expect("Failed to create VERSION_CODE")
49 | .write_all(code.to_string().as_bytes())
50 | .expect("Failed to write VERSION_CODE");
51 |
52 | File::create(Path::new(out_dir).join("VERSION_NAME"))
53 | .expect("Failed to create VERSION_NAME")
54 | .write_all(name.trim().as_bytes())
55 | .expect("Failed to write VERSION_NAME");
56 | }
57 |
--------------------------------------------------------------------------------
/userspace/ksud/src/assets.rs:
--------------------------------------------------------------------------------
1 | use anyhow::Result;
2 | use const_format::concatcp;
3 | use rust_embed::RustEmbed;
4 | use std::path::Path;
5 |
6 | use crate::{defs::BINARY_DIR, utils};
7 |
8 | pub const RESETPROP_PATH: &str = concatcp!(BINARY_DIR, "resetprop");
9 | pub const BUSYBOX_PATH: &str = concatcp!(BINARY_DIR, "busybox");
10 | pub const BOOTCTL_PATH: &str = concatcp!(BINARY_DIR, "bootctl");
11 |
12 | #[cfg(all(target_arch = "x86_64", target_os = "android"))]
13 | #[derive(RustEmbed)]
14 | #[folder = "bin/x86_64"]
15 | struct Asset;
16 |
17 | // IF NOT x86_64 ANDROID, ie. macos, linux, windows, always use aarch64
18 | #[cfg(not(all(target_arch = "x86_64", target_os = "android")))]
19 | #[derive(RustEmbed)]
20 | #[folder = "bin/aarch64"]
21 | struct Asset;
22 |
23 | pub fn ensure_binaries(ignore_if_exist: bool) -> Result<()> {
24 | for file in Asset::iter() {
25 | if file == "ksuinit" || file.ends_with(".ko") {
26 | // don't extract ksuinit and kernel modules
27 | continue;
28 | }
29 | let asset = Asset::get(&file).ok_or(anyhow::anyhow!("asset not found: {}", file))?;
30 | utils::ensure_binary(format!("{BINARY_DIR}{file}"), &asset.data, ignore_if_exist)?
31 | }
32 | Ok(())
33 | }
34 |
35 | pub fn copy_assets_to_file(name: &str, dst: impl AsRef) -> Result<()> {
36 | let asset = Asset::get(name).ok_or(anyhow::anyhow!("asset not found: {}", name))?;
37 | std::fs::write(dst, asset.data)?;
38 | Ok(())
39 | }
40 |
41 | pub fn list_supported_kmi() -> Result> {
42 | let mut list = Vec::new();
43 | for file in Asset::iter() {
44 | // kmi_name = "xxx_kernelsu.ko"
45 | if let Some(kmi) = file.strip_suffix("_kernelsu.ko") {
46 | list.push(kmi.to_string());
47 | }
48 | }
49 | Ok(list)
50 | }
51 |
--------------------------------------------------------------------------------
/userspace/ksud/src/banner:
--------------------------------------------------------------------------------
1 | _ __ _ ____ _ _
2 | | |/ /___ _ __ _ __ ___| / ___|| | | |
3 | | ' // _ \ '__| '_ \ / _ \ \___ \| | | |
4 | | . \ __/ | | | | | __/ |___) | |_| |
5 | |_|\_\___|_| |_| |_|\___|_|____/ \___/
6 |
--------------------------------------------------------------------------------
/userspace/ksud/src/debug.rs:
--------------------------------------------------------------------------------
1 | use anyhow::{ensure, Context, Ok, Result};
2 | use std::{
3 | path::{Path, PathBuf},
4 | process::Command,
5 | };
6 |
7 | const KERNEL_PARAM_PATH: &str = "/sys/module/kernelsu";
8 |
9 | fn read_u32(path: &PathBuf) -> Result {
10 | let content = std::fs::read_to_string(path)?;
11 | let content = content.trim();
12 | let content = content.parse::()?;
13 | Ok(content)
14 | }
15 |
16 | fn set_kernel_param(uid: u32) -> Result<()> {
17 | let kernel_param_path = Path::new(KERNEL_PARAM_PATH).join("parameters");
18 |
19 | let ksu_debug_manager_uid = kernel_param_path.join("ksu_debug_manager_uid");
20 | let before_uid = read_u32(&ksu_debug_manager_uid)?;
21 | std::fs::write(&ksu_debug_manager_uid, uid.to_string())?;
22 | let after_uid = read_u32(&ksu_debug_manager_uid)?;
23 |
24 | println!("set manager uid: {before_uid} -> {after_uid}");
25 |
26 | Ok(())
27 | }
28 |
29 | #[cfg(target_os = "android")]
30 | fn get_pkg_uid(pkg: &str) -> Result {
31 | // stat /data/data/
32 | let uid = rustix::fs::stat(format!("/data/data/{pkg}"))
33 | .with_context(|| format!("stat /data/data/{}", pkg))?
34 | .st_uid;
35 | Ok(uid)
36 | }
37 |
38 | pub fn set_manager(pkg: &str) -> Result<()> {
39 | ensure!(
40 | Path::new(KERNEL_PARAM_PATH).exists(),
41 | "CONFIG_KSU_DEBUG is not enabled"
42 | );
43 |
44 | #[cfg(target_os = "android")]
45 | let uid = get_pkg_uid(pkg)?;
46 | #[cfg(not(target_os = "android"))]
47 | let uid = 0;
48 | set_kernel_param(uid)?;
49 | // force-stop it
50 | let _ = Command::new("am").args(["force-stop", pkg]).status();
51 | Ok(())
52 | }
53 |
--------------------------------------------------------------------------------
/userspace/ksud/src/defs.rs:
--------------------------------------------------------------------------------
1 | use const_format::concatcp;
2 |
3 | pub const ADB_DIR: &str = "/data/adb/";
4 | pub const WORKING_DIR: &str = concatcp!(ADB_DIR, "ksu/");
5 | pub const BINARY_DIR: &str = concatcp!(WORKING_DIR, "bin/");
6 | pub const LOG_DIR: &str = concatcp!(WORKING_DIR, "log/");
7 |
8 | pub const PROFILE_DIR: &str = concatcp!(WORKING_DIR, "profile/");
9 | pub const PROFILE_SELINUX_DIR: &str = concatcp!(PROFILE_DIR, "selinux/");
10 | pub const PROFILE_TEMPLATE_DIR: &str = concatcp!(PROFILE_DIR, "templates/");
11 |
12 | pub const KSURC_PATH: &str = concatcp!(WORKING_DIR, ".ksurc");
13 | pub const KSU_OVERLAY_SOURCE: &str = "KSU";
14 | pub const DAEMON_PATH: &str = concatcp!(ADB_DIR, "ksud");
15 | pub const MAGISKBOOT_PATH: &str = concatcp!(BINARY_DIR, "magiskboot");
16 |
17 | #[cfg(target_os = "android")]
18 | pub const DAEMON_LINK_PATH: &str = concatcp!(BINARY_DIR, "ksud");
19 |
20 | pub const MODULE_DIR: &str = concatcp!(ADB_DIR, "modules/");
21 | pub const MODULE_IMG: &str = concatcp!(WORKING_DIR, "modules.img");
22 | pub const MODULE_UPDATE_IMG: &str = concatcp!(WORKING_DIR, "modules_update.img");
23 |
24 | pub const MODULE_UPDATE_TMP_IMG: &str = concatcp!(WORKING_DIR, "update_tmp.img");
25 |
26 | // warning: this directory should not change, or you need to change the code in module_installer.sh!!!
27 | pub const MODULE_UPDATE_TMP_DIR: &str = concatcp!(ADB_DIR, "modules_update/");
28 |
29 | pub const SYSTEM_RW_DIR: &str = concatcp!(MODULE_DIR, ".rw/");
30 |
31 | pub const TEMP_DIR: &str = "/debug_ramdisk";
32 | pub const TEMP_DIR_LEGACY: &str = "/sbin";
33 |
34 | pub const MODULE_WEB_DIR: &str = "webroot";
35 | pub const MODULE_ACTION_SH: &str = "action.sh";
36 | pub const DISABLE_FILE_NAME: &str = "disable";
37 | pub const UPDATE_FILE_NAME: &str = "update";
38 | pub const REMOVE_FILE_NAME: &str = "remove";
39 | pub const SKIP_MOUNT_FILE_NAME: &str = "skip_mount";
40 |
41 | pub const VERSION_CODE: &str = include_str!(concat!(env!("OUT_DIR"), "/VERSION_CODE"));
42 | pub const VERSION_NAME: &str = include_str!(concat!(env!("OUT_DIR"), "/VERSION_NAME"));
43 |
44 | pub const KSU_BACKUP_DIR: &str = WORKING_DIR;
45 | pub const KSU_BACKUP_FILE_PREFIX: &str = "ksu_backup_";
46 | pub const BACKUP_FILENAME: &str = "stock_image.sha1";
47 |
--------------------------------------------------------------------------------
/userspace/ksud/src/ksucalls.rs:
--------------------------------------------------------------------------------
1 | const EVENT_POST_FS_DATA: u64 = 1;
2 | const EVENT_BOOT_COMPLETED: u64 = 2;
3 | const EVENT_MODULE_MOUNTED: u64 = 3;
4 |
5 | #[cfg(any(target_os = "linux", target_os = "android"))]
6 | pub fn get_version() -> i32 {
7 | rustix::process::ksu_get_version()
8 | }
9 |
10 | #[cfg(not(any(target_os = "linux", target_os = "android")))]
11 | pub fn get_version() -> i32 {
12 | 0
13 | }
14 |
15 | #[cfg(any(target_os = "linux", target_os = "android"))]
16 | fn report_event(event: u64) {
17 | rustix::process::ksu_report_event(event)
18 | }
19 |
20 | #[cfg(not(any(target_os = "linux", target_os = "android")))]
21 | fn report_event(_event: u64) {}
22 |
23 | #[cfg(any(target_os = "linux", target_os = "android"))]
24 | pub fn check_kernel_safemode() -> bool {
25 | rustix::process::ksu_check_kernel_safemode()
26 | }
27 |
28 | #[cfg(not(any(target_os = "linux", target_os = "android")))]
29 | pub fn check_kernel_safemode() -> bool {
30 | false
31 | }
32 |
33 | pub fn report_post_fs_data() {
34 | report_event(EVENT_POST_FS_DATA);
35 | }
36 |
37 | pub fn report_boot_complete() {
38 | report_event(EVENT_BOOT_COMPLETED);
39 | }
40 |
41 | pub fn report_module_mounted() {
42 | report_event(EVENT_MODULE_MOUNTED);
43 | }
44 |
--------------------------------------------------------------------------------
/userspace/ksud/src/main.rs:
--------------------------------------------------------------------------------
1 | mod apk_sign;
2 | mod assets;
3 | mod boot_patch;
4 | mod cli;
5 | mod debug;
6 | mod defs;
7 | mod init_event;
8 | mod ksucalls;
9 | mod module;
10 | mod mount;
11 | mod profile;
12 | mod restorecon;
13 | mod sepolicy;
14 | mod su;
15 | mod utils;
16 |
17 | fn main() -> anyhow::Result<()> {
18 | cli::run()
19 | }
20 |
--------------------------------------------------------------------------------
/userspace/su/.gitignore:
--------------------------------------------------------------------------------
1 | /obj
2 | /libs
3 |
--------------------------------------------------------------------------------
/userspace/su/jni/Android.mk:
--------------------------------------------------------------------------------
1 | LOCAL_PATH := $(call my-dir)
2 |
3 | include $(CLEAR_VARS)
4 | LOCAL_MODULE := su
5 | LOCAL_SRC_FILES := su.c
6 | include $(BUILD_EXECUTABLE)
7 |
--------------------------------------------------------------------------------
/userspace/su/jni/Application.mk:
--------------------------------------------------------------------------------
1 | APP_ABI := arm64-v8a x86_64
2 | APP_PLATFORM := android-24
3 | APP_STL := none
4 |
--------------------------------------------------------------------------------
/userspace/su/jni/su.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 |
5 | // This is a simple example. If you want a full-featured "su", please use "/data/adb/ksud debug su".
6 | int main(){
7 | int32_t result = 0;
8 | prctl(0xdeadbeef, 0, 0, 0, &result);
9 | system("/system/bin/sh");
10 | return 0;
11 | }
12 |
--------------------------------------------------------------------------------
/website/docs/.vitepress/config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig, SiteConfig } from 'vitepress'
2 | import locales from './locales'
3 | import { readdir, writeFile } from 'fs/promises'
4 | import { resolve } from 'path'
5 |
6 | export default defineConfig( {
7 | title: 'KernelSU',
8 | locales: locales.locales,
9 | head: [
10 | ['script', {
11 | async: 'async',
12 | src: 'https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-2610070972052494',
13 | crossorigin: 'anonymous',
14 | }],
15 | ],
16 | sitemap: {
17 | hostname: 'https://kernelsu.org'
18 | },
19 | buildEnd: async (config: SiteConfig) => {
20 | const templateDir = resolve(config.outDir, 'templates');
21 | const templateList = resolve(templateDir, "index.json");
22 | let files = [];
23 | try {
24 | files = await readdir(templateDir);
25 | files = files.filter(file => !file.startsWith('.'));
26 | } catch(e) {
27 | // ignore
28 | }
29 | await writeFile(templateList, JSON.stringify(files));
30 | }
31 | })
32 |
--------------------------------------------------------------------------------
/website/docs/.vitepress/locales/en.ts:
--------------------------------------------------------------------------------
1 | import { createRequire } from 'module'
2 | import { defineConfig } from 'vitepress'
3 |
4 | const require = createRequire(import.meta.url)
5 | const pkg = require('vitepress/package.json')
6 |
7 | export default defineConfig({
8 | lang: 'en-US',
9 | description: 'A kernel-based root solution for Android GKI devices.',
10 |
11 | themeConfig: {
12 | nav: nav(),
13 |
14 | lastUpdatedText: 'last Updated',
15 |
16 | sidebar: {
17 | '/guide/': sidebarGuide()
18 | },
19 |
20 | socialLinks: [
21 | { icon: 'github', link: 'https://github.com/tiann/KernelSU' }
22 | ],
23 |
24 | footer: {
25 | message: 'Released under the GPL3 License.',
26 | copyright: 'Copyright © 2022-present KernelSU Developers'
27 | },
28 |
29 | editLink: {
30 | pattern: 'https://github.com/tiann/KernelSU/edit/main/website/docs/:path',
31 | text: 'Edit this page on GitHub'
32 | }
33 | }
34 | })
35 |
36 | function nav() {
37 | return [
38 | { text: 'Guide', link: '/guide/what-is-kernelsu' },
39 | ]
40 | }
41 |
42 | function sidebarGuide() {
43 | return [
44 | {
45 | text: 'Guide',
46 | items: [
47 | { text: 'What is KernelSU?', link: '/guide/what-is-kernelsu' },
48 | { text: 'Difference with Magisk', link: '/guide/difference-with-magisk' },
49 | { text: 'Installation', link: '/guide/installation' },
50 | { text: 'How to build?', link: '/guide/how-to-build' },
51 | { text: 'Intergrate for non-GKI devices', link: '/guide/how-to-integrate-for-non-gki'},
52 | { text: 'Unofficially supported devices', link: '/guide/unofficially-support-devices.md' },
53 | { text: 'Module guide', link: '/guide/module.md' },
54 | { text: 'Module WebUI', link: '/guide/module-webui.md' },
55 | { text: 'App Profile', link: '/guide/app-profile.md' },
56 | { text: 'Rescue from bootloop', link: '/guide/rescue-from-bootloop.md' },
57 | { text: 'FAQ', link: '/guide/faq' },
58 | { text: 'Hidden features', link: '/guide/hidden-features' },
59 | ]
60 | }
61 | ]
62 | }
63 |
--------------------------------------------------------------------------------
/website/docs/.vitepress/locales/id_ID.ts:
--------------------------------------------------------------------------------
1 | import { createRequire } from 'module'
2 | import { defineConfig } from 'vitepress'
3 |
4 | const require = createRequire(import.meta.url)
5 | const pkg = require('vitepress/package.json')
6 |
7 | export default defineConfig({
8 | lang: 'id-ID',
9 | description: 'Solusi root kernel-based untuk perangkat Android GKI.',
10 |
11 | themeConfig: {
12 | nav: nav(),
13 |
14 | lastUpdatedText: 'Update Terakhir',
15 |
16 | sidebar: {
17 | '/id_ID/guide/': sidebarGuide()
18 | },
19 |
20 | socialLinks: [
21 | { icon: 'github', link: 'https://github.com/tiann/KernelSU' }
22 | ],
23 |
24 | footer: {
25 | message: 'Rilis Dibawah Lisensi GPL3.',
26 | copyright: 'Copyright © 2022-Sekarang pengembang KernelSU '
27 | },
28 |
29 | editLink: {
30 | pattern: 'https://github.com/tiann/KernelSU/edit/main/website/docs/:path',
31 | text: 'Edit Halaman ini di GitHub'
32 | }
33 | }
34 | })
35 |
36 | function nav() {
37 | return [
38 | { text: 'Petunjuk', link: '/id_ID/guide/what-is-kernelsu' },
39 | ]
40 | }
41 |
42 | function sidebarGuide() {
43 | return [
44 | {
45 | text: 'Petunjuk',
46 | items: [
47 | { text: 'Apa itu KernelSU?', link: '/id_ID/guide/what-is-kernelsu' },
48 | { text: 'Instalasi', link: '/id_ID/guide/installation' },
49 | { text: 'Bagaimana cara buildnya?', link: '/id_ID/guide/how-to-build' },
50 | { text: 'Integrasi untuk perangkat non-GKI', link: '/id_ID/guide/how-to-integrate-for-non-gki'},
51 | { text: 'Perangkat yang didukung secara tidak resmi', link: '/id_ID/guide/unofficially-support-devices.md' },
52 | { text: 'Petunjuk module', link: '/id_ID/guide/module.md' },
53 | { text: 'Antisipasi dari bootloop', link: '/id_ID/guide/rescue-from-bootloop.md' },
54 | { text: 'FAQ', link: '/id_ID/guide/faq' },
55 | ]
56 | }
57 | ]
58 | }
59 |
--------------------------------------------------------------------------------
/website/docs/.vitepress/locales/index.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vitepress'
2 | import en from './en'
3 | import zh_CN from './zh_CN'
4 | import zh_TW from './zh_TW'
5 | import vi_VN from './vi_VN'
6 | import id_ID from './id_ID'
7 | import ja_JP from './ja_JP'
8 | import ru_RU from './ru_RU'
9 | import pt_BR from './pt_BR'
10 |
11 | export default defineConfig({
12 | locales: {
13 | root: {
14 | label: 'English',
15 | lang: en.lang,
16 | themeConfig: en.themeConfig,
17 | description: en.description
18 | },
19 | zh_CN: {
20 | label: '简体中文',
21 | lang: zh_CN.lang,
22 | themeConfig: zh_CN.themeConfig,
23 | description: zh_CN.description
24 | },
25 | zh_TW: {
26 | label: '繁體中文',
27 | lang: zh_TW.lang,
28 | themeConfig: zh_TW.themeConfig,
29 | description: zh_TW.description
30 | },
31 | ja_JP: {
32 | label: '日本語',
33 | lang: ja_JP.lang,
34 | themeConfig: ja_JP.themeConfig,
35 | description: ja_JP.description
36 | },
37 | vi_VN: {
38 | label: 'Tiếng Việt',
39 | lang: vi_VN.lang,
40 | themeConfig: vi_VN.themeConfig,
41 | description: vi_VN.description
42 | },
43 | id_ID: {
44 | label: 'Bahasa',
45 | lang: id_ID.lang,
46 | themeConfig: id_ID.themeConfig,
47 | description: id_ID.description
48 | },
49 | ru_RU: {
50 | label: 'Русский',
51 | lang: ru_RU.lang,
52 | themeConfig: ru_RU.themeConfig,
53 | description: ru_RU.description
54 | },
55 | pt_BR: {
56 | label: 'Português (Brasil)',
57 | lang: pt_BR.lang,
58 | themeConfig: pt_BR.themeConfig,
59 | description: pt_BR.description
60 | }
61 | }
62 | })
63 |
--------------------------------------------------------------------------------
/website/docs/.vitepress/locales/ja_JP.ts:
--------------------------------------------------------------------------------
1 | import { createRequire } from 'module'
2 | import { defineConfig } from 'vitepress'
3 |
4 | const require = createRequire(import.meta.url)
5 | const pkg = require('vitepress/package.json')
6 |
7 | export default defineConfig({
8 | lang: 'ja-JP',
9 | description: 'Android GKI デバイス向けのカーネルベースの root ソリューション',
10 |
11 | themeConfig: {
12 | nav: nav(),
13 |
14 | lastUpdatedText: '最終更新',
15 |
16 | sidebar: {
17 | '/ja_JP/guide/': sidebarGuide()
18 | },
19 |
20 | socialLinks: [
21 | { icon: 'github', link: 'https://github.com/tiann/KernelSU' }
22 | ],
23 |
24 | footer: {
25 | message: 'GPL3 ライセンスでリリースされています。',
26 | copyright: 'Copyright © 2022-現在 KernelSU 開発者'
27 | },
28 |
29 | editLink: {
30 | pattern: 'https://github.com/tiann/KernelSU/edit/main/website/docs/:path',
31 | text: 'GitHub でこのページを編集'
32 | }
33 | }
34 | })
35 |
36 | function nav() {
37 | return [
38 | { text: 'ガイド', link: '/ja_JP/guide/what-is-kernelsu' },
39 | ]
40 | }
41 |
42 | function sidebarGuide() {
43 | return [
44 | {
45 | text: 'ガイド',
46 | items: [
47 | { text: 'KernelSU とは?', link: '/ja_JP/guide/what-is-kernelsu' },
48 | { text: 'インストール', link: '/ja_JP/guide/installation' },
49 | { text: 'ビルドするには?', link: '/ja_JP/guide/how-to-build' },
50 | { text: '非 GKI デバイスでの実装', link: '/ja_JP/guide/how-to-integrate-for-non-gki' },
51 | { text: '非公式の対応デバイス', link: '/ja_JP/guide/unofficially-support-devices.md' },
52 | { text: 'モジュールのガイド', link: '/ja_JP/guide/module.md' },
53 | { text: 'ブートループからの復旧', link: '/ja_JP/guide/rescue-from-bootloop.md' },
54 | { text: 'よくある質問', link: '/ja_JP/guide/faq' },
55 | { text: '隠し機能', link: '/ja_JP/guide/hidden-features' },
56 | ]
57 | }
58 | ]
59 | }
60 |
--------------------------------------------------------------------------------
/website/docs/.vitepress/locales/pt_BR.ts:
--------------------------------------------------------------------------------
1 | import { createRequire } from 'module'
2 | import { defineConfig } from 'vitepress'
3 |
4 | const require = createRequire(import.meta.url)
5 | const pkg = require('vitepress/package.json')
6 |
7 | export default defineConfig({
8 | lang: 'pt-BR',
9 | description: 'Uma solução root baseada em kernel para dispositivos Android GKI.',
10 |
11 | themeConfig: {
12 | nav: nav(),
13 |
14 | lastUpdatedText: 'Última atualização',
15 |
16 | sidebar: {
17 | '/pt_BR/guide/': sidebarGuide()
18 | },
19 |
20 | socialLinks: [
21 | { icon: 'github', link: 'https://github.com/tiann/KernelSU' }
22 | ],
23 |
24 | footer: {
25 | message: 'Lançado sob a Licença GPL3',
26 | copyright: 'Copyright © Desenvolvedores do KernelSU atuais de 2022'
27 | },
28 |
29 | editLink: {
30 | pattern: 'https://github.com/tiann/KernelSU/edit/main/website/docs/:path',
31 | text: 'Edite esta página no GitHub'
32 | }
33 | }
34 | })
35 |
36 | function nav() {
37 | return [
38 | { text: 'Guia', link: '/pt_BR/guide/what-is-kernelsu' },
39 | ]
40 | }
41 |
42 | function sidebarGuide() {
43 | return [
44 | {
45 | text: 'Guia',
46 | items: [
47 | { text: 'O que é KernelSU?', link: '/pt_BR/guide/what-is-kernelsu' },
48 | { text: 'Diferenças com Magisk', link: '/pt_BR/guide/difference-with-magisk' },
49 | { text: 'Instalação', link: '/pt_BR/guide/installation' },
50 | { text: 'Como compilar?', link: '/pt_BR/guide/how-to-build' },
51 | { text: 'Integração para dispositivos não GKI', link: '/pt_BR/guide/how-to-integrate-for-non-gki'},
52 | { text: 'Dispositivos com suporte não oficial', link: '/pt_BR/guide/unofficially-support-devices.md' },
53 | { text: 'Guias de módulo', link: '/pt_BR/guide/module.md' },
54 | { text: 'Módulo WebUI', link: '/pt_BR/guide/module-webui.md' },
55 | { text: 'Perfil do Aplicativo', link: '/pt_BR/guide/app-profile.md' },
56 | { text: 'Resgate do bootloop', link: '/pt_BR/guide/rescue-from-bootloop.md' },
57 | { text: 'Perguntas frequentes', link: '/pt_BR/guide/faq' },
58 | { text: 'Recursos ocultos', link: '/pt_BR/guide/hidden-features' },
59 | ]
60 | }
61 | ]
62 | }
63 |
--------------------------------------------------------------------------------
/website/docs/.vitepress/locales/ru_RU.ts:
--------------------------------------------------------------------------------
1 | import { createRequire } from 'module'
2 | import { defineConfig } from 'vitepress'
3 |
4 | const require = createRequire(import.meta.url)
5 | const pkg = require('vitepress/package.json')
6 |
7 | export default defineConfig({
8 | lang: 'ru-RU',
9 | description: 'Решение на основе ядра root для устройств Android GKI.',
10 |
11 | themeConfig: {
12 | nav: nav(),
13 |
14 | lastUpdatedText: 'последнее обновление',
15 |
16 | sidebar: {
17 | '/ru_RU/guide/': sidebarGuide()
18 | },
19 |
20 | socialLinks: [
21 | { icon: 'github', link: 'https://github.com/tiann/KernelSU' }
22 | ],
23 |
24 | footer: {
25 | message: 'Выпускается под лицензией GPL3.',
26 | copyright: 'Авторские права © 2022-текущее Разработчики KernelSU'
27 | },
28 |
29 | editLink: {
30 | pattern: 'https://github.com/tiann/KernelSU/edit/main/website/docs/:path',
31 | text: 'Редактировать эту страницу на GitHub'
32 | }
33 | }
34 | })
35 |
36 | function nav() {
37 | return [
38 | { text: 'Руководство', link: '/ru_RU/guide/what-is-kernelsu' },
39 | ]
40 | }
41 |
42 | function sidebarGuide() {
43 | return [
44 | {
45 | text: 'Руководство',
46 | items: [
47 | { text: 'Что такое KernelSU?', link: '/ru_RU/guide/what-is-kernelsu' },
48 | { text: 'Установка', link: '/ru_RU/guide/installation' },
49 | { text: 'Как собрать?', link: '/ru_RU/guide/how-to-build' },
50 | { text: 'Реализация в устройствах, не относящихся к GKI', link: '/ru_RU/guide/how-to-integrate-for-non-gki'},
51 | { text: 'Неофициально поддерживаемые устройства', link: '/ru_RU/guide/unofficially-support-devices.md' },
52 | { text: 'Руководство по разработке модулей', link: '/ru_RU/guide/module.md' },
53 | { text: 'Профиль приложений', link: '/ru_RU/guide/app-profile.md' },
54 | { text: 'Выход из циклической загрузки', link: '/ru_RU/guide/rescue-from-bootloop.md' },
55 | { text: 'FAQ', link: '/ru_RU/guide/faq' },
56 | { text: 'Скрытые возможности', link: '/ru_RU/guide/hidden-features' },
57 | ]
58 | }
59 | ]
60 | }
61 |
--------------------------------------------------------------------------------
/website/docs/.vitepress/locales/vi_VN.ts:
--------------------------------------------------------------------------------
1 | import { createRequire } from 'module'
2 | import { defineConfig } from 'vitepress'
3 |
4 | const require = createRequire(import.meta.url)
5 | const pkg = require('vitepress/package.json')
6 |
7 | export default defineConfig({
8 | lang: 'vi-VN',
9 | description: 'Một giải pháp root trực tiếp trên kernel dành cho các thiết bị hỗ trợ GKI.',
10 |
11 | themeConfig: {
12 | nav: nav(),
13 |
14 | lastUpdatedText: 'cập nhật lần cuối',
15 |
16 | sidebar: {
17 | '/vi_VN/guide/': sidebarGuide()
18 | },
19 |
20 | socialLinks: [
21 | { icon: 'github', link: 'https://github.com/tiann/KernelSU' }
22 | ],
23 |
24 | footer: {
25 | message: 'Phát hành dưới giấy phép GPL3.',
26 | copyright: 'Bản Quyền © 2022-nay KernelSU Developers'
27 | },
28 |
29 | editLink: {
30 | pattern: 'https://github.com/tiann/KernelSU/edit/main/website/docs/:path',
31 | text: 'Chỉnh sửa trang này trên GitHub'
32 | }
33 | }
34 | })
35 |
36 | function nav() {
37 | return [
38 | { text: 'Hướng Dẫn', link: '/vi_VN/guide/what-is-kernelsu' },
39 | ]
40 | }
41 |
42 | function sidebarGuide() {
43 | return [
44 | {
45 | text: 'Hướng Dẫn',
46 | items: [
47 | { text: 'KernelSU là gì?', link: '/vi_VN/guide/what-is-kernelsu' },
48 | { text: 'Cách cài đặt', link: '/vi_VN/guide/installation' },
49 | { text: 'Cách để build?', link: '/vi_VN/guide/how-to-build' },
50 | { text: 'Tích hợp vào thiết bị không sử dụng GKI', link: '/vi_VN/guide/how-to-integrate-for-non-gki'},
51 | { text: 'Thiết bị hỗ trợ không chính thức', link: '/vi_VN/guide/unofficially-support-devices.md' },
52 | { text: 'FAQ - Câu hỏi thường gặp', link: '/vi_VN/guide/faq' },
53 | ]
54 | }
55 | ]
56 | }
57 |
--------------------------------------------------------------------------------
/website/docs/.vitepress/locales/zh_CN.ts:
--------------------------------------------------------------------------------
1 | import { createRequire } from 'module'
2 | import { defineConfig } from 'vitepress'
3 |
4 | const require = createRequire(import.meta.url)
5 | const pkg = require('vitepress/package.json')
6 |
7 | export default defineConfig({
8 | lang: 'zh-CN',
9 | description: '一个基于内核,为安卓 GKI 准备的 root 方案。',
10 |
11 | themeConfig: {
12 | nav: nav(),
13 |
14 | lastUpdatedText: '最后更新',
15 |
16 | sidebar: {
17 | '/zh_CN/guide/': sidebarGuide()
18 | },
19 |
20 | socialLinks: [
21 | { icon: 'github', link: 'https://github.com/tiann/KernelSU' }
22 | ],
23 |
24 | footer: {
25 | message: '在 GPL3 许可证下发布。',
26 | copyright: 'Copyright © 2022-现在 KernelSU 开发者'
27 | },
28 |
29 | editLink: {
30 | pattern: 'https://github.com/tiann/KernelSU/edit/main/website/docs/:path',
31 | text: '在 GitHub 中编辑本页'
32 | }
33 | }
34 | })
35 |
36 | function nav() {
37 | return [
38 | { text: '指南', link: '/zh_CN/guide/what-is-kernelsu' },
39 | ]
40 | }
41 |
42 | function sidebarGuide() {
43 | return [
44 | {
45 | text: 'Guide',
46 | items: [
47 | { text: '什么是 KernelSU?', link: '/zh_CN/guide/what-is-kernelsu' },
48 | { text: 'KernelSU 模块与 Magisk 的差异', link: '/zh_CN/guide/difference-with-magisk' },
49 | { text: '安装', link: '/zh_CN/guide/installation' },
50 | { text: '如何构建?', link: '/zh_CN/guide/how-to-build' },
51 | { text: '如何为非 GKI 设备集成 KernelSU', link: '/zh_CN/guide/how-to-integrate-for-non-gki'},
52 | { text: '非官方支持设备', link: '/zh_CN/guide/unofficially-support-devices.md' },
53 | { text: '模块开发指南', link: '/zh_CN/guide/module.md' },
54 | { text: '模块 Web 界面', link: '/zh_CN/guide/module-webui.md' },
55 | { text: 'App Profile', link: '/zh_CN/guide/app-profile.md' },
56 | { text: '救砖', link: '/zh_CN/guide/rescue-from-bootloop.md' },
57 | { text: '常见问题', link: '/zh_CN/guide/faq' },
58 | { text: '隐藏功能', link: '/zh_CN/guide/hidden-features' },
59 | ]
60 | }
61 | ]
62 | }
63 |
--------------------------------------------------------------------------------
/website/docs/.vitepress/locales/zh_TW.ts:
--------------------------------------------------------------------------------
1 | import { createRequire } from 'module'
2 | import { defineConfig } from 'vitepress'
3 |
4 | const require = createRequire(import.meta.url)
5 | const pkg = require('vitepress/package.json')
6 |
7 | export default defineConfig({
8 | lang: 'zh-TW',
9 | description: '一個基於核心,適用於 Android GKI 的 Root 解決方案。',
10 |
11 | themeConfig: {
12 | nav: nav(),
13 |
14 | lastUpdatedText: '上次更新',
15 |
16 | sidebar: {
17 | '/zh_TW/guide/': sidebarGuide()
18 | },
19 |
20 | socialLinks: [
21 | { icon: 'github', link: 'https://github.com/tiann/KernelSU' }
22 | ],
23 |
24 | footer: {
25 | message: '係依據 GPL3 授權發行。',
26 | copyright: 'Copyright © 2022-目前 KernelSU 開發人員'
27 | },
28 |
29 | editLink: {
30 | pattern: 'https://github.com/tiann/KernelSU/edit/main/website/docs/:path',
31 | text: '在 GitHub 中編輯本頁面'
32 | }
33 | }
34 | })
35 |
36 | function nav() {
37 | return [
38 | { text: '指南', link: '/zh_TW/guide/what-is-kernelsu' },
39 | ]
40 | }
41 |
42 | function sidebarGuide() {
43 | return [
44 | {
45 | text: 'Guide',
46 | items: [
47 | { text: '什麼是 KernelSU?', link: '/zh_TW/guide/what-is-kernelsu' },
48 | { text: 'KernelSU 與 Magisk 的差異', link: '/zh_TW/guide/difference-with-magisk' },
49 | { text: '安裝', link: '/zh_TW/guide/installation' },
50 | { text: '如何建置?', link: '/zh_TW/guide/how-to-build' },
51 | { text: '如何為非 GKI 核心整合 KernelSU', link: '/zh_TW/guide/how-to-integrate-for-non-gki'},
52 | { text: '非官方支援裝置', link: '/zh_TW/guide/unofficially-support-devices.md' },
53 | { text: '模組指南', link: '/zh_TW/guide/module.md' },
54 | { text: '模組 WebUI', link: '/zh_TW/guide/module-webui.md' },
55 | { text: 'App Profile', link: '/zh_TW/guide/app-profile.md' },
56 | { text: '搶救開機迴圈', link: '/zh_TW/guide/rescue-from-bootloop.md' },
57 | { text: '常見問題', link: '/zh_TW/guide/faq' },
58 | { text: '隱藏功能', link: '/zh_TW/guide/hidden-features' },
59 | ]
60 | }
61 | ]
62 | }
63 |
--------------------------------------------------------------------------------
/website/docs/guide/difference-with-magisk.md:
--------------------------------------------------------------------------------
1 | # Difference with Magisk
2 |
3 | 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.
4 |
5 | ## Similarities
6 |
7 | - Module file format: both use zip format to organize modules, and the format of modules is almost the same.
8 | - Module installation directory: both located in `/data/adb/modules`.
9 | - Systemless: both support modifying `/system` in a systemless way through modules.
10 | - post-fs-data.sh: the execution time and semantics are exactly the same.
11 | - service.sh: the execution time and semantics are exactly the same.
12 | - system.prop: completely the same.
13 | - sepolicy.rule: completely the same.
14 | - BusyBox: scripts are run in BusyBox with "Standalone Mode" enabled in both cases.
15 |
16 | ## Differences
17 |
18 | 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`.
19 |
20 | Here are some differences:
21 |
22 | - KernelSU modules cannot be installed in Recovery mode.
23 | - KernelSU modules do not have built-in support for Zygisk (but you can use Zygisk modules through [ZygiskNext](https://github.com/Dr-TSNG/ZygiskNext)).
24 | - 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.
25 | - 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!**
26 | - KernelSU does not support `.replace` files; however, KernelSU supports the `REMOVE` and `REPLACE` variable to remove or replace files and folders.
27 | - KernelSU adds `boot-completed` stage to run some scripts on boot completed.
28 | - KernelSU adds `post-mount` stage to run some scripts after mounting OverlayFS.
29 |
--------------------------------------------------------------------------------
/website/docs/guide/hidden-features.md:
--------------------------------------------------------------------------------
1 | # Hidden features
2 |
3 | ## .ksurc
4 |
5 | By default, `/system/bin/sh` loads `/system/etc/mkshrc`.
6 |
7 | You can make su load customized rc file by creating a `/data/adb/ksu/.ksurc` file.
8 |
--------------------------------------------------------------------------------
/website/docs/guide/how-to-build.md:
--------------------------------------------------------------------------------
1 | # How to build KernelSU?
2 |
3 | First, you should read the Android Official docs for kernel build:
4 |
5 | 1. [Build kernels](https://source.android.com/docs/setup/build/building-kernels)
6 | 2. [GKI release builds](https://source.android.com/docs/core/architecture/kernel/gki-release-builds)
7 |
8 | ::: warning
9 | 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).
10 | :::
11 |
12 | ## Build kernel
13 |
14 | ### Sync the kernel source code
15 |
16 | ```sh
17 | repo init -u https://android.googlesource.com/kernel/manifest
18 | mv .repo/manifests
19 | repo init -m manifest.xml
20 | repo sync
21 | ```
22 |
23 | The `` 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).
24 |
25 | ### Build
26 |
27 | Please check the [official docs](https://source.android.com/docs/setup/build/building-kernels) first.
28 |
29 | For example, to build an `aarch64` kernel image:
30 |
31 | ```sh
32 | LTO=thin BUILD_CONFIG=common/build.config.gki.aarch64 build/build.sh
33 | ```
34 |
35 | Don't forget to add the `LTO=thin` flag, otherwise the build may fail if your computer's memory is less then 24 GB.
36 |
37 | Starting from Android 13, the kernel is built by `bazel`:
38 |
39 | ```sh
40 | tools/bazel build --config=fast //common:kernel_aarch64_dist
41 | ```
42 |
43 | :::info
44 | For some of the Android 14 kernels, to make Wi-Fi/Bluetooth work, it might be necessary to remove all the GKI protected exports:
45 |
46 | ```sh
47 | rm common/android/abi_gki_protected_exports_*
48 | ```
49 | :::
50 |
51 | ## Build Kernel with KernelSU
52 |
53 | 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:
54 |
55 | ::: code-group
56 |
57 | ```sh[Latest tag(stable)]
58 | curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash -
59 | ```
60 |
61 | ```sh[ main branch(dev)]
62 | curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash -s main
63 | ```
64 |
65 | ```sh[Select tag(Such as v0.5.2)]
66 | curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash -s v0.5.2
67 | ```
68 |
69 | :::
70 |
71 | And then rebuild the kernel and you will get a kernel image with KernelSU!
72 |
--------------------------------------------------------------------------------
/website/docs/guide/module-webui.md:
--------------------------------------------------------------------------------
1 | # Module WebUI
2 |
3 | In addition to executing boot scripts and modifying system files, KernelSU's modules also support displaying UI interfaces and interacting with users.
4 |
5 | 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.
6 |
7 | ## `webroot` directory
8 |
9 | Web resource files should be placed in the `webroot` subdirectory of the module root directory, and there **MUST** be a file named `index.html`, which is the module page entry. The simplest module structure containing a web interface is as follows:
10 |
11 | ```txt
12 | ❯ tree .
13 | .
14 | |-- module.prop
15 | `-- webroot
16 | `-- index.html
17 | ```
18 |
19 | :::warning
20 | 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!
21 | :::
22 |
23 | If your page contains CSS and JavaScript, you need to place it in this directory as well.
24 |
25 | ## JavaScript API
26 |
27 | 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.
28 |
29 | 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.
30 |
31 | For example, you can execute a shell command to obtain a specific configuration or modify a property:
32 |
33 | ```JavaScript
34 | import { exec } from 'kernelsu';
35 |
36 | const { errno, stdout } = exec("getprop ro.product.model");
37 | ```
38 |
39 | For another example, you can make the web page display full screen, or display a toast.
40 |
41 | [API documentation](https://www.npmjs.com/package/kernelsu).
42 |
43 | 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)!
44 |
45 | ## Some tips
46 |
47 | 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.
48 | 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!
49 |
--------------------------------------------------------------------------------
/website/docs/guide/unofficially-support-devices.md:
--------------------------------------------------------------------------------
1 | # Unofficially Supported Devices
2 |
3 | ::: warning
4 | In this page, there are kernels for non-GKI devices supporting KernelSU maintained by other developers.
5 | :::
6 |
7 | ::: warning
8 | 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.
9 | :::
10 |
11 |
14 |
15 |
--------------------------------------------------------------------------------
/website/docs/guide/what-is-kernelsu.md:
--------------------------------------------------------------------------------
1 | # What is KernelSU?
2 |
3 | KernelSU is a root solution for Android GKI devices, it works in kernel mode and grants root permission to userspace apps directly in kernel space.
4 |
5 | ## Features
6 |
7 | 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.
8 |
9 | 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.
10 |
11 | ## How to use?
12 |
13 | Please refer: [Installation](installation)
14 |
15 | ## How to build?
16 |
17 | Please refer: [How to build](how-to-build)
18 |
19 | ## Discussion
20 |
21 | - Telegram: [@KernelSU](https://t.me/KernelSU)
22 |
--------------------------------------------------------------------------------
/website/docs/id_ID/guide/difference-with-magisk.md:
--------------------------------------------------------------------------------
1 | # Perbedaan dengan Magisk
2 |
3 | Meskipun ada banyak kesamaan antara modul KernelSU dan modul Magisk, pasti ada beberapa perbedaan karena mekanisme implementasinya yang sangat berbeda. Jika Anda ingin modul Anda berjalan di Magisk dan KernelSU, Anda harus memahami perbedaan ini.
4 |
5 | ## Kesamaan
6 |
7 | - Format file modul: keduanya menggunakan format zip untuk mengatur modul, dan format modulnya hampir sama
8 | - Direktori pemasangan modul: keduanya terletak di `/data/adb/modules`
9 | - Tanpa sistem: keduanya mendukung modifikasi / sistem dengan cara tanpa sistem melalui modul
10 | - post-fs-data.sh: waktu eksekusi dan semantiknya persis sama
11 | - service.sh: waktu eksekusi dan semantiknya persis sama
12 | - system.prop: sepenuhnya sama
13 | - sepolicy.rule: sama persis
14 | - BusyBox: skrip dijalankan di BusyBox dengan "mode mandiri" diaktifkan di kedua kasus
15 |
16 | ## Perbedaan
17 |
18 | Sebelum memahami perbedaannya, Anda perlu mengetahui cara membedakan apakah modul Anda berjalan di KernelSU atau Magisk. Anda dapat menggunakan variabel lingkungan `KSU` untuk membedakannya di semua tempat di mana Anda dapat menjalankan skrip modul (`customize.sh`, `post-fs-data.sh`, `service.sh`). Di KernelSU, variabel lingkungan ini akan disetel ke `true`.
19 |
20 | Berikut beberapa perbedaannya:
21 |
22 | - Modul KernelSU tidak dapat diinstal dalam mode Pemulihan.
23 | - Modul KernelSU tidak memiliki dukungan bawaan untuk Zygisk (tetapi Anda dapat menggunakan modul Zygisk melalui [ZygiskNext](https://github.com/Dr-TSNG/ZygiskNext).
24 | - Metode untuk mengganti atau menghapus file dalam modul KernelSU sama sekali berbeda dari Magisk. KernelSU tidak mendukung metode `.replace`. Sebagai gantinya, Anda perlu membuat file dengan nama yang sama dengan `mknod filename c 0 0` untuk menghapus file terkait.
25 | - Direktori untuk BusyBox berbeda. BusyBox bawaan di KernelSU terletak di `/data/adb/ksu/bin/busybox`, sedangkan di Magisk terletak di `/data/adb/magisk/busybox`. **Perhatikan bahwa ini adalah perilaku internal KernelSU dan dapat berubah di masa mendatang!**
26 | - KernelSU tidak mendukung file `.replace`; namun, KernelSU mendukung variabel `REMOVE` dan `REPLACE` untuk menghapus atau mengganti file dan folder.
27 |
--------------------------------------------------------------------------------
/website/docs/id_ID/guide/how-to-build.md:
--------------------------------------------------------------------------------
1 | # Bagaimana caranya untuk build KernelSU?
2 |
3 | Pertama, Anda harus membaca dokumen resmi Android untuk membangun kernel:
4 |
5 | 1. [Building Kernels](https://source.android.com/docs/setup/build/building-kernels)
6 | 2. [GKI Release Builds](https://source.android.com/docs/core/architecture/kernel/gki-release-builds)
7 |
8 | > Halaman ini untuk perangkat GKI, jika Anda menggunakan kernel lama, silakan lihat [cara mengintegrasikan KernelSU untuk kernel lama](how-to-integrate-for-non-gki)
9 |
10 | ## Build Kernel
11 |
12 | ### Menyinkronkan source code kernel
13 |
14 | ```sh
15 | repo init -u https://android.googlesource.com/kernel/manifest
16 | mv .repo/manifests
17 | repo init -m manifest.xml
18 | repo sync
19 | ```
20 |
21 | `` adalah berkas manifes yang dapat menentukan build secara unik, Anda dapat menggunakan manifes tersebut untuk melakukan build yang dapat diprediksikan ulang. Anda harus mengunduh berkas manifes dari [Google GKI release builds](https://source.android.com/docs/core/architecture/kernel/gki-release-builds)
22 |
23 | ### Build
24 |
25 | Silakan periksa [official docs](https://source.android.com/docs/setup/build/building-kernels) terlebih dahulu.
26 |
27 | Sebagai contoh, kita perlu build image kernel aarch64:
28 |
29 | ```sh
30 | LTO=thin BUILD_CONFIG=common/build.config.gki.aarch64 build/build.sh
31 | ```
32 |
33 | Jangan lupa untuk menambahkan flag `LTO=thin`, jika tidak, maka build akan gagal jika memori komputer Anda kurang dari 24GB.
34 |
35 | Mulai dari Android 13, kernel dibuild oleh `bazel`:
36 |
37 | ```sh
38 | tools/bazel build --config=fast //common:kernel_aarch64_dist
39 | ```
40 |
41 | ## Build Kernel dengan KernelSU
42 |
43 | Jika Anda dapat build kernel dengan sukses, maka build KernelSU sangatlah mudah, jalankan perintah ini di root dir kernel source:
44 |
45 | - Latest tag(stable)
46 |
47 | ```sh
48 | curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash -
49 | ```
50 |
51 | - main branch(dev)
52 |
53 | ```sh
54 | curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash -s main
55 | ```
56 |
57 | - Select tag(Such as v0.5.2)
58 |
59 | ```sh
60 | curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash -s v0.5.2
61 | ```
62 |
63 | Dan kemudian build ulang kernel dan Anda akan mendapatkan image kernel dengan KernelSU!
64 |
--------------------------------------------------------------------------------
/website/docs/id_ID/guide/installation.md:
--------------------------------------------------------------------------------
1 | # Instalasi
2 |
3 | ## Periksa apakah perangkat Anda didukung
4 |
5 | Unduh aplikasi manajer KernelSU dari [github releases](https://github.com/tiann/KernelSU/releases), lalu instal aplikasi ke perangkat dan buka aplikasi:
6 |
7 | - Jika aplikasi menunjukkan `Unsupported`, itu berarti **Anda harus mengkompilasi kernel sendiri**, KernelSU tidak akan dan tidak pernah menyediakan boot image untuk Anda flash.
8 | - Jika aplikasi menunjukkan `Not installed`, maka perangkat Anda secara resmi didukung oleh KernelSU.
9 |
10 | ## Temukan boot.img yang tepat
11 |
12 | KernelSU menyediakan boot.img umum untuk perangkat GKI, Anda harus mem-flash boot.img ke partisi boot perangkat Anda.
13 |
14 | Anda dapat mengunduh boot.img dari [github actions for kernel] (https://github.com/tiann/KernelSU/actions/workflows/build-kernel.yml), perlu diketahui bahwa Anda harus menggunakan versi boot.img yang tepat. Sebagai contoh, jika perangkat Anda menunjukkan bahwa kernelnya adalah `5.10.101`, maka Anda harus mengunduh `5.10.101-xxxx.boot.xxx`.
15 |
16 | Dan juga, silakan periksa format boot.img Anda, Anda harus menggunakan format yang tepat, seperti `lz4`、`gz`.
17 |
18 | ## Flash boot.img ke perangkat
19 |
20 | Hubungkan perangkat Anda dengan `adb` lalu jalankan `adb reboot bootloader` untuk masuk ke mode fastboot, lalu gunakan perintah ini untuk mem-flash KernelSU:
21 |
22 | ```sh
23 | fastboot flash boot boot.img
24 | ```
25 |
26 | ## Reboot
27 |
28 | Ketika di-flash, Anda harus menyalakan ulang perangkat Anda:
29 |
30 | ```sh
31 | fastboot reboot
32 | ```
33 |
--------------------------------------------------------------------------------
/website/docs/id_ID/guide/unofficially-support-devices.md:
--------------------------------------------------------------------------------
1 | # Perangkat Yang Didukung Tidak Resmi
2 |
3 | :::peringatan
4 |
5 | di halaman ini, terdapat kernel untuk perangkat non-GKI yang mendukung KernelSU yang dikelola oleh pengembang lain.
6 |
7 | :::
8 |
9 | :::peringatan
10 |
11 | Halaman ini hanya untuk Anda yang ingin menemukan kode sumber yang sesuai dengan perangkat Anda, itu **BUKAN** berarti kode sumber telah ditinjau oleh _KernelSU Developers_. Anda harus menggunakannya dengan risiko Anda sendiri.
12 |
13 | :::
14 |
15 |
18 |
19 |
35 |
--------------------------------------------------------------------------------
/website/docs/id_ID/guide/what-is-kernelsu.md:
--------------------------------------------------------------------------------
1 | # Apa itu KernelSU?
2 |
3 | KernelSU adalah solusi root untuk perangkat GKI Android, ia bekerja dalam mode kernel dan memberikan izin root ke aplikasi userspace secara langsung di ruang kernel.
4 |
5 | ## Fitur
6 |
7 | Fitur utama dari KernelSU adalah **berbasis kernel**. KernelSU bekerja dalam mode kernel, sehingga dapat menyediakan antarmuka kernel yang belum pernah kita miliki sebelumnya. Sebagai contoh, kita dapat menambahkan breakpoint perangkat keras ke proses apa pun dalam mode kernel; Kita dapat mengakses memori fisik dari proses apa pun tanpa diketahui oleh siapa pun; Kita dapat mencegat syscall apa pun di ruang kernel; dll.
8 |
9 | Dan juga, KernelSU menyediakan sistem modul melalui overlayfs, yang memungkinkan Anda untuk memuat plugin kustom Anda ke dalam sistem. KernelSU juga menyediakan mekanisme untuk memodifikasi berkas-berkas pada partisi `/system`.
10 |
11 | ## Bagaimana cara menggunakannya
12 |
13 | Silakan merujuk ke: [Installation](installation)
14 |
15 | ## Bagaimana cara men-buildnya
16 |
17 | [How to build](how-to-build)
18 |
19 | ## Diskusi
20 |
21 | - Telegram: [@KernelSU](https://t.me/KernelSU)
22 |
--------------------------------------------------------------------------------
/website/docs/id_ID/index.md:
--------------------------------------------------------------------------------
1 | ---
2 | layout: home
3 | title: Sebuah solusi root kernel-based untuk Android
4 |
5 | hero:
6 | name: KernelSU
7 | text: Sebuah solusi root kernel-based untuk Android
8 | tagline: ""
9 | image:
10 | src: /logo.png
11 | alt: KernelSU
12 | actions:
13 | - theme: brand
14 | text: Permulaan
15 | link: /id_ID/guide/what-is-kernelsu
16 | - theme: alt
17 | text: Lihat di GitHub
18 | link: https://github.com/tiann/KernelSU
19 |
20 | features:
21 | - title: Kernel-based
22 | details: KernelSU bekerja dalam mode Linux kernel, dan mempunyai kelebihan diatas aplikasi userspace.
23 | - title: Kontrol akses daftar putih
24 | details: Hanya aplikasi yang diberikan izin root yang bisa mengakses `su`, aplikasi lain tidak bisa mengakses su.
25 | - title: Dukungan modul
26 | details: KernelSU mendukung modifikasi /system tanpa-sistem dalam overlayfs, bahkan bisa membuat system dapat ditulis.
27 | - title: Sumber terbuka
28 | details: KernelSU adalah projek sumber terbuka dibawah lisensi GPL-3.
29 |
--------------------------------------------------------------------------------
/website/docs/index.md:
--------------------------------------------------------------------------------
1 | ---
2 | layout: home
3 | title: A kernel-based root solution for Android
4 |
5 | hero:
6 | name: KernelSU
7 | text: A kernel-based root solution for Android
8 | tagline: ""
9 | image:
10 | src: /logo.png
11 | alt: KernelSU
12 | actions:
13 | - theme: brand
14 | text: Get started
15 | link: /guide/what-is-kernelsu
16 | - theme: alt
17 | text: View on GitHub
18 | link: https://github.com/tiann/KernelSU
19 |
20 | features:
21 | - title: Kernel-based
22 | details: As the name suggests, KernelSU works under the Linux kernel giving it more control over userspace apps.
23 | - title: Root access control
24 | details: Only permitted apps may access or see su, all other apps are not aware of this.
25 | - title: Customizable root privileges
26 | details: KernelSU allows customization of su's uid, gid, groups, capabilities, and SELinux rules, locking up root privileges.
27 | - title: Modules
28 | details: Modules may modify /system systemlessly using OverlayFS enabling great power.
29 |
--------------------------------------------------------------------------------
/website/docs/ja_JP/guide/difference-with-magisk.md:
--------------------------------------------------------------------------------
1 | # Magisk との違い
2 |
3 | KernelSU モジュールと Magisk モジュールには多くの共通点がありますが、実装の仕組みが全く異なるため、必然的にいくつかの相違点が存在します。Magisk と KernelSU の両方でモジュールを動作させたい場合、これらの違いを理解する必要があります。
4 |
5 | ## 似ているところ
6 |
7 | - モジュールファイルの形式:どちらもzip形式でモジュールを整理しており、モジュールの形式はほぼ同じです。
8 | - モジュールのインストールディレクトリ:どちらも `/data/adb/modules` に配置されます。
9 | - システムレス:どちらもモジュールによるシステムレスな方法で /system を変更できます。
10 | - post-fs-data.sh: 実行時間と意味は全く同じです。
11 | - service.sh: 実行時間と意味は全く同じです。
12 | - system.prop:全く同じです。
13 | - sepolicy.rule:全く同じです。
14 | - BusyBox:スクリプトは BusyBox で実行され、どちらの場合も「スタンドアロンモード」が有効です。
15 |
16 | ## 違うところ
17 |
18 | 違いを理解する前に、モジュールが KernelSU で動作しているか Magisk で動作しているかを区別する方法を知っておく必要があります。環境変数 `KSU` を使うとモジュールスクリプトを実行できるすべての場所 (`customize.sh`, `post-fs-data.sh`, `service.sh`) で区別できます。KernelSU では、この環境変数に `true` が設定されます。
19 |
20 | 以下は違いです:
21 |
22 | - KernelSU モジュールは、リカバリーモードではインストールできません。
23 | - KernelSU モジュールには Zygisk のサポートが組み込まれていません(ただし[ZygiskNext](https://github.com/Dr-TSNG/ZygiskNext)を使うと Zygisk モジュールを使用できます)。
24 | - KernelSU モジュールにおけるファイルの置換や削除の方法は、Magisk とは全く異なります。KernelSU は `.replace` メソッドをサポートしていません。その代わり、`mknod filename c 0 0` で同名のファイルを作成し、対応するファイルを削除する必要があります。
25 | - BusyBox 用のディレクトリが違います。KernelSU の組み込み BusyBox は `/data/adb/ksu/bin/busybox` に、Magisk では `/data/adb/magisk/busybox` に配置されます。**これは KernelSU の内部動作であり、将来的に変更される可能性があることに注意してください!**
26 | - KernelSU は `.replace` ファイルをサポートしていません。しかし、KernelSU はファイルやフォルダを削除したり置き換えたりするための `REMOVE` と `REPLACE` 変数をサポートしています。
27 |
--------------------------------------------------------------------------------
/website/docs/ja_JP/guide/faq.md:
--------------------------------------------------------------------------------
1 | # よくある質問
2 |
3 | ## 私のデバイスは KernelSU に対応していますか?
4 |
5 | まず、お使いのデバイスがブートローダーのロックを解除できる必要があります。もしできないのであれば、サポート外です。
6 |
7 | もし KernelSU アプリで「非対応」と表示されたら、そのデバイスは最初からサポートされていないことになりますが、カーネルソースをビルドして KernelSU を組み込むか、[非公式の対応デバイス](unofficially-support-devices)で動作させることが可能です。
8 |
9 | ## KernelSU を使うにはブートローダーのロックを解除する必要がありますか?
10 |
11 | はい。
12 |
13 | ## KernelSU はモジュールに対応していますか?
14 |
15 | はい。ただし初期バージョンであるためバグがある可能性があります。安定するのをお待ちください。
16 |
17 | ## KernelSU は Xposed に対応していますか?
18 |
19 | はい。[Dreamland](https://github.com/canyie/Dreamland) や [TaiChi](https://taichi.cool) が動作します。LSPosed については、[ZygiskNext](https://github.com/Dr-TSNG/ZygiskNext) を使うと動作するようにできます。
20 |
21 | ## KernelSU は Zygisk に対応していますか?
22 |
23 | KernelSU は Zygisk サポートを内蔵していません。[ZygiskNext](https://github.com/Dr-TSNG/ZygiskNext) を使ってください。
24 |
25 | ## KernelSU は Magisk と互換性がありますか?
26 |
27 | KernelSU のモジュールシステムは Magisk のマジックマウントと競合しており、KernelSU で有効になっているモジュールがある場合、Magisk 全体が動作しなくなります。
28 |
29 | しかし、KernelSU の `su` だけを使うのであれば、Magisk とうまく連携することができます。KernelSU は `kernel` を、Magisk は `ramdisk` を修正するため、両者は共存できます。
30 |
31 | ## KernelSU は Magisk の代わりになりますか?
32 |
33 | 私たちはそうは思っていませんし、それが目標でもありません。Magisk はユーザ空間の root ソリューションとして十分であり、長く使われ続けるでしょう。KernelSU の目標は、ユーザーにカーネルインターフェースを提供することであり、Magisk の代用ではありません。
34 |
35 | ## KernelSU は GKI 以外のデバイスに対応できますか?
36 |
37 | 可能です。ただしカーネルソースをダウンロードし、KernelSU をソースツリーに統合して、自分でカーネルをビルドする必要があります。
38 |
39 | ## KernelSU は Android 12 以下のデバイスに対応できますか?
40 |
41 | KernelSU の互換性に影響を与えるのはデバイスのカーネルであり、Android のバージョンとは無関係です。唯一の制限は、Android 12 で発売されたデバイスはカーネル5.10以上(GKI デバイス)でなければならないことです:
42 |
43 | 1. Android 12 をプリインストールして発売された端末は対応しているはずです。
44 | 2. カーネルが古い端末(一部の Android 12 端末はカーネルも古い)は対応可能ですが、カーネルは自分でビルドする必要があります。
45 |
46 | ## KernelSU は古いカーネルに対応できますか?
47 |
48 | KernelSU は現在カーネル4.14にバックポートされていますが、それ以前のカーネルについては手動でバックポートする必要があります。プルリクエスト歓迎です!
49 |
50 | ## 古いカーネルに KernelSU を組み込むには?
51 |
52 | [ガイド](../../guide/how-to-integrate-for-non-gki) を参考にしてください。
53 |
54 | ## Android のバージョンが13なのに、カーネルは「android12-5.10」と表示されるのはなぜ?
55 |
56 | カーネルのバージョンは Android のバージョンと関係ありません。カーネルを書き込む必要がある場合は、常にカーネルのバージョンを使用してください。Android のバージョンはそれほど重要ではありません。
57 |
58 | ## KernelSU に-mount-master/global のマウント名前空間はありますか?
59 |
60 | 今はまだありませんが(将来的にはあるかもしれません)、グローバルマウントの名前空間に手動で切り替える方法は、以下のようにたくさんあります:
61 |
62 | 1. `nsenter -t 1 -m sh` でシェルをグローバル名前空間にします。
63 | 2. `nsenter --mount=/proc/1/ns/mnt` を実行したいコマンドに追加すればグローバル名前空間で実行されます。 KernelSU は [このような使い方](https://github.com/tiann/KernelSU/blob/77056a710073d7a5f7ee38f9e77c9fd0b3256576/manager/app/src/main/java/me/weishu/kernelsu/ui/util/KsuCli.kt#L115) もできます。
64 |
65 | ## GKI 1.0 なのですが、使えますか?
66 |
67 | GKI1 は GKI2 と全く異なるため、カーネルは自分でビルドする必要があります。
68 |
--------------------------------------------------------------------------------
/website/docs/ja_JP/guide/hidden-features.md:
--------------------------------------------------------------------------------
1 | # 隠し機能
2 |
3 | ## .ksurc
4 |
5 | デフォルトでは `/system/bin/sh` は `/system/etc/mkshrc` を読み込みます。
6 |
7 | `/data/adb/ksu/.ksurc` ファイルを作成することで、カスタマイズした rc ファイルを su に読み込ませられます。
--------------------------------------------------------------------------------
/website/docs/ja_JP/guide/how-to-build.md:
--------------------------------------------------------------------------------
1 | # KernelSU のビルド方法は?
2 |
3 | まず、Android の公式ドキュメントを読むべきです:
4 |
5 | 1. [カーネルをビルドする](https://source.android.com/docs/setup/build/building-kernels)
6 | 2. [GKI リリースビルド](https://source.android.com/docs/core/architecture/kernel/gki-release-builds)
7 |
8 | ::: 警告
9 | このページは GKI デバイス用です。もし古いカーネルを使用している場合は、[古いカーネルへの KernelSU の統合方法](how-to-integrate-for-non-gki)を参照してください。
10 | :::
11 |
12 | ## カーネルビルド
13 |
14 | ### カーネルソースコードの同期
15 |
16 | ```sh
17 | repo init -u https://android.googlesource.com/kernel/manifest
18 | mv .repo/manifests
19 | repo init -m manifest.xml
20 | repo sync
21 | ```
22 |
23 | `` は、ビルドを一意に決定するマニフェストファイルです。マニフェストを使用して再現可能なビルドを行えます。マニフェストファイルは [Google GKI リリースビルド](https://source.android.com/docs/core/architecture/kernel/gki-release-builds) からダウンロードしてください。
24 |
25 | ### ビルド
26 |
27 | まずは [公式ドキュメント](https://source.android.com/docs/setup/build/building-kernels)を確認してください。
28 |
29 | たとえば、aarch64 カーネルイメージをビルドする必要があります:
30 |
31 | ```sh
32 | LTO=thin BUILD_CONFIG=common/build.config.gki.aarch64 build/build.sh
33 | ```
34 | `LTO=thin` フラグを追加するのを忘れないでください。それをしないと、コンピュータのメモリが 24Gb 未満の場合にビルドに失敗する可能性があります。
35 |
36 | Android 13 からは、カーネルは `bazel` によってビルドされます:
37 |
38 | ```sh
39 | tools/bazel build --config=fast //common:kernel_aarch64_dist
40 | ```
41 | ## KernelSU を使ったカーネルビルド
42 |
43 | もしカーネルを正常にビルドできた場合、KernelSU をビルドするのは簡単です。カーネルソースのルートディレクトリで任意のものを選択して実行します:
44 |
45 | ::: code-group
46 | ```sh[最新タグ(安定版)]
47 | curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash -
48 | ```
49 | ```sh[ main ブランチ (開発用)]
50 | curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash -s main
51 | ```
52 | ```sh[タグを選択 (例:v0.5.2)]
53 | curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash -s v0.5.2
54 | ```
55 |
56 | :::
57 |
58 | その後でカーネルを再ビルドすると、KernelSU が組み込まれたカーネルイメージが得られます!
59 |
--------------------------------------------------------------------------------
/website/docs/ja_JP/guide/module-webui.md:
--------------------------------------------------------------------------------
1 | # Module WebUI
2 |
3 | KernelSU のモジュールは、ブートスクリプトの実行やシステムファイルの修正に加えて、UI インターフェースの表示やユーザーとの対話もサポートしています。
4 |
5 | モジュールは、任意の Web 技術を通じて HTML + CSS + JavaScript のページを作成することができます。KernelSU のマネージャーは WebView を通じてこれらのページを表示します。また、シェルコマンドの実行など、システムと対話するためのいくつかのAPIを提供しています。
6 |
7 | ## `webroot` ディレクトリ
8 |
9 | Web リソースファイルは、モジュールのルートディレクトリの `webroot` サブディレクトリに置かれるべきであり、`index.html` という名前のファイルが必ず存在しなければなりません。これがモジュールページのエントリです。Web インターフェイスを含む最もシンプルなモジュール構造は以下の通りです:
10 |
11 | ```txt
12 | ❯ tree .
13 | .
14 | |-- module.prop
15 | `-- webroot
16 | `-- index.html
17 | ```
18 |
19 | :::警告
20 | モジュールをインストールするとき、KernelSU はこのディレクトリのパーミッションと SELinux コンテキストを自動的に設定します。何をしているかわからないのであれば、自分でこのディレクトリのパーミッションを設定しないでください!
21 | :::
22 |
23 | ページに css や JavaScript が含まれている場合は、このディレクトリに配置する必要があります。
24 |
25 | ## JavaScript API
26 |
27 | 単なる表示ページであれば、通常の Web ページとの違いはありません。より重要なのは、KernelSU がモジュールの固有機能を実装させるための一連のシステム API を提供することです。
28 |
29 | KernelSU は JavaScript ライブラリを提供し、[npm で公開しています](https://www.npmjs.com/package/kernelsu)。これを Web ページの JavaScript コードで使用することができます。
30 |
31 | たとえば、特定の設定を取得したり、プロパティを変更するために、シェルコマンドを実行することができます:
32 |
33 | ```JavaScript
34 | import { exec } from 'kernelsu';
35 |
36 | const { errno, stdout } = exec("getprop ro.product.model");
37 | ```
38 |
39 | 別の例として、Webページをフルスクリーンで表示したり、トーストを表示することができます。
40 |
41 | [API ドキュメント](https://www.npmjs.com/package/kernelsu)
42 |
43 | 既存のAPIがご自身のニーズを満たしていない、または使い勝手が不便である場合、[こちら](https://github.com/tiann/KernelSU/issues)でご提案いただければ幸いです!
44 |
45 | ## いくつかのヒント
46 |
47 | 1. `localStorage` を通常通りに使用してデータを保存することができますが、Manager アプリをアンインストールした後には失われます。永続的に保存する必要がある場合は、自分でいくつかのディレクトリにデータを書き込むことができます。
48 | 2. シンプルなページには、[parceljs](https://parceljs.org/)を使用することをお勧めします。設定が不要で非常に便利です。しかし、フロントエンドの達人である場合や、自分の好みがある場合は、気に入ったものを選んでください!
49 |
--------------------------------------------------------------------------------
/website/docs/ja_JP/guide/rescue-from-bootloop.md:
--------------------------------------------------------------------------------
1 | # ブートループからの復旧
2 |
3 | デバイスに書き込む際、デバイスが「文鎮化」状態になる場面に遭遇することがあります。理論的には、fastboot で boot パーティションを書き込んだだけだったり、不適切なモジュールをインストールしてデバイスが起動しなくなったりした場合なら、適切な操作で復旧できます。このページでは、「文鎮化」状態になったデバイスを復旧させるための緊急手段を紹介します。
4 |
5 | ## boot パーティションの書き込みによる文鎮化
6 |
7 | KernelSU では、以下のような状況で boot パーティションを書き込んだときに文鎮化する場合があります:
8 |
9 | 1. 間違った形式の boot イメージを書き込んでしまった場合。例えばお使いのデバイスのパーティション形式が `gz` なのに `lz4` 形式のイメージを書き込んでしまうと、起動しなくなります。
10 | 2. お使いのデバイスが起動するために AVB 検証を無効にする必要がある場合(通常、無効にするにはすべてのデータを消去する必要があります)。
11 | 3. カーネルにバグがある、または書き込みに適していない場合。
12 |
13 | どのような状況であっても、**純正の boot イメージを書き込む**ことで復旧できます。したがって、インストールする前にまずは純正の boot パーティションをバックアップすることを強くおすすめします。バックアップしていない場合は、あなたと同じデバイスを持つ他のユーザー、または公式ファームウェアから純正の boot イメージを入手できます。
14 |
15 | ## モジュールによる文鎮化
16 |
17 | モジュールのインストールはデバイスを文鎮化させる一般的な原因です。**モジュールを未知のソースからインストールしないでください**!モジュールは root 権限を持つため、あなたのデバイスに不可逆的なダメージを与える可能性があります!
18 |
19 | ### 通常のモジュール
20 |
21 | 安全であることが確認されているモジュールをインストールしてデバイスが起動しなくなった場合、KernelSU では心配することなく簡単に復旧できます。KernelSU には、以下のようなデバイスを救出するための仕組みが組み込まれています:
22 |
23 | 1. AB アップデート
24 | 2. 音量下ボタンでの復旧
25 |
26 | #### AB アップデート
27 |
28 | KernelSU のモジュール更新は、OTA アップデートで使用される Android システムの AB アップデート機構からヒントを得ています。新しいモジュールをインストールしたり、既存のモジュールを更新したりする場合、現在使用されているモジュールファイルを直接変更することはありません。代わりに、すべてのモジュールが別のアップデートイメージに組み込まれます。システムが再起動された後、このアップデートイメージの使用を開始しようとします。Android システムが正常に起動した場合、モジュールは本当に更新されます。
29 |
30 | そのため、デバイスを復旧する最もシンプルで一般的な方法は、**強制的に再起動すること**です。モジュールをインストールした後にシステムを起動できなくなった場合、電源ボタンを10秒以上長押しするとシステムが自動的に再起動します。再起動後はモジュールを更新する前の状態にロールバックされ、以前に更新したモジュールは自動的に無効化されます。
31 |
32 | #### 音量下ボタンでの復旧
33 |
34 | AB アップデートでも解決しない場合は、**セーフモード**を使用してみてください。セーフモードでは、すべてのモジュールが無効化されます。
35 |
36 | セーフモードに入るには、2つの方法があります:
37 |
38 | 1. 一部のシステムの内蔵セーフモード:音量下ボタンの長押しでセーフモードに入れるシステムもあれば、リカバリーでセーフモードに入れるシステム(MIUI など)もあります。システムのセーフモードに入ると KernelSU もセーフモードに入り、自動的にモジュールを無効化します。
39 | 2. KernelSU の内蔵セーフモード:最初の起動画面の後、**音量下キーを3回以上連続して押す**と入れます。なお、押す→離すを三回繰り返すのであって、長押しではありません。
40 |
41 | セーフモードに入ると、KernelSU Manager のモジュールページにあるすべてのモジュールが無効になります。「アンインストール」操作を行うことで、問題を起こしている可能性のあるモジュールをアンインストールできます。
42 |
43 | 内蔵のセーフモードはカーネルに実装されているため、キーイベントを見逃す可能性はありません。ただし、GKI 以外のカーネルでは手動によるコードの統合が必要な場合があるため、公式ドキュメントを参考にしてください。
44 |
45 | ### 悪意のあるモジュール
46 |
47 | 上記の方法でデバイスを救出できない場合、インストールしたモジュールが悪意のある操作をしているか、他の手段でデバイスを損傷している可能性が高いです。この場合、2つの方法しかありません:
48 |
49 | 1. データを消去して純正システムをインストールし直す
50 | 2. アフターセールスサービスに問い合わせする
51 |
--------------------------------------------------------------------------------
/website/docs/ja_JP/guide/unofficially-support-devices.md:
--------------------------------------------------------------------------------
1 | # 非公式の対応デバイス
2 |
3 | ::: warning 警告
4 | このページでは他の開発者が管理している、KernelSU をサポートする GKI 以外のデバイス用のカーネルを紹介しています。
5 | :::
6 |
7 | ::: warning 警告
8 | このページはあなたのデバイスに対応するソースコードを見つけるためのものであり、そのソースコードが _KernelSU 開発者_ によってレビューされたことを意味するものではありません。ご自身の責任においてご利用ください。
9 | :::
10 |
11 |
14 |
15 |
--------------------------------------------------------------------------------
/website/docs/ja_JP/guide/what-is-kernelsu.md:
--------------------------------------------------------------------------------
1 | # KernelSU とは?
2 |
3 | KernelSU は Android GKI デバイスのための root ソリューションです。カーネルモードで動作し、カーネル空間で直接ユーザー空間アプリに root 権限を付与します。
4 |
5 | ## 機能
6 |
7 | KernelSU の最大の特徴は、**カーネルベース**であることです。KernelSU はカーネルモードで動作するため、今までにないカーネルインターフェイスを提供できます。例えば、カーネルモードで任意のプロセスにハードウェアブレークポイントを追加できる、誰にも気づかれずに任意のプロセスの物理メモリにアクセスできる、カーネル空間で任意のシステムコールを傍受できる、などです。
8 |
9 | また、KernelSU は OverlayFS によるモジュールシステムを提供しており、カスタムプラグインをシステムに読み込めます。`/system` パーティションを変更する仕組みも提供しています。
10 |
11 | ## 使用方法
12 |
13 | こちらをご覧ください: [インストール方法](installation)
14 |
15 | ## ビルド方法
16 |
17 | [ビルドするには](../../guide/how-to-build)
18 |
19 | ## ディスカッション
20 |
21 | - Telegram: [@KernelSU](https://t.me/KernelSU)
22 |
--------------------------------------------------------------------------------
/website/docs/ja_JP/index.md:
--------------------------------------------------------------------------------
1 | ---
2 | layout: home
3 | title: Android 向けのカーネルベース root ソリューション
4 |
5 | hero:
6 | name: KernelSU
7 | text: Android 向けのカーネルベース root ソリューション
8 | tagline: ""
9 | image:
10 | src: /logo.png
11 | alt: KernelSU
12 | actions:
13 | - theme: brand
14 | text: はじめる
15 | link: /ja_JP/guide/what-is-kernelsu
16 | - theme: alt
17 | text: GitHub で表示
18 | link: https://github.com/tiann/KernelSU
19 |
20 | features:
21 | - title: カーネルベース
22 | details: KernelSU は Linux カーネルモードで動作し、ユーザー空間よりも高度な制御が可能です。
23 | - title: ホワイトリストの権限管理
24 | details: root 権限を許可したアプリのみが su にアクセスでき、他のアプリは su を見つけられません。
25 | - title: モジュール対応
26 | details: KernelSU は OverlayFS により実際のシステムを改変せずに /system を変更できます。書き込み可能にすることさえできます。
27 | - title: オープンソース
28 | details: KernelSU は GPL-3 でライセンスされたオープンソースプロジェクトです。
29 |
30 |
--------------------------------------------------------------------------------
/website/docs/pt_BR/guide/difference-with-magisk.md:
--------------------------------------------------------------------------------
1 | # Diferenças com Magisk
2 |
3 | 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.
4 |
5 | ## Semelhanças
6 |
7 | - 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.
8 | - Diretório de instalação do módulo: ambos localizados em `/data/adb/modules`.
9 | - Sem sistema: ambos suportam a modificação de `/system` de maneira sem sistema por meio de módulos.
10 | - post-fs-data.sh: o tempo de execução e a semântica são exatamente os mesmos.
11 | - service.sh: o tempo de execução e a semântica são exatamente os mesmos.
12 | - system.prop: completamente o mesmo.
13 | - sepolicy.rule: completamente o mesmo.
14 | - BusyBox: os scripts são executados no BusyBox com o "Modo Autônomo" ativado em ambos os casos.
15 |
16 | ## Diferenças
17 |
18 | 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`.
19 |
20 | Aqui estão algumas diferenças:
21 |
22 | - Os módulos KernelSU não podem ser instalados no modo Recovery.
23 | - 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).
24 | - 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.
25 | - 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!**
26 | - O KernelSU não suporta arquivos `.replace`, entretanto, o KernelSU suporta as variáveis `REMOVE` e `REPLACE` para remover ou substituir arquivos e pastas.
27 | - O KernelSU adiciona o estágio `boot-completed` para executar alguns scripts na inicialização concluída.
28 | - O KernelSU adiciona o estágio `post-mount` para executar alguns scripts após montar OverlayFS.
29 |
--------------------------------------------------------------------------------
/website/docs/pt_BR/guide/hidden-features.md:
--------------------------------------------------------------------------------
1 | # Recursos ocultos
2 |
3 | ## .ksurc
4 |
5 | Por padrão, `/system/bin/sh` carrega `/system/etc/mkshrc`.
6 |
7 | Você pode fazer su carregar um arquivo rc personalizado criando um arquivo `/data/adb/ksu/.ksurc`.
8 |
--------------------------------------------------------------------------------
/website/docs/pt_BR/guide/unofficially-support-devices.md:
--------------------------------------------------------------------------------
1 | # Dispositivos com suporte não oficial
2 |
3 | ::: warning AVISO
4 | Nesta página, existem kernels para dispositivos não GKI que suportam o KernelSU mantidos por outros desenvolvedores.
5 | :::
6 |
7 | ::: warning AVISO
8 | 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.
9 | :::
10 |
11 |
14 |
15 |
31 |
--------------------------------------------------------------------------------
/website/docs/pt_BR/guide/what-is-kernelsu.md:
--------------------------------------------------------------------------------
1 | # O que é KernelSU?
2 |
3 | O KernelSU é uma solução root para dispositivos Android GKI, funciona no modo kernel e concede privilégios root para apps do espaço do usuário diretamente no espaço do kernel.
4 |
5 | ## Características
6 |
7 | 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.
8 |
9 | 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`.
10 |
11 | ## Como usar o KernelSU?
12 |
13 | Por favor, consulte: [Instalação](installation)
14 |
15 | ## Como compilar o KernelSU?
16 |
17 | Por favor, consulte: [Como compilar?](how-to-build)
18 |
19 | ## Discussão
20 |
21 | - Telegram: [@KernelSU](https://t.me/KernelSU)
22 |
--------------------------------------------------------------------------------
/website/docs/pt_BR/index.md:
--------------------------------------------------------------------------------
1 | ---
2 | layout: home
3 | title: Uma solução root baseada em kernel para Android
4 |
5 | hero:
6 | name: KernelSU
7 | text: Uma solução root baseada em kernel para Android
8 | tagline: ""
9 | image:
10 | src: /logo.png
11 | alt: KernelSU
12 | actions:
13 | - theme: brand
14 | text: Iniciar
15 | link: /pt_BR/guide/what-is-kernelsu
16 | - theme: alt
17 | text: Ver no GitHub
18 | link: https://github.com/tiann/KernelSU
19 |
20 | features:
21 | - title: Baseado em kernel
22 | details: Como o nome sugere, KernelSU funciona no kernel Linux, dando-lhe mais controle sobre os apps do espaço do usuário.
23 | - title: Controle de acesso root
24 | details: Somente apps permitidos podem acessar ou ver su, todos os outros apps não estão cientes disso.
25 | - title: Privilégios root personalizáveis
26 | details: KernelSU permite a personalização de su, uid, gid, grupos, capacidades e regras do SELinux, bloqueando privilégios root.
27 | - title: Módulos
28 | details: Os módulos podem modificar /system sem sistema usando OverlayFS permitindo uma grande potência.
29 |
--------------------------------------------------------------------------------
/website/docs/public/ads.txt:
--------------------------------------------------------------------------------
1 | google.com, pub-2610070972052494, DIRECT, f08c47fec0942fa0
2 |
--------------------------------------------------------------------------------
/website/docs/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-sm8350/susfs4ksu/9e9b053f634894eddfe26501564dbef6aa0f3b65/website/docs/public/favicon.ico
--------------------------------------------------------------------------------
/website/docs/public/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-sm8350/susfs4ksu/9e9b053f634894eddfe26501564dbef6aa0f3b65/website/docs/public/logo.png
--------------------------------------------------------------------------------
/website/docs/public/templates/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-sm8350/susfs4ksu/9e9b053f634894eddfe26501564dbef6aa0f3b65/website/docs/public/templates/.gitkeep
--------------------------------------------------------------------------------
/website/docs/public/templates/adaway.root:
--------------------------------------------------------------------------------
1 | {
2 | "id":"adaway.root",
3 | "name":"Adaway Root",
4 | "author":"JohnRTitor",
5 | "description":"Only essential permissions to let Adaway modify hosts file and operate a web server.",
6 | "uid":0,
7 | "gid":0,
8 | "groups":[
9 | "ROOT"
10 | ],
11 | "capabilities":[
12 | "CAP_DAC_OVERRIDE",
13 | "CAP_NET_BIND_SERVICE",
14 | "CAP_SYS_PTRACE"
15 | ],
16 | "context":"u:r:su:s0",
17 | "namespace":"INHERITED",
18 | "locales": {
19 | "zh_TW": {
20 | "name": "Adaway Root",
21 | "description": "僅允許 Adaway 修改 hosts 和執行 Web 伺服器的必要權限"
22 | },
23 | "bn": {
24 | "name": "অ্যাডঅ্যাওয়ে রুট",
25 | "description": "অ্যাডঅ্যাওয়ে সিস্টেমের হোস্ট ফাইল পরিবর্তন এবং ওয়েবসার্ভার চালু করতে কমপক্ষে যা অনুমতি লাগে।"
26 | },
27 | "pt_BR": {
28 | "name": "Adaway Root",
29 | "description": "Apenas permissões essenciais para permitir que Adaway modifique o arquivo hosts e opere um servidor web."
30 | },
31 | "tr": {
32 | "name": "Adaway Root",
33 | "description": "Adaway'in hosts dosyasını değiştirmesine ve bir web sunucusunu çalıştırmasına izin vermek için gerekli izinler."
34 | },
35 | "it_IT": {
36 | "name": "Adaway Root",
37 | "description": "Concede le autorizzazioni essenziali affinché Adaway possa modificare il file host e gestire un server web. "
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/website/docs/public/templates/adb:
--------------------------------------------------------------------------------
1 | {
2 | "id":"adb",
3 | "name":"Adb",
4 | "author":"kernelsu.org",
5 | "description":"Minimal rules required by most apps using ADB privilege.",
6 | "uid":2000,
7 | "gid":2000,
8 | "groups":[
9 | "ADB"
10 | ],
11 | "locales": {
12 | "bn": {
13 | "name": "এডিবি",
14 | "description": "নূন্যতম অনুমতি যার দ্বারা এডিবি স্বচ্ছন্দে কাজ করতে পারে।"
15 | },
16 | "zh_CN": {
17 | "name": "Adb 模版",
18 | "description": "大多数使用 ADB 权限应用所需要的最小权限"
19 | },
20 | "zh_TW": {
21 | "name": "Adb",
22 | "description": "大多數使用 ADB 權限應用程式所需要的最低權限"
23 | },
24 | "tr": {
25 | "name": "Adb",
26 | "description": "ADB ayrıcalığını kullanan çoğu uygulama için gereken minimum kurallar."
27 | },
28 | "pt_BR": {
29 | "name": "Adb",
30 | "description": "Regras mínimas exigidas pela maioria dos apps que usam privilégio ADB."
31 | },
32 | "ja": {
33 | "name": "Adb",
34 | "description": "ほとんどのアプリが使用するために必要な最小限のルール ADB."
35 | },
36 | "it_IT": {
37 | "name": "Adb",
38 | "description": "Autorizzazioni minime richieste dalla maggior parte delle app che usano i privilegi di ADB."
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/website/docs/public/templates/cemiuiler.readproc:
--------------------------------------------------------------------------------
1 | {
2 | "id":"cemiuiler.readproc",
3 | "name":"Cemiuiler",
4 | "author":"refined-fish",
5 | "description":"Grant Cemiuiler the minimum permissions to work properly-to restart the application.",
6 | "namespace":"INHERITED",
7 | "uid":10000,
8 | "gid":10000,
9 | "groups":[
10 | "READPROC"
11 | ],
12 | "capabilities":[
13 | "CAP_KILL"
14 | ],
15 | "context":"u:r:su:s0",
16 | "rules":"",
17 | "locales": {
18 | "bn": {
19 | "name": "সিমিউলার",
20 | "description": "নূন্যতম অনুমতি যার দ্বারা সিমিউলার আবার কাজে বহাল হতে পারে।"
21 | },
22 | "zh_CN": {
23 | "name": "西米露Cemiuiler",
24 | "description": "授予Cemiuiler能正常工作——重启作用域应用的最小限度权限。"
25 | },
26 | "zh_TW": {
27 | "name": "Cemiuiler",
28 | "description": "授予Cemiuiler能正常運作-重啟作用域應用程式的最低權限"
29 | },
30 | "tr": {
31 | "name": "Cemiuiler",
32 | "description": "Cemiuiler uygulamasına düzgün çalışması için minimum izinleri verin."
33 | },
34 | "pt_BR": {
35 | "name": "Cemiuiler",
36 | "description": "Conceda ao Cemiuiler as permissões mínimas para funcionar corretamente para reiniciar o app."
37 | },
38 | "ja": {
39 | "name": "Cemiuiler",
40 | "description": "Cemiuiler に適切に動作するための最小限の権限を付与し、アプリケーションを再起動します。"
41 | },
42 | "it_IT": {
43 | "name": "Cemiuiler",
44 | "description": "Concedi a Cemiuiler le autorizzazioni minime per riavviare correttamente l'applicazione."
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/website/docs/public/templates/incompetent.root:
--------------------------------------------------------------------------------
1 | {
2 | "id":"incompetent.root",
3 | "name":"Incompetent root",
4 | "author":"kernelsu.org",
5 | "description":"A incompetent root user without any capability.",
6 | "uid":0,
7 | "gid":0,
8 | "groups":[
9 | "ROOT"
10 | ],
11 | "locales": {
12 | "bn": {
13 | "name": "অযোগ্য রুট ইউজার",
14 | "description": "অযোগ্য রুট ইউজার যার কোনো স্পেশাল ক্ষমতা নেই।"
15 | },
16 | "zh_CN": {
17 | "name": "无能的 Root",
18 | "description": "无任何权能的 root 用户。"
19 | },
20 | "zh_TW": {
21 | "name": "無能的 Root",
22 | "description": "無任何權限的 root"
23 | },
24 | "tr": {
25 | "name": "Yetersiz root",
26 | "description": "Herhangi bir özelliği olmayan yetersiz bir root kullanıcısı."
27 | },
28 | "pt_BR": {
29 | "name": "Root incompetente",
30 | "description": "Um usuário root incompetente sem qualquer capacidade."
31 | },
32 | "ja": {
33 | "name": "無能な root",
34 | "description": "権限のない root ユーザー。"
35 | },
36 | "it_IT": {
37 | "name": "Root incompetente",
38 | "description": "Un utente root senza nessuna capacità."
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/website/docs/public/templates/kernelmanager.root:
--------------------------------------------------------------------------------
1 | {
2 | "id":"kernelmanager.root",
3 | "name":"Kernel Manager",
4 | "author":"Rem01Gaming",
5 | "description":"Commonly used in Kernel managers such as FKM and SmartPack.",
6 | "uid":0,
7 | "gid":0,
8 | "groups":[
9 | "ROOT",
10 | "READPROC"
11 | ],
12 | "capabilities":[
13 | "CAP_KILL",
14 | "CAP_SYSLOG",
15 | "CAP_SYS_BOOT",
16 | "CAP_DAC_OVERRIDE"
17 | ],
18 | "context":"u:r:su:s0",
19 | "namespace":"INHERITED",
20 | "locales": {
21 | "bn": {
22 | "name": "কার্নেল ম্যানেজার",
23 | "description": "এফ কে এম বা স্মার্টপ্যাক কার্নেল ম্যানেজারের যে অনুমতি লাগে।"
24 | },
25 | "zh_TW": {
26 | "name": "核心管理器",
27 | "description": "常用於 FKM 和 SmartPack 等核心管理器"
28 | },
29 | "in": {
30 | "name": "Kernel Manager",
31 | "description": "Umumnya digunakan pada Kernel manager seperti FKM dan SmartPack."
32 | },
33 | "tr": {
34 | "name": "Kernel Yöneticisi",
35 | "description": "FKM ve SmartPack gibi Kernel Yöneticilerinde yaygın olarak kullanılır."
36 | },
37 | "pt_BR": {
38 | "name": "Gerenciador de Kernel",
39 | "description": "Comumente usado em gerenciadores de Kernel como FKM e SmartPack."
40 | },
41 | "ja": {
42 | "name": "Kernel マネージャー",
43 | "description": "FKM や SmartPack などの XXX マネージャーでよく使用されます。"
44 | },
45 | "it_IT": {
46 | "name": "Gestore Kernel",
47 | "description": "Autorizzazioni comunemente richieste in applicazioni per gestire il Kernel come FKM e SmartPack."
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/website/docs/public/templates/nethunter.root:
--------------------------------------------------------------------------------
1 | {
2 | "id": "nethunter.root",
3 | "name": "Kali NetHunter",
4 | "author": "cachiusa",
5 | "description": "Required permissions for Kali NetHunter app to chroot.",
6 | "namespace": "INHERITED",
7 | "uid": 0,
8 | "gid": 0,
9 | "groups": [
10 | "ROOT"
11 | ],
12 | "capabilities": [
13 | "CAP_DAC_OVERRIDE",
14 | "CAP_DAC_READ_SEARCH",
15 | "CAP_SYS_CHROOT",
16 | "CAP_SYS_PTRACE",
17 | "CAP_SYS_ADMIN",
18 | "CAP_SETGID"
19 | ],
20 | "context": "u:r:su:s0",
21 | "locales": {
22 | "bn": {
23 | "name": "কালি নেটহানটার",
24 | "description": "কালি নেটহানটার অ্যাপের কার্যকলাপের জন্য যে অনুমতিগুলি লাগে।"
25 | },
26 | "zh_TW": {
27 | "name": "Kali NetHunter",
28 | "description": "提供Kali NetHunter使用chroot"
29 | },
30 | "pt_BR": {
31 | "name": "Kali NetHunter",
32 | "description": "Permissões necessárias para o app Kali NetHunter fazer chroot."
33 | },
34 | "it_IT": {
35 | "name": "Kali NetHunter",
36 | "description": "Autorizzazioni richieste per il chroot dell'applicazione Kali NetHunter."
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/website/docs/public/templates/rootexploler.root:
--------------------------------------------------------------------------------
1 | {
2 | "id":"rootexploler.root",
3 | "name":"Root Explorer",
4 | "author":"Rem01Gaming",
5 | "description":"File manager with Root capabilities.",
6 | "uid":0,
7 | "gid":0,
8 | "groups":[
9 | "ROOT"
10 | ],
11 | "capabilities":[
12 | "CAP_DAC_READ_SEARCH",
13 | "CAP_DAC_OVERRIDE",
14 | "CAP_SYS_ADMIN"
15 | ],
16 | "context":"u:r:su:s0",
17 | "namespace":"INHERITED",
18 | "locales": {
19 | "bn": {
20 | "name": "রুট এক্সপ্লোরার",
21 | "description": "রুট অনুমতি যুক্ত ফাইল ম্যানেজার।"
22 | },
23 | "zh_TW": {
24 | "name": "Root Explorer",
25 | "description": "具有根目錄讀寫權限的檔案管理器"
26 | },
27 | "in": {
28 | "name": "Root Explorer",
29 | "description": "File manager dengan kemampuan Root."
30 | },
31 | "tr": {
32 | "name": "Root Dosya Tarayıcı",
33 | "description": "Root özelliklerine sahip dosya yöneticisi."
34 | },
35 | "pt_BR": {
36 | "name": "Explorador Root",
37 | "description": "Gerenciador de arquivos com recursos root."
38 | },
39 | "ja": {
40 | "name": "Root ブラウザ",
41 | "description": "Root 機能を備えたファイル マネージャー。"
42 | },
43 | "it_IT": {
44 | "name": "Gestore file root",
45 | "description": "Gestore file con permessi root."
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/website/docs/public/templates/shizuku.root:
--------------------------------------------------------------------------------
1 | {
2 | "id":"shizuku.root",
3 | "name":"Shizuku Service",
4 | "author":"Rem01Gaming & JohnRTitor",
5 | "description":"Only essential permissions to start Shizuku service.",
6 | "uid":0,
7 | "gid":0,
8 | "groups":[
9 | "SHELL"
10 | ],
11 | "capabilities":[
12 | "CAP_DAC_OVERRIDE",
13 | "CAP_CHOWN"
14 | ],
15 | "context":"u:r:su:s0",
16 | "namespace":"INHERITED",
17 | "locales": {
18 | "zh_TW": {
19 | "name": "Shizuku",
20 | "description": "只有啟動 Shizuku 服務所需的權限"
21 | },
22 | "bn": {
23 | "name": "শিজুকু সার্ভিস",
24 | "description": "শিজুকু চালানোর জন্য শুধু যে অনুমতি গুলি লাগে।"
25 | },
26 | "tr": {
27 | "name": "Shizuku",
28 | "description": "Shizuku servisini başlatmak için yalnızca gerekli izinler."
29 | },
30 | "pt_BR": {
31 | "name": "Shizuku",
32 | "description": "Apenas permissões essenciais para iniciar o serviço Shizuku."
33 | },
34 | "ja": {
35 | "name": "Shizuku",
36 | "description": "Shizuku サービスを開始するために必要な権限のみ。"
37 | },
38 | "it_IT": {
39 | "name": "Shizuku",
40 | "description": "Permessi essenziali per avviare il servizio Shizuku."
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/website/docs/public/templates/system:
--------------------------------------------------------------------------------
1 | {
2 | "id":"system",
3 | "author":"kernelsu.org",
4 | "name":"System",
5 | "description":"The permission level at which the Android system runs without any capability.",
6 | "uid":1000,
7 | "gid":1000,
8 | "groups":[
9 | "SYSTEM"
10 | ],
11 | "locales": {
12 | "bn": {
13 | "name": "সিস্টেম",
14 | "description": "অ্যান্ড্রয়েড সিস্টেম যে অনুমতিগুলি নিয়ে কাজ করে।"
15 | },
16 | "zh_CN": {
17 | "name": "Android 系统",
18 | "description": "Android 系统运行的权限级别,但没有任何权能。"
19 | },
20 | "zh_TW": {
21 | "name": "Android 系統",
22 | "description": "Android 系統運作的權限級別,但沒有任何權能"
23 | },
24 | "tr": {
25 | "name": "Sistem",
26 | "description": "Android sisteminin herhangi bir yetenek olmadan çalıştığı izin düzeyi."
27 | },
28 | "pt_BR": {
29 | "name": "Sistema",
30 | "description": "O nível de permissão no qual o sistema Android é executado sem qualquer capacidade."
31 | },
32 | "ja": {
33 | "name": "System",
34 | "description": "Android システムが実行される許可レベルですが、機能はありません。"
35 | },
36 | "it_IT": {
37 | "name": "Sistema",
38 | "description": "Il livello di permessi con il quale viene eseguito il sistema operativo Android senza alcuna capacità."
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/website/docs/public/templates/wireguard.root:
--------------------------------------------------------------------------------
1 | {
2 | "id":"wireguard.root",
3 | "name":"Wireguard kernel module function",
4 | "author":"hotfur",
5 | "description":"Essential permissions for a working Wireguard kernel module backend. The optional Wireguard command line tools installation requires DAC_OVERRIDE for writing binaries to /system/bin. Because it is optional for operation, DAC_OVERRIDE is not granted here but you can grant the capability temporarily then revoke it after the app installed the command line binaries.",
6 | "uid":0,
7 | "gid":0,
8 | "groups":[
9 | "ROOT"
10 | ],
11 | "capabilities":[
12 | "CAP_DAC_READ_SEARCH",
13 | "CAP_NET_ADMIN",
14 | "CAP_NET_RAW"
15 | ],
16 | "context":"u:r:su:s0",
17 | "namespace":"INHERITED",
18 | }
19 |
--------------------------------------------------------------------------------
/website/docs/ru_RU/guide/difference-with-magisk.md:
--------------------------------------------------------------------------------
1 | # Различия с Magisk {#title}
2 |
3 | Несмотря на большое количество сходств между модулями KernelSU и модулями Magisk, неизбежно возникают и различия, обусловленные совершенно разными механизмами их реализации. Если вы хотите, чтобы ваш модуль работал как на Magisk, так и на KernelSU, вы должны понимать эти различия.
4 |
5 | ## Сходства {#similarities}
6 |
7 | - Формат файлов модулей: оба используют формат zip для организации модулей, и формат модулей практически одинаков
8 | - Каталог установки модулей: оба расположены в `/data/adb/modules`.
9 | - Бессистемность: оба поддерживают модификацию /system бессистемным способом через модули
10 | - post-fs-data.sh: время выполнения и семантика полностью совпадают
11 | - service.sh: время выполнения и семантика полностью совпадают
12 | - system.prop: полностью совпадает
13 | - sepolicy.rule: полностью совпадает
14 | - BusyBox: скрипты запускаются в BusyBox с включенным "автономным режимом" в обоих случаях
15 |
16 | ## Различия {#differences}
17 |
18 | Прежде чем разбираться в различиях, необходимо знать, как отличить, в каком режиме работает ваш модуль - KernelSU или Magisk. Для этого можно использовать переменную окружения `KSU` во всех местах, где можно запустить скрипты модуля (`customize.sh`, `post-fs-data.sh`, `service.sh`). В KernelSU эта переменная окружения будет установлена в значение `true`.
19 |
20 | Вот некоторые отличия:
21 |
22 | - Модули KernelSU не могут быть установлены в режиме Recovery.
23 | - Модули KernelSU не имеют встроенной поддержки Zygisk (но вы можете использовать модули Zygisk через [ZygiskNext](https://github.com/Dr-TSNG/ZygiskNext).
24 | - Метод замены или удаления файлов в модулях KernelSU полностью отличается от Magisk. KernelSU не поддерживает метод `.replace`. Вместо этого необходимо создать одноименный файл с помощью команды `mknod filename c 0 0` для удаления соответствующего файла.
25 | - Каталоги для BusyBox отличаются. Встроенный BusyBox в KernelSU находится в каталоге `/data/adb/ksu/bin/busybox`, а в Magisk - в каталоге `/data/adb/magisk/busybox`. **Обратите внимание, что это внутреннее поведение KernelSU и в будущем оно может измениться!**
26 | - KernelSU не поддерживает файлы `.replace`; однако KernelSU поддерживает переменные `REMOVE` и `REPLACE` для удаления или замены файлов и папок.
27 |
--------------------------------------------------------------------------------
/website/docs/ru_RU/guide/hidden-features.md:
--------------------------------------------------------------------------------
1 | # Скрытые возможности
2 |
3 | ## .ksurc
4 |
5 | По умолчанию `/system/bin/sh` загружает `/system/etc/mkshrc`.
6 |
7 | Вы можете заставить su загружать пользовательский rc-файл, создав файл `/data/adb/ksu/.ksurc`.
--------------------------------------------------------------------------------
/website/docs/ru_RU/guide/how-to-build.md:
--------------------------------------------------------------------------------
1 | # Как собрать KernelSU?
2 |
3 | Прежде всего, необходимо ознакомиться с официальной документацией Android по сборке ядра:
4 |
5 | 1. [Сборка ядер](https://source.android.com/docs/setup/build/building-kernels)
6 | 2. [Сборки релизов GKI](https://source.android.com/docs/core/architecture/kernel/gki-release-builds)
7 |
8 | ::: warning
9 | Эта страница предназначена для устройств GKI, если вы используете старое ядро, пожалуйста, обратитесь к [Как интегрировать KernelSU для не GKI ядер?](how-to-integrate-for-non-gki).
10 | :::
11 |
12 | ## Сборка ядра
13 |
14 | ### Синхронизация исходного кода ядра
15 |
16 | ```sh
17 | repo init -u https://android.googlesource.com/kernel/manifest
18 | mv .repo/manifests
19 | repo init -m manifest.xml
20 | repo sync
21 | ```
22 |
23 | Файл `` - это файл манифеста, который может однозначно определять сборку, с его помощью можно выполнить пересборку. Файл манифеста следует загрузить с сайта [Сборки релизов Google GKI](https://source.android.com/docs/core/architecture/kernel/gki-release-builds)
24 |
25 | ### Построение
26 |
27 | Пожалуйста, сначала ознакомьтесь с [официальной документацией](https://source.android.com/docs/setup/build/building-kernels).
28 |
29 | Например, нам необходимо собрать образ ядра aarch64:
30 |
31 | ```sh
32 | LTO=thin BUILD_CONFIG=common/build.config.gki.aarch64 build/build.sh
33 | ```
34 |
35 | Не забудьте добавить флаг `LTO=thin`, иначе сборка может завершиться неудачей, если память вашего компьютера меньше 24 Гб.
36 |
37 | Начиная с Android 13, сборка ядра осуществляется с помощью `bazel`:
38 |
39 | ```sh
40 | tools/bazel build --config=fast //common:kernel_aarch64_dist
41 | ```
42 |
43 | ## Сборка ядра с помощью KernelSU
44 |
45 | Если вы успешно собрали ядро, то собрать KernelSU очень просто, выберите любой запуск в корневом каталоге исходного кода ядра:
46 |
47 | - Последний тэг(стабильный)
48 |
49 | ```sh
50 | curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash -
51 | ```
52 |
53 | - Основная ветвь(разработка)
54 |
55 | ```sh
56 | curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash -s main
57 | ```
58 |
59 | - Выбранный тэг(Например, версия v0.5.2)
60 |
61 | ```sh
62 | curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash -s v0.5.2
63 | ```
64 |
65 | А затем пересоберите ядро и получите образ ядра с KernelSU!
66 |
--------------------------------------------------------------------------------
/website/docs/ru_RU/guide/unofficially-support-devices.md:
--------------------------------------------------------------------------------
1 | # Неофициально поддерживаемые устройства
2 |
3 | ::: warning
4 | На этой странице представлены ядра для устройств, не поддерживающих ГКИ и поддерживающих KernelSU, которые поддерживаются другими разработчиками.
5 | :::
6 |
7 | ::: warning
8 | Эта страница предназначена только для поиска исходного кода, соответствующего вашему устройству, и **НЕ** означает, что исходный код был проверен _разработчиками KernelSU_. Вы должны использовать его на свой страх и риск.
9 | :::
10 |
11 |
14 |
15 |
31 |
--------------------------------------------------------------------------------
/website/docs/ru_RU/guide/what-is-kernelsu.md:
--------------------------------------------------------------------------------
1 | # Что такое KernelSU? {#introduction}
2 |
3 | KernelSU - это root-решение для устройств Android GKI, работающее в режиме ядра и предоставляющее root-права пользовательским приложениям непосредственно в пространстве ядра.
4 |
5 | ## Особенности {#features}
6 |
7 | Основной особенностью KernelSU является то, что он **основан на ядре**. KernelSU работает в режиме ядра, поэтому он может предоставить интерфейс ядра, которого раньше не было. Например, мы можем добавить аппаратную точку останова любому процессу в режиме ядра; мы можем получить доступ к физической памяти любого процесса без чьего-либо ведома; мы можем перехватить любой syscall в пространстве ядра; и т.д.
8 |
9 | Кроме того, KernelSU предоставляет систему модулей через overlayfs, что позволяет загружать в систему пользовательские плагины. Также предусмотрен механизм модификации файлов в разделе `/system`.
10 |
11 | ## Как использовать {#how-to-use}
12 |
13 | Пожалуйста, обратитесь к: [Установка](installation)
14 |
15 | ## Как собрать {#how-to-build}
16 |
17 | [Как собрать](how-to-build)
18 |
19 | ## Обсуждение {#discussion}
20 |
21 | - Telegram: [@KernelSU](https://t.me/KernelSU)
22 |
--------------------------------------------------------------------------------
/website/docs/ru_RU/index.md:
--------------------------------------------------------------------------------
1 | ---
2 | layout: home
3 | title: Основанное на ядре root-решение для Android
4 |
5 | hero:
6 | name: KernelSU
7 | text: Основанное на ядре root-решение для Android
8 | tagline: ""
9 | image:
10 | src: /logo.png
11 | alt: KernelSU
12 | actions:
13 | - theme: brand
14 | text: Начало работы
15 | link: /ru_RU/guide/what-is-kernelsu
16 | - theme: alt
17 | text: Посмотр на GitHub
18 | link: https://github.com/tiann/KernelSU
19 |
20 | features:
21 | - title: Основанный на ядре
22 | details: KernelSU работает в режиме ядра Linux, он имеет больше контроля над пользовательскими приложениями.
23 | - title: Контроль доступа по белому списку
24 | details: Только приложение, которому предоставлено разрешение root, может получить доступ к `su`, другие приложения не могут воспринимать su.
25 | - title: Ограниченные root-права
26 | details: KernelSU позволяет вам настраивать uid, gid, группы, возможности и правила SELinux для su. Заприте root-власть в клетке.
27 | - title: Модульность и открытый исходный код
28 | details: KernelSU поддерживает модификацию /system бессистемно с помощью overlayfs и имеет открытый исходный код под лицензией GPL-3.
29 |
30 |
--------------------------------------------------------------------------------
/website/docs/vi_VN/guide/difference-with-magisk.md:
--------------------------------------------------------------------------------
1 | # Sự khác biệt với Magisk
2 |
3 | Mặc dù có nhiều điểm tương đồng giữa mô-đun KernelSU và mô-đun Magisk nhưng chắc chắn vẫn có một số khác biệt do cơ chế triển khai hoàn toàn khác nhau của chúng. Nếu muốn mô-đun của mình chạy trên cả Magisk và KernelSU, bạn phải hiểu những khác biệt này.
4 |
5 | ## Điểm tương đồng
6 |
7 | - Định dạng file mô-đun: đều sử dụng định dạng zip để sắp xếp các mô-đun và định dạng của các mô-đun gần như giống nhau
8 | - Thư mục cài đặt mô-đun: cả hai đều nằm trong `/data/adb/modules`
9 | - systemless: cả hai đều hỗ trợ sửa đổi /system theo cách không có hệ thống thông qua các mô-đun
10 | - post-fs-data.sh: thời gian thực hiện và ngữ nghĩa hoàn toàn giống nhau
11 | - service.sh: thời gian thực hiện và ngữ nghĩa hoàn toàn giống nhau
12 | - system.prop: hoàn toàn giống nhau
13 | - sepolicy.rule: hoàn toàn giống nhau
14 | - BusyBox: các tập lệnh được chạy trong BusyBox với "standalone mode" được bật trong cả hai trường hợp
15 |
16 | ## Điểm khác biệt
17 |
18 | Trước khi hiểu sự khác biệt, bạn cần biết cách phân biệt mô-đun của bạn đang chạy trong KernelSU hay Magisk. Bạn có thể sử dụng biến môi trường `KSU` để phân biệt nó ở tất cả những nơi bạn có thể chạy tập lệnh mô-đun (`customize.sh`, `post-fs-data.sh`, `service.sh`). Trong KernelSU, biến môi trường này sẽ được đặt thành `true`.
19 |
20 | Dưới đây là một số khác biệt:
21 |
22 | - Không thể cài đặt các mô-đun KernelSU ở chế độ Recovery.
23 | - Các mô-đun KernelSU không có hỗ trợ tích hợp cho Zygisk (nhưng bạn có thể sử dụng các mô-đun Zygisk thông qua [ZygiskNext](https://github.com/Dr-TSNG/ZygiskNext).
24 | - Phương pháp thay thế hoặc xóa file trong module KernelSU hoàn toàn khác với Magisk. KernelSU không hỗ trợ phương thức `.replace`. Thay vào đó, bạn cần tạo một file cùng tên với `mknod filename c 0 0` để xóa file tương ứng.
25 | - Các thư mục của BusyBox khác nhau. BusyBox tích hợp trong KernelSU nằm ở `/data/adb/ksu/bin/busybox`, trong khi ở Magisk nó nằm ở `/data/adb/magisk/busybox`. **Lưu ý rằng đây là hoạt động nội bộ của KernelSU và có thể thay đổi trong tương lai!**
26 | - KernelSU không hỗ trợ file `.replace`; tuy nhiên, KernelSU hỗ trợ biến `REMOVE` và `REPLACE` để xóa hoặc thay thế các tệp và thư mục.
27 | - KernelSU thêm giai đoạn `boot-completed` để chạy một số script khi khởi động xong.
28 | - KernelSU thêm giai đoạn `post-mount` để chạy một số tập lệnh sau khi gắn overlayfs
29 |
--------------------------------------------------------------------------------
/website/docs/vi_VN/guide/hidden-features.md:
--------------------------------------------------------------------------------
1 | # Tính Năng Ẩn
2 |
3 | ## .ksurc
4 |
5 | Theo mặc định, `/system/bin/sh` tải `/system/etc/mkshrc`.
6 |
7 | Bạn có thể tạo su tải tệp rc tùy chỉnh bằng cách tạo tệp `/data/adb/ksu/.ksurc`.
8 |
--------------------------------------------------------------------------------
/website/docs/vi_VN/guide/how-to-build.md:
--------------------------------------------------------------------------------
1 | # Làm thế nào để xây dựng KernelSU?
2 |
3 | Trước tiên, bạn nên đọc tài liệu chính thức của Android để xây dựng kernel:
4 |
5 | 1. [Building Kernels](https://source.android.com/docs/setup/build/building-kernels?hl=vi)
6 | 2. [GKI Release Builds](https://source.android.com/docs/core/architecture/kernel/gki-release-builds?hl=vi)
7 |
8 | ::: warning
9 | Trang này dành cho thiết bị GKI, nếu bạn sử dụng kernel cũ, vui lòng tham khảo [cách tích hợp KernelSU cho kernel cũ](how-to-integrate-for-non-gki)
10 | :::
11 |
12 | ## Build Kernel
13 |
14 | ### Đồng bộ hóa mã nguồn kernel
15 |
16 | ```sh
17 | repo init -u https://android.googlesource.com/kernel/manifest
18 | mv .repo/manifests
19 | repo init -m manifest.xml
20 | repo sync
21 | ```
22 |
23 | `` là một tệp kê khai có thể xác định duy nhất một bản dựng, bạn có thể sử dụng tệp kê khai đó để thực hiện một bản dựng có thể dự đoán lại. Bạn nên tải xuống tệp kê khai từ [Google GKI release builds](https://source.android.com/docs/core/architecture/kernel/gki-release-builds?hl=vi)
24 |
25 | ### Build
26 |
27 | Trước tiên, vui lòng kiểm tra [tài liệu chính thức](https://source.android.com/docs/setup/build/building-kernels?hl=vi).
28 |
29 | Ví dụ: chúng ta cần xây dựng kernel image aarch64:
30 |
31 | ```sh
32 | LTO=thin BUILD_CONFIG=common/build.config.gki.aarch64 build/build.sh
33 | ```
34 |
35 | Đừng quên thêm cờ `LTO=thin`, nếu không quá trình xây dựng có thể thất bại nếu bộ nhớ máy tính của bạn nhỏ hơn 24Gb.
36 |
37 | Bắt đầu từ Android 13, kernel được xây dựng bởi `bazel`:
38 |
39 | ```sh
40 | tools/bazel build --config=fast //common:kernel_aarch64_dist
41 | ```
42 |
43 | ## Build Kernel với KernelSU
44 |
45 | Nếu bạn có thể build kernel thành công thì việc xây dựng KernelSU thật dễ dàng, Chọn bất kỳ một lần chạy trong thư mục gốc nguồn Kernel:
46 |
47 | - Thẻ mới nhất (ổn định)
48 |
49 | ```sh
50 | curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash -
51 | ```
52 |
53 | - nhánh chính (dev)
54 |
55 | ```sh
56 | curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash -s main
57 | ```
58 |
59 | - Chọn thẻ (chẳng hạn như v0.5.2)
60 |
61 | ```sh
62 | curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash -s v0.5.2
63 | ```
64 |
65 | Và sau đó build lại kernel và bạn sẽ có được image kernel với KernelSU!
66 |
--------------------------------------------------------------------------------
/website/docs/vi_VN/guide/unofficially-support-devices.md:
--------------------------------------------------------------------------------
1 | # Thiết bị hỗ trợ không chính thức
2 |
3 | ::: warning
4 | Đây là trang liệt kê kernel cho các thiết bị không dùng GKI được hỗ trợ bởi các lập trình viên khác.
5 |
6 | :::
7 |
8 | ::: warning
9 | Trang này chỉ để cho bạn tìm thấy source cho thiết bị của bạn, nó **HOÀN TOÀN KHÔNG** được review bởi _lập trình viên của KernelSU_. Vậy nên hãy chấp nhận rủi ro khi sử dụng chúng.
10 |
11 | :::
12 |
13 |
16 |
17 |
33 |
--------------------------------------------------------------------------------
/website/docs/vi_VN/guide/what-is-kernelsu.md:
--------------------------------------------------------------------------------
1 | # KernelSU là gì?
2 |
3 | KernelSU là một giải pháp root cho các thiết bị Android GKI, nó hoạt động ở chế độ kernel và cấp quyền root cho ứng dụng không gian người dùng trực tiếp trong không gian kernel.
4 |
5 | ## Tính năng
6 |
7 | Tính năng chính của KernelSU là **Kernel-based** (dựa trên Kernel). KernelSU hoạt động ở chế độ kernel nên nó có thể cung cấp giao diện kernel mà chúng ta chưa từng có trước đây. Ví dụ: chúng ta có thể thêm điểm dừng phần cứng vào bất kỳ quy trình nào ở chế độ kernel; Chúng ta có thể truy cập bộ nhớ vật lý của bất kỳ quy trình nào mà không bị phát hiện; Chúng ta còn có thể chặn bất kỳ syscall nào trong không gian kernel; v.v.
8 |
9 | Ngoài ra, KernelSU còn cung cấp hệ thống mô-đun thông qua lớp phủ, cho phép bạn tải plugin tùy chỉnh vào hệ thống. Nó cũng cung cấp một cơ chế để sửa đổi các tập tin trong phân vùng `/system`.
10 |
11 | ## Hướng dẫn sử dụng
12 |
13 | Xin hãy xem: [Cách cài đặt](installation)
14 |
15 | ## Cách để build
16 |
17 | [Cách để build](how-to-build)
18 |
19 | ## Thảo luận
20 |
21 | - Telegram: [@KernelSU](https://t.me/KernelSU)
22 |
--------------------------------------------------------------------------------
/website/docs/vi_VN/index.md:
--------------------------------------------------------------------------------
1 | ---
2 | layout: home
3 | title: Giải pháp root dựa trên kernel dành cho Android
4 |
5 | hero:
6 | name: KernelSU
7 | text: Giải pháp root dựa trên kernel dành cho Android
8 | tagline: ""
9 | image:
10 | src: /logo.png
11 | alt: KernelSU
12 | actions:
13 | - theme: brand
14 | text: Bắt Đầu
15 | link: /guide/what-is-kernelsu
16 | - theme: alt
17 | text: Xem trên GitHub
18 | link: https://github.com/tiann/KernelSU
19 |
20 | features:
21 | - title: Dựa trên Kernel
22 | details: KernelSU đang hoạt động ở chế độ kernel Linux, nó có nhiều quyền kiểm soát hơn đối với các ứng dụng userspace.
23 | - title: Kiểm soát truy cập bằng whitelist
24 | details: Chỉ ứng dụng được cấp quyền root mới có thể truy cập `su`, các ứng dụng khác không thể nhận được su.
25 | - title: Quyền root bị hạn chế
26 | details: KernelSU cho phép bạn tùy chỉnh uid, gid, group, capabilities và các quy tắc SELinux của su. Giới hạn sức mạnh của root.
27 | - title: Mô-đun & Nguồn mở
28 | details: KernelSU hỗ trợ sửa đổi /system một cách systemless bằng overlayfs và nó có nguồn mở theo GPL-3.
29 |
30 |
--------------------------------------------------------------------------------
/website/docs/zh_CN/guide/difference-with-magisk.md:
--------------------------------------------------------------------------------
1 | # KernelSU 模块与 Magisk 的差异 {#title}
2 |
3 | 虽然 KernelSU 模块与 Magisk 模块有很多相似之处,但由于它们的实现机制完全不同,因此不可避免地会有一些差异;如果你希望你的模块能同时在 Magisk 与 KernelSU 中运行,那么你必须了解这些差异。
4 |
5 | ## 相同之处 {#similarities}
6 |
7 | - 模块文件格式: 都以 zip 的方式组织模块,并且模块的格式几乎相同
8 | - 模块安装目录: 都在 `/data/adb/modules`
9 | - systemless: 都支持通过模块的形式以 systemless 修改 /system
10 | - `post-fs-data.sh`: 执行时机完全一致,语义也完全一致
11 | - `service.sh`: 执行时机完全一致,语义也完全一致
12 | - `system.prop`: 完全相同
13 | - `sepolicy.rule`: 完全相同
14 | - BusyBox:脚本都在 BusyBox 中以“独立模式”运行
15 |
16 | ## 不同之处 {#differences}
17 |
18 | 在了解不同之处之前,你需要知道如何区分你的模块是运行在 KernelSU 还是运行在 Magisk 之中;在所有你可以运行模块脚本的地方(`customize.sh`, `post-fs-data.sh`, `service.sh`),你都可以通过环境变量`KSU` 来区分,在 KernelSU 中,这个环境变量将被设置为 `true`。
19 |
20 | 以下是一些不同之处:
21 |
22 | 1. KernelSU 的模块不支持在 Recovery 中安装。
23 | 2. KernelSU 的模块没有内置的 Zygisk 支持(但你可以通过 [ZygiskNext](https://github.com/Dr-TSNG/ZygiskNext) 来使用 Zygisk 模块)。
24 | 3. KernelSU 模块替换或者删除文件与 Magisk 完全不同。KernelSU 不支持 `.replace` 方式,相反,你需要通过 `mknod filename c 0 0` 创建同名文件夹来删除对应文件。
25 | 4. BusyBox 的目录不同;KernelSU 内置的 BusyBox 在 `/data/adb/ksu/bin/busybox` 而 Magisk 在 `/data/adb/magisk/busybox`;**注意此为 KernelSU 内部行为,未来可能会更改!**
26 | 5. KernelSU 不支持 `.replace` 文件;但 KernelSU 支持 `REPLACE` 和 `REMOVE` 变量。
27 | 6. KernelSU 新增了一种脚本 `boot-completed.sh`,以便在 Android 系统启动后运行某些任务。
28 | 7. KernelSU 新增了一种脚本 `post-mount.sh`,以便在 Overlayfs 挂载后运行某些任务。
29 |
--------------------------------------------------------------------------------
/website/docs/zh_CN/guide/faq.md:
--------------------------------------------------------------------------------
1 | # 常见问题
2 |
3 | ## KernelSU 是否支持我的设备?
4 |
5 | 首先,您的设备应该能够解锁 bootloader。 如果不能,则不支持。
6 |
7 | 然后在你的设备上安装 KernelSU 管理器并打开它,如果它显示 `不支持` ,那么你的设备没有官方支持的开箱即用的 boot image;但你可以自己编译内核集成 KernelSU 进而使用它。
8 |
9 | ## KernelSU 是否需要解锁 Bootloader?
10 |
11 | 当然需要。
12 |
13 | ## KernelSU 是否支持模块?
14 |
15 | 支持。请查阅 [模块](module.md)。
16 |
17 | ## KernelSU 是否支持 Xposed?
18 |
19 | 支持。LSPosed 可以在 [ZygiskNext](https://github.com/Dr-TSNG/ZygiskNext) 的支持下正常运行。
20 |
21 | ## KernelSU 支持 Zygisk 吗?
22 |
23 | KernelSU 本体不支持 Zygisk,但是你可以用 [ZygiskNext](https://github.com/Dr-TSNG/ZygiskNext) 来使用 Zygisk 模块。
24 |
25 | ## KernelSU 与 Magisk 兼容吗?
26 |
27 | KernelSU 的模块系统与 Magisk 的 magic mount 有冲突,如果 KernelSU 中启用了任何模块,那么整个 Magisk 将无法工作。
28 |
29 | 但是如果你只使用 KernelSU 的 `su`,那么它会和 Magisk 一起工作:KernelSU 修改 `kernel` 、 Magisk 修改 `ramdisk`,它们可以一起工作。
30 |
31 | ## KernelSU 会替代 Magisk 吗?
32 |
33 | 我们不这么认为,这也不是我们的目标。Magisk 对于用户空间 root 解决方案来说已经足够好了,它会存活很久。KernelSU 的目标是为用户提供内核接口,而不是替代 Magisk。
34 |
35 | ## KernelSU 可以支持非 GKI 设备吗?
36 |
37 | 可以。但是你应该下载内核源代码并将 KernelSU 集成到源代码树中并自己编译内核。
38 |
39 | ## KernelSU 支持 Android 12 以下的设备吗?
40 |
41 | 影响 KernelSU 兼容性的是设备内核的版本,它与设备的 Android 版本没有直接的关系。唯一有关联的是:**出厂** Android 12 的设备,一定是 5.10 或更高的内核(GKI 设备);因此结论如下:
42 |
43 | 1. 出厂 Android 12 的设备必定是支持的(GKI 设备)
44 | 2. 旧版本内核的设备(即使是 Android 12,也可能是旧内核)是兼容的(你需要自己编译内核)
45 |
46 | ## KernelSU 可以支持旧内核吗?
47 |
48 | 可以,目前最低支持到 4.14;更低的版本你需要手动移植它,欢迎 PR !
49 |
50 | ## 如何为旧内核集成 KernelSU?
51 |
52 | 参考[教程](how-to-integrate-for-non-gki)
53 |
54 | ## 为什么我手机系统是 Android 13,但内核版本却是 "android12-5.10"?
55 |
56 | 内核版本与 Android 版本无关,如果你需要刷入 KernelSU,请永远使用**内核版本**而非 Android 版本,如果你为 "android12-5.10" 的设备刷入 Android 13 的内核,等待你的将是 bootloop.
57 |
58 | ## 我是 GKI1.0, 能用 KernelSU 吗?
59 |
60 | GKI1 跟 GKI2 完全是两个东西,所以你需要自行编译内核。
61 |
62 | ## 如何把 `/system` 变成挂载为可读写?
63 |
64 | 我们不建议你直接修改系统分区,你应该使用[模块功能](module.md) 来做修改;如果你执意要这么做,可以看看 [magisk_overlayfs](https://github.com/HuskyDG/magic_overlayfs)
65 |
66 | ## KernelSU 能修改 hosts 吗,我如何使用 AdAway?
67 |
68 | 当然可以。但这个功能 KernelSU 没有内置,你可以安装这个 [systemless-hosts](https://github.com/symbuzzer/systemless-hosts-KernelSU-module)
69 |
70 | ## 为什么有个 1 TB 的超大文件?
71 |
72 | 1 TB 大小的 `modules.img` 是一个磁盘镜像文件,**不要担心它的大小**,它是一种被称之为[稀疏文件](https://en.wikipedia.org/wiki/Sparse_file)的文件格式,它的实际大小只有你使用的模块的大小,并且你在删除模块后它会动态缩小;它并不实际占用 1 TB 大小的磁盘空间(实际上你手机可能并没有这么多空间)。
73 |
74 | 如果你真的对这个文件的大小感到不爽,你可以使用 `resize2fs -M` 命令让它变成实际大小;但此时模块可能无法正常工作,我们也不会为此提供任何支持。
75 |
--------------------------------------------------------------------------------
/website/docs/zh_CN/guide/hidden-features.md:
--------------------------------------------------------------------------------
1 | # 隐藏功能
2 |
3 | ## ksurc
4 |
5 | 默认情况下,`/system/bin/sh` 会加载 `/system/etc/mkshrc`。
6 |
7 | 可以通过创建 `/data/adb/ksu/.ksurc` 文件来让 su 加载该文件而不是 `/system/etc/mkshrc`。
--------------------------------------------------------------------------------
/website/docs/zh_CN/guide/how-to-build.md:
--------------------------------------------------------------------------------
1 | # 如何构建 KernelSU?
2 |
3 | 首先,您应该阅读内核构建的 Android 官方文档:
4 |
5 | 1. [构建内核](https://source.android.com/docs/setup/build/building-kernels)
6 | 2. [通用内核映像 (GKI) 发布构建](https://source.android.com/docs/core/architecture/kernel/gki-release-builds)
7 |
8 | ::: warning
9 | 本文档适用于 GKI 设备,如果你是旧内核,请参考[如何为非GKI设备集成 KernelSU](how-to-integrate-for-non-gki)
10 | :::
11 |
12 | ## 构建内核
13 |
14 | ### 同步内核源码
15 |
16 | ```sh
17 | repo init -u https://android.googlesource.com/kernel/manifest
18 | mv .repo/manifests
19 | repo init -m manifest.xml
20 | repo sync
21 | ```
22 |
23 | `` 是一个可以唯一确定构建的清单文件,您可以使用该清单进行可重新预测的构建。 您应该从 [通用内核映像 (GKI) 发布构建](https://source.android.com/docs/core/architecture/kernel/gki-release-builds) 下载清单文件
24 |
25 | ### 构建
26 |
27 | 请先查看 [官方文档](https://source.android.com/docs/setup/build/building-kernels)。
28 |
29 | 例如,我们需要构建 aarch64 内核镜像:
30 |
31 | ```sh
32 | LTO=thin BUILD_CONFIG=common/build.config.gki.aarch64 build/build.sh
33 | ```
34 |
35 | 不要忘记添加 `LTO=thin`, 否则,如果您的计算机内存小于 24GB,构建可能会失败.
36 |
37 | 从 Android 13 开始,内核由 `bazel` 构建:
38 |
39 | ```sh
40 | tools/bazel build --config=fast //common:kernel_aarch64_dist
41 | ```
42 |
43 | ## 使用 KernelSU 构建内核
44 |
45 | 如果您可以成功构建内核,那么构建 KernelSU 就很容易,根据自己的需求在内核源代码根目录中运行以下任一命令:
46 |
47 | ::: code-group
48 |
49 | ```sh[最新 tag(稳定版本)]
50 | curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash -
51 | ```
52 |
53 | ```sh[main 分支(开发版本)]
54 | curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash -s main
55 | ```
56 |
57 | ```sh[指定 tag(比如 v0.5.2)]
58 | curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash -s v0.5.2
59 | ```
60 |
61 | :::
62 |
63 | 然后重建内核,您将获得带有 KernelSU 的内核映像!
64 |
--------------------------------------------------------------------------------
/website/docs/zh_CN/guide/module-webui.md:
--------------------------------------------------------------------------------
1 | # 模块 WebUI
2 |
3 | KernelSU 的模块除了执行启动脚本和修改系统文件之外,还支持显示 UI 界面和与用户交互。
4 |
5 | 你可以通过任何 Web 技术编写 HTML + CSS + JavaScript 页面,KernelSU 的管理器将通过 WebView 显示这些页面。此外,KernelSU 还提供了一些用于与系统交互的 JavaScript API,例如执行 shell 命令。
6 |
7 | ## WebUI 根目录
8 |
9 | Web 资源文件应放置在模块根目录的 `webroot` 子目录中,并且其中**必须**有一个名为`index.html`的文件,该文件是模块页面入口。包含 Web 界面的最简单的模块结构如下:
10 |
11 | ````txt
12 | ❯ tree .
13 | .
14 | |-- module.prop
15 | `-- webroot
16 | `--index.html
17 | ````
18 |
19 | :::warning
20 | 安装模块时,KernelSU 会自动设置 `webroot` 目录的权限和 SELinux context,如果您不知道自己在做什么,请不要自行设置该目录的权限!
21 | :::
22 |
23 | 如果您的页面包含 CSS 和 JavaScript,您也需要将其放入此目录中。
24 |
25 | ## JavaScript API
26 |
27 | 如果只是一个显示页面,那它和普通网页没有什么区别。更重要的是,KernelSU 提供了一系列的系统 API,可以让您实现模块特有的功能。
28 |
29 | KernelSU 提供了一个 JavaScript 库并[在 npm 上发布](https://www.npmjs.com/package/kernelsu),您可以在网页的 JavaScript 代码中使用它。
30 |
31 | 例如,您可以执行 shell 命令来获取特定配置或修改属性:
32 |
33 | ```JavaScript
34 | import { exec } from 'kernelsu';
35 |
36 | const { errno, stdout } = await exec("getprop ro.product.model");
37 | ````
38 |
39 | 再比如,你可以让网页全屏显示,或者显示一个 Toast。
40 |
41 | [API 文档](https://www.npmjs.com/package/kernelsu)
42 |
43 | 如果您发现现有的 API 不能满足您的需求或者使用不方便,欢迎[在这里](https://github.com/tiann/KernelSU/issues)给我们提出建议!
44 |
45 | ## 一些技巧
46 |
47 | 1. 您可以正常使用`localStorage`存储一些数据,但卸载管理器后,这些数据将会丢失。 如果需要持久保存,可以自己将数据写入某个目录。
48 | 2. 对于简单的页面,我建议您使用 [parceljs](https://parceljs.org/) 进行打包。它零配置,使用非常方便。不过,如果你是前端高手或者有自己的喜好,那就选择你喜欢的吧!
49 |
--------------------------------------------------------------------------------
/website/docs/zh_CN/guide/rescue-from-bootloop.md:
--------------------------------------------------------------------------------
1 | # 救砖 {#intruduction}
2 |
3 | 在刷机的时候我们可能会遇到设备“变砖”的情况,理论上讲,如果你只是使用 fastboot 刷入 boot 分区或者安装不合适的模块导致设备无法启动,那么这都可以通过合适的操作恢复手机;本文档旨在提供一些急救方法让你可以在“变砖”中恢复。
4 |
5 | ## 刷入 boot 变砖
6 |
7 | 在 KernelSU 中,刷入 boot 变砖有如下可能:
8 |
9 | 1. 你刷入了错误格式的 boot 镜像。比如你的手机 boot 格式是 `gz` 的,但你刷入了 `lz4` 格式的镜像,那么此时手机无法启动。
10 | 2. 你的手机需要关闭 avb 验证才能正常启动(注意这通常意味着需要清除手机所有数据)。
11 | 3. 你的 kernel 有某些 bug 或者你的 kernel 不适合你这个手机刷入。
12 |
13 | 无论哪种情况,你都可以通过**刷入原厂 boot**恢复;因此,在安装教程最开始,我们已经强烈建议大家,在刷机之前备份自己的原厂 boot!如果你没有备份,那么你可以通过其他跟你相同设备的童鞋或者官方固件包获取原厂 boot。
14 |
15 | ## 刷入模块变砖
16 |
17 | 刷入模块变砖可能是大家遇到更常见的情况,但是这里必须郑重告诉大家:**请勿刷入来路不明的模块!!**。因为模块其实是有 root 权限的,它完全可能导致你的设备发生不可逆的损坏!
18 |
19 | ### 普通模块变砖
20 |
21 | 如果大家刷入某些开源的或者被证明是安全的模块使得手机无法启动,那么这种情况在 KernelSU 中非常容易恢复,完全无需担心。KernelSU 内置了如下两种机制来救砖:
22 |
23 | 1. AB 更新
24 | 2. 音量键救砖
25 |
26 | #### AB 更新 {#ab-update}
27 |
28 | KernelSU 的模块更新借鉴了 Android 系统 OTA 更新时的 AB 更新机制,如果你安装了新模块或者对已有模块有更新操作,不会直接操作当前使用的模块文件,而是会把所有模块构建成另外一个 update 镜像;系统重启之后,会使用这个 update 镜像尝试启动一次,如果 Android 系统成功启动,才会真正更新模块。
29 |
30 | 因此,最简单最常用的救砖方法就是:**强制重启一次**。如果你在刷某个模块之后系统无法启动,你可以长按电源键超过 10 秒,系统会自动重启;重启之后会回滚到更新模块之前的状态,之前更新的模块会被自动禁用。
31 |
32 | #### 音量键救砖 {#volume-down}
33 |
34 | 如果 AB 更新依然无法解决,你可以尝试使用**安全模式**。进入安全模式之后,所有的模块都会被禁用。
35 |
36 | 进入安全模式的方法有两种:
37 |
38 | 1. 某些系统自带的安全模式;有些系统是长按音量下,有些系统(比如MIUI)可以在 Recovery 中开启安全模式。进入系统的安全模式后,KernelSU 也会进入安全模式,自动禁用模块。
39 | 2. KernelSU 内置的安全模式;操作方法:开机第一屏后,**连续按音量下键超过三次**。注意是按下-松开、按下-松开、按下-松开,不是按着不动。
40 |
41 | 进入安全模式以后,KernelSU 管理器的模块页面所有模块都被禁用,但你可以执行“卸载”操作,卸载可能会有问题的模块。
42 |
43 | 内置的安全模式是在内核里面实现的,因此不会出现按键事件被拦截导致捕获不到的情况。不过对于非 GKI 内核,可能需要手动集成代码,可以参考官网教程。
44 |
45 | ### 格机或其他病毒模块变砖
46 |
47 | 如果以上方法无法拯救你的设备,那么很有可能你装的模块有恶意操作或者通过其他方式损坏了你的设备,这种情况下,只有两个建议:
48 |
49 | 1. 清除数据后刷入完整刷入官方系统。
50 | 2. 咨询售后服务。
51 |
--------------------------------------------------------------------------------
/website/docs/zh_CN/guide/unofficially-support-devices.md:
--------------------------------------------------------------------------------
1 | # 非官方支持设备
2 |
3 | ::: warning
4 | 本文档列出由其他开发者维护的支持 KernelSU 的非 GKI 设备内核
5 | :::
6 |
7 | ::: warning
8 | 本文档仅方便查找设备对应源码,这并不意味该源码**被** KernelSU 开发者**审查**,你应自行承担使用风险。
9 | :::
10 |
11 |
14 |
15 |
--------------------------------------------------------------------------------
/website/docs/zh_CN/guide/what-is-kernelsu.md:
--------------------------------------------------------------------------------
1 | # 什么是 KernelSU? {#introduction}
2 |
3 | KernelSU 是 Android GKI 设备的 root 解决方案,它工作在内核模式,并直接在内核空间中为用户空间应用程序授予 root 权限。
4 |
5 | ## 功能 {#features}
6 |
7 | KernelSU 的主要特点是它是**基于内核的**。KernelSU 运行在内核空间,所以它可以提供我们以前从未有过的内核接口。例如,我们可以在内核模式下为任何进程添加硬件断点;我们可以在任何进程的物理内存中访问,而无人知晓;我们可以在内核空间拦截任何系统调用; 等等。
8 |
9 | KernelSU 还提供了一个基于 overlayfs 的模块系统,允许您加载自定义插件到系统中。它还提供了一种修改 /system 分区中文件的机制。
10 |
11 | ## 如何使用 {#how-to-use}
12 |
13 | 请参考: [安装](installation)
14 |
15 | ## 如何构建 {#how-to-build}
16 |
17 | 请参考: [如何构建](how-to-build)
18 |
19 | ## 讨论 {#discussion}
20 |
21 | - Telegram: [@KernelSU](https://t.me/KernelSU)
22 |
--------------------------------------------------------------------------------
/website/docs/zh_CN/index.md:
--------------------------------------------------------------------------------
1 | ---
2 | layout: home
3 | title: Android 上的内核级的 root 方案
4 |
5 | hero:
6 | name: KernelSU
7 | text: Android 上的内核级的 root 方案
8 | tagline: ""
9 | image:
10 | src: /logo.png
11 | alt: KernelSU
12 | actions:
13 | - theme: brand
14 | text: 开始了解
15 | link: /zh_CN/guide/what-is-kernelsu
16 | - theme: alt
17 | text: 在 GitHub 中查看
18 | link: https://github.com/tiann/KernelSU
19 |
20 | features:
21 | - title: 基于内核
22 | details: KernelSU 运行在内核空间,对用户空间应用有更强的掌控。
23 | - title: 白名单访问控制
24 | details: 只有被授权的 App 才可以访问 `su`,而其他 App 无法感知其存在。
25 | - title: 受限制的 root 权限
26 | details: KernelSU 可以自定义 `su` 的 uid, gid, groups, capabilities 和 SELinux 规则:把 root 权限关进笼子里。
27 | - title: 模块系统 & 开源
28 | details: KernelSU 支持通过 overlayfs 修改 /system,并且是 GPL-3 许可下的开源项目。
29 |
30 |
--------------------------------------------------------------------------------
/website/docs/zh_TW/guide/difference-with-magisk.md:
--------------------------------------------------------------------------------
1 | # KernelSU 與 Magisk 的差異 {#difference-with-magisk}
2 |
3 | 儘管 KernelSU 模組和 Magisk 模組之間有許多相似之處,但由於它們完全不同的實作機制,不可避免地存在一些差異;如果您想讓您的模組同時在 Magisk 和 KernelSU 上運作,那麼您必須瞭解這些差異。
4 |
5 | ## 相同之處 {#similarities}
6 |
7 | - 模組檔案格式:都以 Zip 的格式組織模組,並且模組的格式幾乎相同
8 | - 模組安裝目錄:都位於 `/data/adb/modules`
9 | - 無系統修改:都支援透過模組以無系統修改的方式來更改 `/system`
10 | - `post-fs-data.sh`:執行階段和語義完全相同
11 | - `service.sh`:執行階段和語義完全相同
12 | - `system.prop`:完全相同
13 | - `sepolicy.rule`:完全相同
14 | - BusyBox:指令碼在 BusyBox 中以「獨立模式」執行
15 |
16 | ## 不同之處 {#differences}
17 |
18 | 在瞭解不同之處之前,您需要知道如何區分您的模組是在 KernelSU 還是 Magisk 中執行;在所有可以執行模組指令碼的位置 (`customize.sh`, `post-fs-data.sh`, `service.sh`),您都可以使用環境變數 `KSU` 來區分,在 KernelSU 中,這個環境變數將被設定為 `true`。
19 |
20 | 以下是一些不同之處:
21 |
22 | 1. KernelSU 的模組無法在 Recovery 中安裝。
23 | 2. KernelSU 的模組沒有內建的 Zygisk 支援 (但您可以透過 [ZygiskNext](https://github.com/Dr-TSNG/ZygiskNext) 來使用 Zygisk 模組)。
24 | 3. KernelSU 模組取代或刪除檔案與 Magisk 完全不同。KernelSU 不支援 `.replace` 方法,相反,您需要透過 `mknod filename c 0 0` 建立相同名稱的資料夾以刪除對應檔案。
25 | 4. BusyBox 的目錄不同。KernelSU 內建的 BusyBox 在 `/data/adb/ksu/bin/busybox`,而 Magisk 在 `/data/adb/magisk/busybox`。**注意此為 KernelSU 內部行為,未來可能會變更!**
26 | 5. KernelSU 不支援 `.replace` 檔案;但 KernelSU 支援 `REPLACE` 和 `REMOVE` 變數以移除或取代檔案與資料夾。
27 | 6. KernelSU 新增了 `boot-completed` 階段以在啟動完成時執行一些腳本。
28 | 7. KernelSU 新增了 `post-mount` 階段,以便在掛載 overlayfs 後執行一些腳本。
29 |
--------------------------------------------------------------------------------
/website/docs/zh_TW/guide/hidden-features.md:
--------------------------------------------------------------------------------
1 | # 隱藏功能 {#hidden-features}
2 |
3 | ## .ksurc
4 |
5 | 預設狀況下,`/system/bin/sh` 會載入 `/system/etc/mkshrc`。
6 |
7 | 可以透過建立 `/data/adb/ksu/.ksurc` 檔案來讓 `su` 載入此檔案而非 `/system/etc/mkshrc`。
--------------------------------------------------------------------------------
/website/docs/zh_TW/guide/how-to-build.md:
--------------------------------------------------------------------------------
1 | # 如何建置 KernelSU? {#how-to-build-kernelsu}
2 |
3 | 首先,您需要閱讀核心建置的 Android 官方文件:
4 |
5 | 1. [建置核心](https://source.android.com/docs/setup/build/building-kernels)
6 | 2. [標準核心映像 (GKI) 發行組建](https://source.android.com/docs/core/architecture/kernel/gki-release-builds)
7 |
8 | ::: warning 警告
9 | 此文件適用於 GKI 裝置,如果您是舊版核心,請參閱[如何為非 GKI 裝置整合 KernelSU](how-to-integrate-for-non-gki)
10 | :::
11 |
12 | ## 建置核心 {#build-kernel}
13 |
14 | ### 同步核心原始碼 {#sync-the-kernel-source-code}
15 |
16 | ```sh
17 | repo init -u https://android.googlesource.com/kernel/manifest
18 | mv .repo/manifests
19 | repo init -m manifest.xml
20 | repo sync
21 | ```
22 |
23 | `` 是一個可以唯一確定組建的資訊清單,您可以使用這個資訊清單進行可重新預測的組建。您需要從[標準核心映像 (GKI) 發行組建](https://source.android.com/docs/core/architecture/kernel/gki-release-builds)下載資訊清單。
24 |
25 | ### 建置 {#build}
26 |
27 | 請先查看[官方文件](https://source.android.com/docs/setup/build/building-kernels)。
28 |
29 | 例如,我們需要建置 aarch64 核心映像:
30 |
31 | ```sh
32 | LTO=thin BUILD_CONFIG=common/build.config.gki.aarch64 build/build.sh
33 | ```
34 |
35 | 不要忘記新增 `LTO=thin`,否則,如果您的電腦記憶體小於 24GB,建置可能會失敗。
36 |
37 | 從 Android 13 開始,核心使用 `bazel` 建置:
38 |
39 | ```sh
40 | tools/bazel build --config=fast //common:kernel_aarch64_dist
41 | ```
42 |
43 | :::info 你可能需要知道...
44 | 對於某些 Android 14 核心,要使 Wi-Fi/藍牙正常工作,可能需要刪除所有受 GKI 保護的匯出:
45 |
46 | ```sh
47 | rm common/android/abi_gki_protected_exports_*
48 | ```
49 | :::
50 |
51 | ## 與 KernelSU 一起建置核心 {#build-kernel-with-kernelsu}
52 |
53 | 如果您可以成功建置核心,那麼建置 KernelSU 就會非常輕鬆,依自己的需求在核心原始碼根目錄中執行以下任一命令:
54 |
55 | ::: code-group
56 |
57 | ```sh[最新 tag (穩定版本)]
58 | curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash -
59 | ```
60 |
61 | ```sh[main 分支 (開發版本)]
62 | curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash -s main
63 | ```
64 |
65 | ```sh[選取 tag (例如 v0.5.2)]
66 | curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash -s v0.5.2
67 | ```
68 |
69 | :::
70 |
71 | 然後重新建置核心,您將會得到一個帶有 KernelSU 的核心映像!
72 |
--------------------------------------------------------------------------------
/website/docs/zh_TW/guide/module-webui.md:
--------------------------------------------------------------------------------
1 | # 模組 WebUI {#module-webui}
2 |
3 | KernelSU 的模組除了執行啟動腳本和修改系統檔案之外,還支援顯示 UI 介面和與使用者互動。
4 |
5 | 該模組可以透過任何 Web 技術編寫 HTML + CSS + JavaScript 頁面。 KernelSU的管理器將透過 WebView 顯示這些頁面。它還提供了一些用於與系統互動的 JavaScript API,例如執行 shell 命令。
6 |
7 | ## WebUI 根目錄 {#webroot-directory}
8 |
9 | Web資源應放置在模組根目錄的 `webroot` 子目錄中,並且其中**必須**有一個名為 `index.html` 的文件,該檔案是模組頁面入口。
10 |
11 | 包含Web介面的最簡單的模組結構如下:
12 |
13 | ```txt
14 | ❯ tree .
15 | .
16 | |-- module.prop
17 | `-- webroot
18 | `-- index.html
19 | ```
20 |
21 | :::warning 提醒
22 | 安裝模組時,KernelSU 將自動設定`webroot`的權限和 SELinux context。如果您不知道自己在做什麼,請不要自行設定該目錄的權限!
23 | :::
24 |
25 | 如果您的頁面包含 CSS 和 JavaScript,您也需要將其放入此目錄中。
26 |
27 | ## JavaScript API
28 |
29 | 如果只是一個顯示頁面,那和一般網頁沒有什麼不同。更重要的是,KernelSU 提供了一系列的系統 API,讓您可以實現模組獨特的功能。
30 |
31 | KernelSU [在 npm 上發布](https://www.npmjs.com/package/kernelsu)了一個 JavaScript 庫,您可以在網頁的 JavaScript 程式碼中使用它。
32 |
33 | 例如,您可以執行 shell 命令來取得特定配置或修改屬性:
34 |
35 | ```JavaScript
36 | import { exec } from 'kernelsu';
37 |
38 | const { errno, stdout } = exec("getprop ro.product.model");
39 | ```
40 |
41 | 再例如,你可以讓網頁全螢幕顯示,或是顯示一個 Toast。
42 |
43 | [API 文檔](https://www.npmjs.com/package/kernelsu)
44 |
45 | 如果您發現現有的 API 無法滿足您的需求或使用不方便,歡迎您在[這裡](https://github.com/tiann/KernelSU/issues)給我們建議!
46 |
47 | ## 一些技巧 {#some-tips}
48 |
49 | 1. 您可以正常使用 `localStorage` 來儲存一些數據,但解除安裝管理器後,這些數據將會遺失。如果需要持久保存,可以自行將資料寫入某個目錄。
50 | 2. 對於簡單的頁面,我建議您使用 [parceljs](https://parceljs.org/) 進行打包。它無須設定,使用非常方便。不過,如果你是前端高手或有自己的喜好,那就選擇你喜歡的吧!
51 |
--------------------------------------------------------------------------------
/website/docs/zh_TW/guide/rescue-from-bootloop.md:
--------------------------------------------------------------------------------
1 | # 搶救開機迴圈 {#intruduction}
2 |
3 | 在寫入裝置時,我們很可能會遇到裝置「變磚」的狀況,從理論上講,如果您只是使用 Fastboot 寫入 Boot 分區或者安裝不合適的模組導致裝置無法開機,那麼這都可以透過合適的作業還原您的手機;這個文件提供一些緊急方法可以讓您在「變磚」中還原。
4 |
5 | ## 寫入 Boot 時變磚 {#brick-by-flashing-boot-partition}
6 |
7 | 在 KernelSU 中,寫入 boot 時變磚有下列原因:
8 |
9 | 1. 你寫入了錯誤格式的 Boot 映像。比如您的手機 Boot 格式為 `gz`,但您寫入 `lz4` 格式的映像,那麼此時手機將無法開機。
10 | 2. 您的手機需要關閉 AVB 驗證才可正常開機 (這通常需要抹除手機上的所有資料)。
11 | 3. 您的核心存在某些錯誤或您的核心並不適合這部手機寫入。
12 |
13 | 無論哪種狀況,您都可以透過**寫入原廠 Boot** 還原;因此,在安裝教學最開始,我們已經強烈建議大家,在寫入之前備份自己的原廠 Boot!如果您沒有備份,那麼您可以透過其他與您相同裝置的使用者或官方韌體擷取 Boot。
14 |
15 | ## 安裝模組變磚 {#brick-by-modules}
16 |
17 | 安裝模組變磚可能是大家遇到的更常見的狀況,但是這裡要嚴正警示大家:**不要安裝未知來源的模組!!**。因為模組擁有 Root 權限,它能完全對您的裝置造成無法復原的損壞!
18 |
19 | ### 一般模組 {#normal-modules}
20 |
21 | 如果大家安裝了某些開放原始碼的或者被證明是安全的模組使手機無法開機,那麼這種狀況在 KernelSU 中非常容易還原,也無需擔心。KernelSU 內建了下列兩種機制以搶救您的裝置:
22 |
23 | 1. AB 更新
24 | 2. 透過按下「音量 -」搶救
25 |
26 | #### AB 更新 {#ab-update}
27 |
28 | KernelSU 的模組借鑒了 Android 系統 OTA 更新時的 AB 更新機制,如果您安裝了新模組或者對現存模組進行了更新作業,不會直接修改目前使用的模組檔案,而是會把所有模組建置為另外一個更新映像;系統重新啟動後,會使用這個更新映像嘗試重新啟動一次,如果 Android 系統成功開機,模組才會真正更新。
29 |
30 | 因此,最簡單最常用的搶救方法就是:**強制重新開機一次**。如果您在刷新某個模組之後系統無法開機,您可以長按電源按鈕超過 10 秒,系統會自動重新開機;模組會回復為更新前的狀態,先前更新的模組也將會被自動停用。
31 |
32 | #### 透過按下「音量 -」搶救 {#rescue-by-pressing-volume-down}
33 |
34 | 如果 AB 更新仍然無法解決,您可以嘗試使用**安全模式**。進入安全模式之後,所有的模組將會被停用。
35 |
36 | 進入安全模式的方法有兩種:
37 |
38 | 1. 某些系統內建的安全模式:有些系統是長按「音量 -」,有些系統 (例如 MIUI) 可以在 Recovery 中啟用安全模式。進入系統的安全模式後,KernelSU 也會進入安全模式,並自動停用模組。
39 | 2. KernelSU 內建的安全模式:開機第一個畫面後,**連續按下「音量 -」按鈕超過三次**。注意是按下-抬起、按下-抬起、按下-抬起,並非一直按下。
40 |
41 | 進入安全模式後,KernelSU 管理員的模組頁面的所有模組將會被停用,但您可以執行「解除安裝」作業,將可能存在問題的模組解除安裝。
42 |
43 | 內建的安全模式在核心中實作,因此不會出現按鍵活動無法攔截的狀況。不過對於非 GKI 核心,可能需要手動整合程式碼,可以參閱官方文件指南。
44 |
45 | ### 惡意模組 {#malicious-modules}
46 |
47 | 如果以上方法無法搶救您的裝置,那麼很可能您安裝的模組存在惡意作業或透過其他方式損壞了您的裝置,在這種狀況下,只有兩個建議:
48 |
49 | 1. 抹除資料並恢復為官方系統。
50 | 2. 諮詢售後服務。
51 |
--------------------------------------------------------------------------------
/website/docs/zh_TW/guide/unofficially-support-devices.md:
--------------------------------------------------------------------------------
1 | # 非官方支援裝置
2 |
3 | ::: warning 警告
4 | 本文件列出由其他開發人員維護的支援 KernelSU 的非 GKI 裝置核心
5 | :::
6 |
7 | ::: warning 警告
8 | 本文件僅便於尋找裝置對應原始碼,這並非意味著這些原始碼被 KernelSU 開發人員**審查**,您應自行承擔風險。
9 | :::
10 |
11 |
14 |
15 |
--------------------------------------------------------------------------------
/website/docs/zh_TW/guide/what-is-kernelsu.md:
--------------------------------------------------------------------------------
1 | # 什麼是 KernelSU? {#what-is-kernelsu}
2 |
3 | KernelSU 是 Android GKI 裝置的 Root 解決方案,它以核心模式運作,並直接在核心空間中為使用者空間應用程式授予 Root 權限。
4 |
5 | ## 功能 {#features}
6 |
7 | KernelSU 的主要功能是它是**基於核心的**。 KernelSU 在核心空間中執行,所以它可以向我們提供從未有過的核心介面。例如,我們可以在核心模式中為任何處理程序新增硬體中斷點;我們可以在任何處理程序的實體記憶體中存取,而無人知曉;我們可以在核心空間攔截任何系統呼叫;等等。
8 |
9 | KernelSU 還提供了一個以 overlayfs 為基礎的模組系統,允許您將自訂模組載入到系統中。它還提供了一種修改 `/system` 分區中檔案的機制。
10 |
11 | ## 如何使用 {#how-to-use}
12 |
13 | 請參閱:[安裝](installation)
14 |
15 | ## 如何建置 {#how-to-build}
16 |
17 | 请參閱:[如何建置](how-to-build)
18 |
19 | ## 討論 {#discussion}
20 |
21 | - Telegram: [@KernelSU](https://t.me/KernelSU)
22 |
--------------------------------------------------------------------------------
/website/docs/zh_TW/index.md:
--------------------------------------------------------------------------------
1 | ---
2 | layout: home
3 | title: 基於核心的 Android Root 解決方案
4 |
5 | hero:
6 | name: KernelSU
7 | text: 基於核心的 Android root 解決方案
8 | tagline: ""
9 | image:
10 | src: /logo.png
11 | alt: KernelSU
12 | actions:
13 | - theme: brand
14 | text: 開始瞭解
15 | link: /zh_TW/guide/what-is-kernelsu
16 | - theme: alt
17 | text: 在 GitHub 中檢視
18 | link: https://github.com/tiann/KernelSU
19 |
20 | features:
21 | - title: 以核心為基礎
22 | details: KernelSU 以 Linux 核心模式運作,對使用者空間有更強的掌控。
23 | - title: 白名單存取控制
24 | details: 僅有被授予 Root 權限的應用程式才可存取 su,而其他應用程式完全無法知悉。
25 | - title: 可定制的 Root 權限
26 | details: KernelSU 能夠對 su 的使用者ID(uid)、群組ID(gid)、群組、權限,以及 SELinux 規則進行客製化管理,以此加強 root 權限的安全性。
27 | - title: 模組支援
28 | details: KernelSU 支援透過 overlayfs 修改 /system,它甚至可以使 /system 可寫入。
29 |
30 |
--------------------------------------------------------------------------------
/website/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "KernelSU_website",
3 | "version": "1.0.0",
4 | "description": "KernelSU official website: https://kernelsu.org",
5 | "main": "index.js",
6 | "repository": "https://kernelsu.org",
7 | "author": "weishu",
8 | "license": "MIT",
9 | "devDependencies": {
10 | "vitepress": "^1.6.3",
11 | "vue": "^3.5.13"
12 | },
13 | "scripts": {
14 | "docs:dev": "vitepress dev docs",
15 | "docs:build": "vitepress build docs",
16 | "docs:preview": "vitepress preview docs"
17 | },
18 | "type": "module"
19 | }
--------------------------------------------------------------------------------