├── releases ├── 19200.md ├── 19300.md ├── 20300.md ├── 24300.md ├── 21100.md ├── 25200.md ├── 19100.md ├── 27000.md ├── 21200.md ├── 26400.md ├── 21400.md ├── 24200.md ├── 23000.md ├── 26000.md ├── index.md ├── 22100.md ├── 26100.md ├── 20100.md ├── 20200.md ├── 18100.md ├── 22000.md ├── 26200.md ├── 21000.md ├── 24000.md ├── 26300.md ├── 24100.md ├── 25000.md ├── 25100.md ├── 20400.md ├── 18000.md ├── 20000.md ├── 19400.md └── 19000.md ├── .eslintignore ├── .gitignore ├── public ├── favicon.ico ├── images │ ├── logo.png │ ├── ota_done.png │ ├── device_info.png │ ├── restore_img.png │ ├── manager_reboot.png │ ├── disable_auto_ota.png │ └── install_inactive_slot.png └── apple-touch-icon.png ├── images └── device_info.png ├── delta ├── images │ └── warning-stop.webp ├── index.md ├── note.md ├── internal-guide.md ├── faq.md └── main.md ├── .vitepress ├── theme │ ├── assets │ │ └── fonts │ │ │ ├── JetBrainsMono.ttf │ │ │ └── JetBrainsMono-Italic.ttf │ ├── utils │ │ └── github.ts │ ├── index.ts │ ├── ts │ │ └── theme.interfaces.ts │ ├── styles │ │ ├── JetBrains-Mono.scss │ │ └── custom.scss │ └── Layout.vue └── config.ts ├── .prettierignore ├── tsconfig.json ├── tsconfig.node.json ├── .eslintrc.cjs ├── tsconfig.app.json ├── prettier.config.js ├── .github └── workflows │ └── deploy.yml ├── .vscode └── settings.json ├── package.json ├── ota.md ├── faq.md ├── README.md ├── index.md ├── details.md ├── boot.md ├── tools.md ├── install.md ├── guides.md ├── app_changes.md └── LICENSE /releases/19200.md: -------------------------------------------------------------------------------- 1 | # TODO 2 | -------------------------------------------------------------------------------- /releases/19300.md: -------------------------------------------------------------------------------- 1 | # TODO 2 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | /node_modules 2 | cache 3 | .temp -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules 2 | .vitepress/cache 3 | .vitepress/dist 4 | .temp -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jesse205/MagiskChineseDocument/HEAD/public/favicon.ico -------------------------------------------------------------------------------- /images/device_info.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jesse205/MagiskChineseDocument/HEAD/images/device_info.png -------------------------------------------------------------------------------- /public/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jesse205/MagiskChineseDocument/HEAD/public/images/logo.png -------------------------------------------------------------------------------- /public/images/ota_done.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jesse205/MagiskChineseDocument/HEAD/public/images/ota_done.png -------------------------------------------------------------------------------- /public/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jesse205/MagiskChineseDocument/HEAD/public/apple-touch-icon.png -------------------------------------------------------------------------------- /delta/images/warning-stop.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jesse205/MagiskChineseDocument/HEAD/delta/images/warning-stop.webp -------------------------------------------------------------------------------- /public/images/device_info.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jesse205/MagiskChineseDocument/HEAD/public/images/device_info.png -------------------------------------------------------------------------------- /public/images/restore_img.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jesse205/MagiskChineseDocument/HEAD/public/images/restore_img.png -------------------------------------------------------------------------------- /public/images/manager_reboot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jesse205/MagiskChineseDocument/HEAD/public/images/manager_reboot.png -------------------------------------------------------------------------------- /public/images/disable_auto_ota.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jesse205/MagiskChineseDocument/HEAD/public/images/disable_auto_ota.png -------------------------------------------------------------------------------- /public/images/install_inactive_slot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jesse205/MagiskChineseDocument/HEAD/public/images/install_inactive_slot.png -------------------------------------------------------------------------------- /.vitepress/theme/assets/fonts/JetBrainsMono.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jesse205/MagiskChineseDocument/HEAD/.vitepress/theme/assets/fonts/JetBrainsMono.ttf -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | # Ignore artifacts: 2 | build 3 | /dist 4 | /dev-dist 5 | coverage 6 | /src-tauri/target 7 | 8 | node_modules 9 | /public/api 10 | yarn.lock -------------------------------------------------------------------------------- /.vitepress/theme/utils/github.ts: -------------------------------------------------------------------------------- 1 | export function getCommitUrl(repositoryUrl: string,commit: string): string { 2 | return `${repositoryUrl}/commit/${commit}` 3 | } 4 | -------------------------------------------------------------------------------- /.vitepress/theme/assets/fonts/JetBrainsMono-Italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jesse205/MagiskChineseDocument/HEAD/.vitepress/theme/assets/fonts/JetBrainsMono-Italic.ttf -------------------------------------------------------------------------------- /releases/20300.md: -------------------------------------------------------------------------------- 1 | # 2020.1.10 Magisk v20.3 2 | 3 | ## Magisk 4 | - Fix `magiskboot` crashing when dealing with `lz4_legacy` format 5 | 6 | ## Magisk Manager 7 | - Fix MagiskHide app component toggles 8 | 9 | **完整更新日志: [这里](/changes.html)** 10 | -------------------------------------------------------------------------------- /.vitepress/theme/index.ts: -------------------------------------------------------------------------------- 1 | import type { Theme } from 'vitepress' 2 | import DefaultTheme from 'vitepress/theme-without-fonts' 3 | import Layout from './Layout.vue' 4 | import './styles/custom.scss' 5 | 6 | export default { 7 | Layout: Layout, 8 | extends: DefaultTheme, 9 | enhanceApp(ctx) {}, 10 | } satisfies Theme 11 | -------------------------------------------------------------------------------- /.vitepress/theme/ts/theme.interfaces.ts: -------------------------------------------------------------------------------- 1 | import type { DefaultTheme } from 'vitepress/theme' 2 | export interface OriginDocumentConfig { 3 | date: string 4 | commit: string 5 | url: string 6 | } 7 | export interface ThemeConfig extends DefaultTheme.Config { 8 | originDocument?: Record 9 | } 10 | -------------------------------------------------------------------------------- /.vitepress/theme/styles/JetBrains-Mono.scss: -------------------------------------------------------------------------------- 1 | @font-face { 2 | font-family: "JetBrains Mono Online"; 3 | src: url("../assets/fonts/JetBrainsMono.ttf"); 4 | font-style: normal; 5 | } 6 | 7 | @font-face { 8 | font-family: "JetBrains Mono Online"; 9 | src: url("../assets/fonts/JetBrainsMono-Italic.ttf"); 10 | font-style: italic; 11 | } 12 | -------------------------------------------------------------------------------- /releases/24300.md: -------------------------------------------------------------------------------- 1 | # 2022.3.10 Magisk v24.3 2 | 3 | For those coming from v24.1, check the full changelog for changes introduced in v24.2. 4 | 5 | - [General] Stop using `getrandom` syscall 6 | - [Zygisk] Update API to v3, adding new fields to `AppSpecializeArgs` 7 | - [App] Improve app repackaging installation workflow 8 | 9 | **完整更新日志: [这里](/changes.html)** 10 | -------------------------------------------------------------------------------- /releases/21100.md: -------------------------------------------------------------------------------- 1 | # 2020.11.13 Magisk v21.1 2 | 3 | v21.1 is a maintenance update from v21.0, mostly addressing bugs, refining some details, and adding new boot image format support (for Pixel 5 and 4a 5G). Checkout the full [v21.0 release notes](https://topjohnwu.github.io/Magisk/releases/21000.html) if coming from older releases. 4 | 5 | **完整更新日志: [这里](/changes.html)** 6 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "ESNext", 4 | "composite": true, 5 | "strict": true, 6 | "sourceMap": false, 7 | "esModuleInterop": true, 8 | "skipLibCheck": true, 9 | "importHelpers": true 10 | }, 11 | "files": [], 12 | "references": [ 13 | { 14 | "path": "./tsconfig.node.json" 15 | }, 16 | { 17 | "path": "./tsconfig.app.json" 18 | } 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /releases/25200.md: -------------------------------------------------------------------------------- 1 | # 2022.7.20 Magisk v25.2 2 | 3 | Maintenance release fixing various issues. 4 | 5 | - [MagiskInit] Fix a potential issue when stub cpio is used 6 | - [MagiskInit] Fix reboot to recovery when stub cpio is used 7 | - [MagiskInit] Fix sepolicy.rules symlink for rootfs devices 8 | - [General] Better data encryption detection 9 | - [General] Move the whole logging infrastructure into Rust 10 | 11 | **完整更新日志: [这里](/changes.html)** 12 | -------------------------------------------------------------------------------- /tsconfig.node.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@tsconfig/node21/tsconfig.json", 3 | "include": [ 4 | "vite.config.*", 5 | "vitest.config.*", 6 | "cypress.config.*", 7 | "nightwatch.conf.*", 8 | "playwright.config.*", 9 | ".vitepress/**/*" 10 | ], 11 | "compilerOptions": { 12 | "composite": true, 13 | "module": "ESNext", 14 | "moduleResolution": "Bundler", 15 | "types": ["node"], 16 | "resolveJsonModule": true 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /delta/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | sidebar: false 3 | aside: false 4 | --- 5 | 6 | # Magisk Delta 7 | 8 | ![WARNING! STOP!](./images/warning-stop.webp) 9 | 10 | ## 停下,你在找什么? 11 | 12 | :::danger 13 | 您将要下载的是未经官方 Magisk 开发人员验证的危险和未经授权的 Magisk 版本。该版本可能包含恶意或有害更改,可能会损坏您的设备或破坏您的数据。如果您遇到任何问题或麻烦,请不要指望从 Magisk 官方渠道获得任何支持或帮助。如果您想下载安全的官方版本,请访问 github.com/topjohnwu/Magisk。**这不是一款适合儿童的游戏,请远离它!!** 14 | ::: 15 | 16 | - [我好害怕,快把我踢出去!](https://github.com/topjohnwu/Magisk) 17 | - [我不在乎!请让我进去](./main.md) 18 | -------------------------------------------------------------------------------- /.eslintrc.cjs: -------------------------------------------------------------------------------- 1 | /* eslint-env node */ 2 | require('@rushstack/eslint-patch/modern-module-resolution') 3 | 4 | /** 5 | * @type {import('eslint').Linter.Config} 6 | */ 7 | module.exports = { 8 | root: true, 9 | extends: [ 10 | 'plugin:vue/vue3-essential', 11 | 'eslint:recommended', 12 | '@vue/eslint-config-typescript', 13 | '@vue/eslint-config-prettier/skip-formatting', 14 | ], 15 | parserOptions: { 16 | ecmaVersion: 'latest', 17 | }, 18 | rules: { 19 | eqeqeq: ['warn', 'always', { null: 'ignore' }], 20 | }, 21 | } 22 | -------------------------------------------------------------------------------- /releases/19100.md: -------------------------------------------------------------------------------- 1 | # 2019.5.1 Magisk v19.1 2 | 3 | Finally, a lovely stable release! 4 | 5 | For those that were using v18.1, here are some quick highlights of v19.0 6 | 7 | - Imageless Magisk: Although module migration was tested, there are still chances that your modules will get lost in the process. Be prepared to reinstall your existing modules in that case. 8 | - Native 64-bit support 9 | - Zygote Ptrace Based MagiskHide 10 | 11 | Other than adding support for Samsung system-as-root devices, this release is mostly bug fixes from v19.0. Enjoy :) 12 | 13 | **完整更新日志: [这里](/changes.html)** 14 | -------------------------------------------------------------------------------- /releases/27000.md: -------------------------------------------------------------------------------- 1 | # 2024.2.3 Magisk v27.0 2 | 3 | - [Zygisk] 引入新的代码注入机制 4 | - [Zygisk] 支持在 U QPR2 中引入的新签名 5 | - [SEPolicy] 更新 libsepol 以正确设置某些策略配置位 6 | - [MagiskBoot] 支持压缩 `init`,以便在具有较小启动分区的设备上安装Magisk 7 | - [ResetProp] 添加新的等待属性功能 `resetprop -w` 8 | 9 | ::: details 英文原版 10 | 11 | - [Zygisk] Introduce new code injection mechanism 12 | - [Zygisk] Support new signature introduced in U QPR2 13 | - [SEPolicy] Update libsepol to properly set some policy config bits 14 | - [MagiskBoot] Support compressing `init` so Magisk is installable on devices with small boot partitions 15 | - [ResetProp] Add new wait for property feature `resetprop -w` 16 | 17 | ::: 18 | 19 | **完整更新日志: [这里](/changes.html)** 20 | -------------------------------------------------------------------------------- /tsconfig.app.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@vue/tsconfig/tsconfig.dom.json", 3 | "include": ["**/*.vue", "**/*.ts", "**/*", ".vitepress/theme/**/*", ".vitepress/theme/**/*.vue"], 4 | "compilerOptions": { 5 | "composite": true, 6 | "baseUrl": ".", 7 | "paths": { 8 | "@/*": ["*"] 9 | }, 10 | "useDefineForClassFields": true, 11 | "allowSyntheticDefaultImports": true, 12 | "moduleResolution": "Bundler", 13 | "allowImportingTsExtensions": true, 14 | "resolveJsonModule": true, 15 | "isolatedModules": true, 16 | "jsx": "preserve", 17 | "noEmit": false, 18 | "emitDeclarationOnly": true, 19 | "lib": ["ESNext", "DOM", "WebWorker"], 20 | "types": ["vite/client"], 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /releases/21200.md: -------------------------------------------------------------------------------- 1 | # 2020.12.28 Magisk v21.2 2 | 3 | v21.2 is a maintenance update, mostly addressing bugs, and expanding device compatibility. Checkout the full [v21.0 release notes](https://topjohnwu.github.io/Magisk/releases/21000.html) if coming from older releases. 4 | 5 | ## v21.2 6 | 7 | - [MagiskInit] Detect 2SI after mounting `system_root` on legacy SAR devices 8 | - [General] Make sure `post-fs-data` scripts cannot block more than 35 seconds 9 | - [General] Fix the `magisk --install-module` command 10 | - [General] Trim Windows newline when reading files 11 | - [General] Directly log to file to prevent `logcat` weirdness 12 | - [MagiskBoot] Fix header dump/load for header v3 images 13 | 14 | **完整更新日志: [这里](/changes.html)** 15 | -------------------------------------------------------------------------------- /prettier.config.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @type {import("prettier").Config} 3 | */ 4 | export default { 5 | printWidth: 120, 6 | tabWidth: 2, 7 | useTabs: false, 8 | semi: false, 9 | singleQuote: true, 10 | quoteProps: 'as-needed', 11 | jsxSingleQuote: false, 12 | trailingComma: 'all', 13 | bracketSpacing: true, 14 | bracketSameLine: false, 15 | arrowParens: 'always', 16 | rangeStart: 0, 17 | rangeEnd: Infinity, 18 | requirePragma: false, 19 | insertPragma: false, 20 | proseWrap: 'preserve', 21 | htmlWhitespaceSensitivity: 'css', 22 | vueIndentScriptAndStyle: false, 23 | endOfLine: 'lf', 24 | embeddedLanguageFormatting: 'auto', 25 | singleAttributePerLine: false, 26 | plugins: ['prettier-plugin-organize-imports'], 27 | } 28 | -------------------------------------------------------------------------------- /releases/26400.md: -------------------------------------------------------------------------------- 1 | # 2023.11.5 Magisk v26.4 2 | 3 | - [MagiskBoot] 如果签名启动镜像较大,则不要填充零 4 | - [MagiskPolicy] 修复 `genfscon` 和 `filename_trans` 5 | - [MagiskPolicy] 修复了 `libsepol` 中的错误 6 | - [Zygisk] 修复并简化文件描述符净化逻辑 7 | - [应用] 修补 AP tar 文件时防止 OOM 8 | - [应用] 修复设备配置检测中的错误 9 | - [Daemon] 修复 APK 的证书解析问题 10 | - [常规] 修复了忽略 C++ 代码中的日志记录错误 11 | 12 | ::: details 英文原版 13 | 14 | - [MagiskBoot] Don't pad zeros if signed boot image is larger 15 | - [MagiskPolicy] Fix `genfscon` and `filename_trans` 16 | - [MagiskPolicy] Fix bug in `libsepol` 17 | - [Zygisk] Fix and simplify file descriptor sanitization logic 18 | - [App] Prevent OOM when patching AP tarfiles 19 | - [App] Fix bug in device configuration detection 20 | - [Daemon] Fix certificate parsing of APKs 21 | - [General] Fix logging errors from C++ code being ignored 22 | 23 | ::: 24 | 25 | **完整更新日志: [这里](/changes.html)** 26 | -------------------------------------------------------------------------------- /.github/workflows/deploy.yml: -------------------------------------------------------------------------------- 1 | name: Deploy 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | workflow_dispatch: 8 | 9 | jobs: 10 | deploy: 11 | runs-on: ubuntu-latest 12 | steps: 13 | - uses: actions/checkout@v3 14 | with: 15 | fetch-depth: 0 16 | - name: Pnpm setup 17 | uses: pnpm/action-setup@v2 18 | with: 19 | version: 8.15.7 20 | - uses: actions/setup-node@v3 21 | with: 22 | node-version: 'lts/*' 23 | cache: pnpm 24 | - run: pnpm install --frozen-lockfile 25 | 26 | - name: Build 27 | run: pnpm build 28 | 29 | - name: Deploy 30 | uses: peaceiris/actions-gh-pages@v3 31 | with: 32 | github_token: ${{ secrets.GITHUB_TOKEN }} 33 | publish_dir: .vitepress/dist 34 | # cname: example.com # if wanna deploy to custom domain 35 | -------------------------------------------------------------------------------- /releases/21400.md: -------------------------------------------------------------------------------- 1 | # 2021.1.17 Magisk v21.4 2 | 3 | **Update**: v21.4 adds more regression hot fixes. 4 | 5 | Happy 2021! v21.3 adds a workaround for devices with buggy F2FS Linux kernel drivers. This F2FS bug may cause bootloops on many devices. Checkout the full [v21.0 release notes](https://topjohnwu.github.io/Magisk/releases/21000.html) if coming from older releases. 6 | 7 | ## v21.4 8 | 9 | - [MagiskSU] Fix `su -c` behavior that broke many root apps 10 | - [General] Properly handle read/write over sockets (the `broken pipe` issue) 11 | 12 | ## v21.3 13 | 14 | - [MagiskInit] Avoid mounting `f2fs` userdata as it may result in kernel crashes. This shall fix a lot of bootloops 15 | - [MagiskBoot] Fix a minor header checksum bug for `DHTB` header and ASUS `blob` image formats 16 | - [MagiskHide] Allowing hiding isolated processes if the mount namespace is separated 17 | 18 | **完整更新日志: [这里](/changes.html)** 19 | -------------------------------------------------------------------------------- /releases/24200.md: -------------------------------------------------------------------------------- 1 | # 2022.3.1 Magisk v24.2 2 | 3 | Maintenance release fixing various issues. 4 | 5 | - [MagiskSU] Fix buffer overflow 6 | - [MagiskSU] Fix owner managed multiuser superuser settings 7 | - [MagiskSU] Fix command logging when using `su -c ` 8 | - [MagiskSU] Prevent su request indefinite blocking 9 | - [MagiskBoot] Support `lz4_legacy` archive with multiple magic 10 | - [MagiskBoot] Fix `lz4_lg` compression 11 | - [DenyList] Allow targeting processes running as system UID 12 | - [Zygisk] Workaround Samsung's "early zygote" 13 | - [Zygisk] Improved Zygisk loading mechanism 14 | - [Zygisk] Fix application UID tracking 15 | - [Zygisk] Fix improper `umask` being set in zygote 16 | - [App] Fix BusyBox execution test 17 | - [App] Improve stub loading mechanism 18 | - [App] Major app upgrade flow improvements 19 | - [General] Improve commandline error handling and messaging 20 | 21 | **完整更新日志: [这里](/changes.html)** 22 | -------------------------------------------------------------------------------- /releases/23000.md: -------------------------------------------------------------------------------- 1 | # 2021.5.12 Magisk v23.0 2 | 3 | This release is focused on fixing regressions and bugs. 4 | 5 | Note: Magisk v22 is the last major version to support Jellybean and Kitkat. Magisk v23 only supports Android 5.0 and higher. 6 | 7 | ## Bug Fixes 8 | 9 | - [App] Update snet extension. This fixes SafetyNet API errors. 10 | - [App] Fix a bug in the stub app that causes APK installation to fail 11 | - [App] Hide annoying errors in logs when hidden as stub 12 | - [App] Fix issues when patching ODIN tar files when the app is hidden 13 | - [General] Remove all pre Android 5.0 support 14 | - [General] Update BusyBox to use proper libc 15 | - [General] Fix C++ undefined behaviors 16 | - [General] Several `sepolicy.rule` copy/installation fixes 17 | - [MagiskPolicy] Remove unnecessary sepolicy rules 18 | - [MagiskHide] Update package and process name validation logic 19 | - [MagiskHide] Some changes that prevents zygote deadlock 20 | 21 | **完整更新日志: [这里](/changes.html)** 22 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "cSpell.words": [ 3 | "bootloader", 4 | "DATABIN", 5 | "genfscon", 6 | "Kitsune", 7 | "libsepol", 8 | "magisk", 9 | "MAGISKDB", 10 | "magiskinit", 11 | "MAGISKTMP", 12 | "nightwatch", 13 | "RAMDIS", 14 | "ramdisk", 15 | "resetprop", 16 | "Rikka", 17 | "rootdir", 18 | "sepolicy", 19 | "setprop", 20 | "topjohnwu", 21 | "vbmeta", 22 | "Zygisk" 23 | ], 24 | "typescript.tsdk": "node_modules/typescript/lib", 25 | "markdownlint.config": { 26 | "default": true, 27 | "MD033": { 28 | "allowed_elements": [ 29 | "Badge", 30 | "br", 31 | "script", 32 | "img", 33 | "p" 34 | ] 35 | }, 36 | "MD025": false, 37 | "MD041": false, 38 | "MD031": false 39 | } 40 | } -------------------------------------------------------------------------------- /.vitepress/theme/Layout.vue: -------------------------------------------------------------------------------- 1 | 24 | 25 | 28 | 29 | 37 | -------------------------------------------------------------------------------- /releases/26000.md: -------------------------------------------------------------------------------- 1 | # 2023.4.5 Magisk v26.0 2 | 3 | 嘿!好久不见! 4 | 5 | ## 将最低 Android 版本提升到6.0 6 | 7 | Magisk 对 Android Lollipop 的支持在不知不觉中已经中断了一段时间。此外,Magisk 的活跃开发者都没有运行 Android Lollipop 的实际硬件。我们依赖使用官方安卓模拟器对旧平台进行回归测试,但谷歌从未提供过支持 SELinux 的棒棒糖模拟器镜像,这让我们别无选择,只能放弃对棒棒糖的支持,因为在没有充分测试的情况下,我们不放心支持安卓棒棒糖。 8 | 9 | ## 新的 Magic Mount 实现 10 | 11 | 魔力挂载(Magic Mount)是一项能让模块修改分区的功能,现已进行了重大改写。现有实现无法很好地与使用 `overlayfs` 向系统注入覆盖层的 OEM 配合使用。新的实现方式从根本上改变了文件系统镜像的创建方式,为我们提供了未修改文件系统的更精确克隆。 12 | 13 | ## 新的 `sepolicy.rule` 实现 14 | 15 | Magisk 允许模块通过包含 `sepolicy.rule` 文件来提供自定义 SELinux 补丁。由于 SELinux 补丁的复杂性,该功能的兼容性一直很不稳定;许多设备都不支持。在此版本中,我们设计了全新的启动前分区检测机制,以支持更多设备。由于复杂的原因,该检测机制无法在第三方 Recovery 环境中执行。 16 | 17 | **这意味着使用第三方 Recovery 功能安装 Magisk v26+ 将是不完整的;需要在启动后通过 Magisk 应用程序重新安装。** 18 | 19 | ## Zygisk 更新 20 | 21 | **新版 Zygisk API v4 现已上线!**它具有新功能和完善的 PLT 函数钩子 API。Zygisk 的实现也经历了一些重大的重构,包括新的代码加载/卸载机制和新的 PLT 函数钩子实现。 22 | 23 | 前往 [Zygisk 模块示例](https://github.com/topjohnwu/zygisk-module-sample) 仓库查看新的 API 和文档! 24 | 25 | **完整更新日志: [这里](/changes.html)** 26 | -------------------------------------------------------------------------------- /releases/index.md: -------------------------------------------------------------------------------- 1 | # 发布日志 2 | 3 | - [v27.0](27000.md) 4 | - [v26.4](26400.md) 5 | - [v26.3](26300.md) 6 | - [v26.2](26200.md) 7 | - [v26.1](26100.md) 8 | - [v26.0](26000.md) 9 | - [v25.2](25200.md) 10 | - [v25.1](25100.md) 11 | - [v25.0](25000.md) 12 | - [v24.3](24300.md) 13 | - [v24.2](24200.md) 14 | - [v24.1](24100.md) 15 | - [v24.0](24000.md) 16 | - [v23.0](23000.md) 17 | - [v22.1](22100.md) 18 | - [v22.0](22000.md) 19 | - [v21.4](21400.md) 20 | - [v21.2](21200.md) 21 | - [v21.1](21100.md) 22 | - [v21.0](21000.md) 23 | - [v20.4](20400.md) 24 | - [v20.3](20300.md) 25 | - [v20.2](20200.md) 26 | - [v20.1](20100.md) 27 | - [v20.0](20000.md) 28 | - [v19.4](19400.md) 29 | - [v19.3](19300.md) 30 | - [v19.2](19200.md) 31 | - [v19.1](19100.md) 32 | - [v19.0](19000.md) 33 | - [v18.1](18100.md) 34 | - [v18.0](18000.md) 35 | 36 | ---- 37 | 38 | - [Magisk 更新日志](/changes.md) 39 | 40 | ## 其他日志 41 | 42 | - [Magisk Manager 更新日志](/app_changes.md) 43 | 44 | ## 参考链接 45 | 46 | - [Magisk Release Notes](https://topjohnwu.github.io/Magisk/releases/)(官方) 47 | -------------------------------------------------------------------------------- /delta/note.md: -------------------------------------------------------------------------------- 1 | # 日志 2 | 3 | ## R6583F3E5-kitsune (26403) 4 | 5 | - 修复先前版本的错误 (R6583240E) 6 | 7 | 如果您想阅读以前版本的更新日志,请访问[发行页面](https://github.com/HuskyDG/magisk-files/releases) 8 | 9 | ### 与官方 Magisk 的差异 10 | 11 | - [应用] 添加了一项新功能,可为没有引导映像的模拟器将 Magisk 安装到 `/system` 分区。 12 | - [Zygisk] 将 Zygisk 的加载方法改为 ptrace init 实现(要求 Android 8 以上)。该实现来自 [ZygiskNext](https://github.com/Dr-TSNG/ZygiskNext)。该方法无需更改任何属性,而且与某些忽略 `ro.dalvik.vm.native.bridge` 属性的模拟器更为兼容。 13 | - [常规] 增强了对模块预启动挂载的支持。这使得模块可以在启动过程开始前修改系统,这对一些高级用例非常有用。 14 | - [常规] 实施了一项新功能,以支持通过使用类似于 `overlayfs` 的指示留白字符设备来删除文件。这允许模块从原始系统中删除文件,而无需实际修改。 15 | - [Zygisk] 新增对 GrepheneOS Android 14 的支持,这是一款注重隐私和安全的移动操作系统,与 Android 应用程序兼容。这是因为官方 Magisk 不支持它。 16 | - [常规] 恢复官方 Magisk 已移除的对不支持 selinux 的设备的支持。这样,用户就能在内核未启用 selinux 的设备上使用 Magisk。 17 | 18 | ### Magisk 上游等级 19 | 20 | - HEAD 提交: 6cda6c2 21 | 22 | ## Magisk (d7750b72) (26403) 23 | 24 | - [Zygisk] 引入新的代码注入机制 25 | - [Zygisk] 支持 U QPR2 中引入的新签名 26 | 27 | ## 与 v26.4 的差异 28 | 29 | - [Zygisk] 引入新的代码注入机制 30 | - [Zygisk] 支持 U QPR2 中引入的新签名 31 | 32 | ## 参考链接 33 | 34 | - [Note](https://huskydg.github.io/magisk-files/note.html)(官方) 35 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "magisk-chinese-document", 3 | "version": "26.4", 4 | "description": "Magisk 中文文档", 5 | "main": "index.js", 6 | "author": "Jesse205", 7 | "license": "MIT", 8 | "private": true, 9 | "type": "module", 10 | "packageManager": "pnpm@8.15.7+sha256.50783dd0fa303852de2dd1557cd4b9f07cb5b018154a6e76d0f40635d6cee019", 11 | "scripts": { 12 | "dev": "vitepress dev", 13 | "build": "vitepress build", 14 | "serve": "vitepress serve" 15 | }, 16 | "devDependencies": { 17 | "@rushstack/eslint-patch": "^1.10.2", 18 | "@tsconfig/node21": "^21.0.3", 19 | "@types/node": "^20.12.7", 20 | "@typescript-eslint/eslint-plugin": "^7.7.1", 21 | "@typescript-eslint/parser": "^7.7.1", 22 | "@vitejs/plugin-vue": "^5.0.4", 23 | "@vue/eslint-config-prettier": "^9.0.0", 24 | "@vue/eslint-config-typescript": "^13.0.0", 25 | "@vue/tsconfig": "^0.5.1", 26 | "eslint": "^9.1.1", 27 | "eslint-plugin-vue": "^9.25.0", 28 | "prettier": "^3.2.5", 29 | "prettier-plugin-organize-imports": "^3.2.4", 30 | "sass": "^1.75.0", 31 | "vite": "^5.2.10", 32 | "vitepress": "1.1.3" 33 | }, 34 | "dependencies": { 35 | "vue": "^3.4.24" 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /releases/22100.md: -------------------------------------------------------------------------------- 1 | # 2021.4.9 Magisk v22.1 2 | 3 | This release is focused on fixing regressions and bugs. Check the [v22.0 release notes](https://topjohnwu.github.io/Magisk/releases/22000.html) if coming from older releases. 4 | 5 | Note: Magisk v22 is the last major version to support Jellybean and Kitkat. Magisk v23 will only support Android 5.0 and higher. 6 | 7 | ## Bug Fixes 8 | 9 | - [App] Prevent multiple installation sessions running in parallel 10 | - [App] Prevent OutOfMemory crashes when checking boot signature on PXA boot images 11 | - [General] Proper cgroup migration implementation 12 | - [General] Rewrite log writer from scratch, should resolve any crashes and deadlocks 13 | - [General] Many scripts updates fixing regressions 14 | - [MagiskHide] Prevent possible deadlock when signal arrives 15 | - [MagiskHide] Partial match process names if necessary 16 | - [MagiskBoot] Preserve and patch AVB 2.0 structures/headers in boot images 17 | - [MagiskBoot] Properly strip out data encryption flags 18 | - [MagiskBoot] Prevent possible integer overflow 19 | - [MagiskInit] Fix `sepolicy.rule` mounting strategy 20 | - [resetprop] Always delete existing `ro.` props before updating. This will fix bootloops that could be caused by modifying device fingerprint properties. 21 | 22 | **完整更新日志: [这里](/changes.html)** 23 | -------------------------------------------------------------------------------- /releases/26100.md: -------------------------------------------------------------------------------- 1 | # 2023.4.11 Magisk v26.1 2 | 3 | ## 与 v26.0 相比的更改 4 | 5 | - [应用程序] 修复了撤销根权限时崩溃的问题 6 | - [MagiskInit] 在选择预初始化分区时,始终更喜欢 `ext4` 分区而不是 `f2fs` 7 | - [常规] 从镜像恢复模块文件的上下文/所有者/组。这是 v26.0 中引入的回归 8 | 9 | ::: details 英文原版 10 | 11 | - [App] Fix crashing when revoking root permissions 12 | - [MagiskInit] Always prefer `ext4` partitions over `f2fs` when selecting the pre-init partition 13 | - [General] Restore module files' context/owner/group from mirror. This is a regression introduced in v26.0 14 | 15 | ::: 16 | 17 | (以下内容与 v26.0 发布说明相同) 18 | 19 | ## 将最低 Android 版本提升到6.0 20 | 21 | Magisk 对 Android Lollipop 的支持在不知不觉中已经中断了一段时间。此外,Magisk 的活跃开发者都没有运行 Android Lollipop 的实际硬件。我们依赖使用官方安卓模拟器对旧平台进行回归测试,但谷歌从未提供过支持 SELinux 的棒棒糖模拟器镜像,这让我们别无选择,只能放弃对棒棒糖的支持,因为在没有充分测试的情况下,我们不放心支持安卓棒棒糖。 22 | 23 | ## 新的 Magic Mount 实现 24 | 25 | 魔力挂载(Magic Mount)是一项能让模块修改分区的功能,现已进行了重大改写。现有实现无法很好地与使用 `overlayfs` 向系统注入覆盖层的 OEM 配合使用。新的实现方式从根本上改变了文件系统镜像的创建方式,为我们提供了未修改文件系统的更精确克隆。 26 | 27 | ## 新的 `sepolicy.rule` 实现 28 | 29 | Magisk 允许模块通过包含 `sepolicy.rule` 文件来提供自定义 SELinux 补丁。由于 SELinux 补丁的复杂性,该功能的兼容性一直很不稳定;许多设备都不支持。在此版本中,我们设计了全新的启动前分区检测机制,以支持更多设备。由于复杂的原因,该检测机制无法在第三方 Recovery 环境中执行。 30 | 31 | **这意味着使用第三方 Recovery 功能安装 Magisk v26+ 将是不完整的;需要在启动后通过 Magisk 应用程序重新安装。** 32 | 33 | ## Zygisk 更新 34 | 35 | **新版 Zygisk API v4 现已上线!**它具有新功能和完善的 PLT 函数钩子 API。Zygisk 的实现也经历了一些重大的重构,包括新的代码加载/卸载机制和新的 PLT 函数钩子实现。 36 | 37 | 前往 [Zygisk 模块示例](https://github.com/topjohnwu/zygisk-module-sample) 仓库查看新的 API 和文档! 38 | 39 | **完整更新日志: [这里](/changes.html)** 40 | -------------------------------------------------------------------------------- /releases/20100.md: -------------------------------------------------------------------------------- 1 | # 2019.11.2 Magisk v20.1 2 | Lots of bug fixes from v20.0, and some cool new features! 3 | 4 | ## Updated Magisk Manager Hiding 5 | Starting with Magisk v20.1 paired with Magisk Manager v7.4.0, a new hiding mode is introduced for Android 9.0+. On supported devices, Magisk Manager will download and customize a heavily obfuscated stub APK and use it as a replacement. The stub app will then download the full app into its private internal data, then dynamically load and run the actual full Magisk Manager. 6 | 7 | Note, not all Android 9.0+ devices will be able to use this feature. To use an obfuscated stub as Magisk Manager, the Magisk daemon will have to rely on a special way to communicate with the app, and some OEMs (most likely Chinese manufacturers) block certain broadcasts, breaking the communication channel. 8 | 9 | Magisk Manager will verify compatibility before it uses stubs to hide itself on Android 9.0+. **The verification relies on Magisk v20.1+, which means you have to fully upgrade and reboot in order to opt in this feature.** If you are already running a hidden Magisk Manager, **restore and upgrade Magisk Manager, upgrade Magisk and reboot, then re-hide the app**. 10 | 11 | For those incompatible with the hiding-with-stub feature, there are also a few updates that everyone, regardless whether using stubs or not, can enjoy: 12 | 13 | - You can now customize the app name of the repackaged Magisk Manager 14 | - Magisk Manager will generate new keys to sign the repackaged APK to prevent signature detection 15 | 16 | **完整更新日志: [这里](/changes.html)** 17 | -------------------------------------------------------------------------------- /releases/20200.md: -------------------------------------------------------------------------------- 1 | # 2020.1.2 Magisk v20.2 2 | 3 | Happy New Year! Let's start 2020 with a new Magisk release :) 4 | 5 | ## Pre-Init sepolicy Patches for Modules 6 | Magisk v20.2 add support for modules to include its own custom sepolicy patches. Developers used to use boot scripts along with the `magiskpolicy` tool to do live sepolicy patches; however, this method leads to numerous issues as Android is no longer designed to allow live sepolicy patches, and on some devices (e.g. Huawei) this method is outright inapplicable. 7 | 8 | To address this issue, Magisk allow module devs to create a new file called `sepolicy.rule` in their modules. The module installer script and Magisk daemon will make sure this file is stored in somewhere accessible pre-init to allow `magiskinit` to do its job every time your device boots up. 9 | 10 | ## New Module Installer Format 11 | The old template is actually pretty convoluted: developers are expected to implement specific callback functions in their `install.sh`, and the zip file structure does not directly represent how modules are actually stored on your device. The new module installer format makes creating new modules very easy, but still give experienced developers tons of freedom to do anything they want in the installation process. 12 | 13 | For details regarding `sepolicy.rule` and the new module installer format, please read the updated [Developer Guides](https://topjohnwu.github.io/Magisk/guides.html). Note that the old "Module Installer Template" is obsolete; creating a Magisk module no longer requires a "template" as it is now a straightforward process. 14 | 15 | **完整更新日志: [这里](/changes.html)** 16 | -------------------------------------------------------------------------------- /releases/18100.md: -------------------------------------------------------------------------------- 1 | # 2019.2.4 Magisk v18.1 2 | 3 | What is a better way to celebrate Chinese New Year than a new Magisk update! 4 | 5 | ## EMUI 9 Support 6 | Welcome on board "again", Huawei! Even though Huawei had officially blocked bootloader unlocks, people still love to buy them (duh), and there are paid services that unlock Huawei bootloaders. So hey, get Magisk installed on that bad boy! One caveat is that since Huawei have changed the partitions, special workarounds has to be done. Details and instructions are in the newly created [instruction page](https://topjohnwu.github.io/Magisk/install.html) 7 | 8 | ## Support Down to Android 4.2 9 | Because why not, it was quite a lot of fun LOL. All devices running KitKat and higher will have all features enabled. MagiskHide and resetprop aren't possible on Jellybean, and Magic Mount (modules) is temporarily disabled; basically it only works as a root solution for now. Android 4.1 isn't 100% usable yet, so installation is also temporarily blocked. Eventually, all Jellybean devices will have full Magic Mount and MagiskSU support. 10 | 11 | ## Major Magisk Manager Update 12 | Aside from the obvious major UI overhaul, tons of little user experience and performance improvements are also added. The app is finally less crappy now :) 13 | 14 | ## Final Words 15 | I'm aware that there are apps updated to detect Magisk, however no MagiskHide improvements efforts are done in this release; v18.1 is aimed to be as stable as possible. Stay tuned for future public betas, or if you are more adventurous, jump on the Canary Channel bandwagon for more aggressive hiding techniques :) 16 | 17 | **完整更新日志: [这里](/changes.html)** 18 | -------------------------------------------------------------------------------- /releases/22000.md: -------------------------------------------------------------------------------- 1 | # 2021.2.23 Magisk v22.0 2 | 3 | ## RESTORE THE EXISTING MAGISK MANAGER BACK TO NORMAL BEFORE UPGRADING IF HIDDEN! 4 | 5 | Another major Magisk release! This time our focus is not the core Magisk implementation, but rather on improving the whole Magisk user experience. 6 | 7 | ## Magisk Manager is dead.
Long live the Magisk app! 8 | 9 | Ever since the first Magisk release, Magisk (the core components) and Magisk Manager (the companion app) are released separately and isn't necessarily always in sync. This leads to some confusion and a lot of complexity when downloading/installing Magisk through the app. Starting from v22.0, the Magisk app (renamed from Magisk Manager) includes everything it needs within the APK itself, making installation a 100% offline process. 10 | 11 | Custom recovery lovers, no worries! The Magisk app APK *itself* is a custom recovery flashable zip, just like MAGIC™🌈. Check out the updated [installation guide](https://topjohnwu.github.io/Magisk/install.html) for more info. 12 | 13 | ## App Hiding 14 | 15 | Another major breakthrough in this release is that devices lower than Android 9.0 can now also use the advanced app hiding technique to hide the Magisk app. Due to this incompatible change, **RESTORE THE EXISTING MAGISK MANAGER BACK TO NORMAL BEFORE UPGRADING IF HIDDEN!** 16 | 17 | ## Bug Fixes 18 | 19 | - [MagiskHide] Fix a bug when stopping MagiskHide does not take effect 20 | - [MagiskBoot] Fix bug when unpacking `lz4_lg` compressed boot images 21 | - [MagiskInit] Support Galaxy S21 series 22 | - [MagiskSU] Fix incorrect APEX paths that caused `libsqlite.so` fail to load 23 | 24 | **完整更新日志: [这里](/changes.html)** 25 | -------------------------------------------------------------------------------- /releases/26200.md: -------------------------------------------------------------------------------- 1 | # 2023.8.27 Magisk v26.2 2 | 3 | - [MagiskBoot] 支持从`payload.bin`中提取启动映像 4 | - [MagiskBoot] 支持包含字符文件的 cpio 文件 5 | - [MagiskBoot] 支持列出 cpio 内容 6 | - [MagiskBoot] 直接处理 AVB 1.0 签名和验证,无需通过 Java 实现 7 | - [守护进程] 使守护程序套接字成为 MAGISKTMP 中的固定路径 8 | - [resetprop] 支持打印属性上下文 9 | - [resetprop] 仅支持从存储中打印持久属性 10 | - [resetprop] 正确支持设置持久属性绕过 property_service 11 | - [MagiskSU] 支持 `-g` 和 `-G` 选项 12 | - [MagiskSU] 支持使用 `-t` 将挂载命名空间切换到 PID 13 | - [MagiskPolicy] 修复修补扩展权限 14 | - [MagiskPolicy] 支持更多语法以获得扩展权限 15 | - [MagiskPolicy] 支持打印加载的 sepolicy 规则 16 | - [应用程序] 支持从 ROM 压缩包修补启动映像 17 | - [应用程序] 使用 `init_boot.img` 修补三星固件时正确保留 `boot.img` 18 | 19 | ::: details 英文原版 20 | 21 | - [MagiskBoot] Support extracting boot image from `payload.bin` 22 | - [MagiskBoot] Support cpio files containing character files 23 | - [MagiskBoot] Support listing cpio content 24 | - [MagiskBoot] Directly handle AVB 1.0 signing and verification without going through Java implementation 25 | - [Daemon] Make daemon socket a fixed path in MAGISKTMP 26 | - [resetprop] Support printing property context 27 | - [resetprop] Support only printing persistent properties from storage 28 | - [resetprop] Properly support setting persistent properties bypassing property_service 29 | - [MagiskSU] Support `-g` and `-G` options 30 | - [MagiskSU] Support switching mount namespace to PID with `-t` 31 | - [MagiskPolicy] Fix patching extended permissions 32 | - [MagiskPolicy] Support more syntax for extended permissions 33 | - [MagiskPolicy] Support printing out the loaded sepolicy rules 34 | - [App] Support patching boot image from ROM zips 35 | - [App] Properly preserve `boot.img` when patching Samsung firmware with `init_boot.img` 36 | 37 | ::: 38 | 39 | **完整更新日志: [这里](/changes.html)** 40 | -------------------------------------------------------------------------------- /ota.md: -------------------------------------------------------------------------------- 1 | # OTA 升级指南 2 | 3 | Magisk 不修改大多数只读分区,这意味着应用官方 OTA 要简单得多。以下是几种不同类型的设备的教程,以应用 OTA 并在安装后保留 Magisk(如果可能)。这只是一个通用指南,因为每个设备的程序可能有所不同。 4 | 5 | **注意:为了应用 OTA,您必须确保自己没有以任何方式修改只读分区(如 `/system` 或 `/vendor` )。即使将分区重新挂载到 rw 也会篡改块验证** 6 | 7 | ## 必要条件 8 | 9 | - 请在开发人员选项中禁用*自动系统更新*,这样在未经您确认的情况下,它不会安装 OTA。 10 | 11 |

12 | 13 | - 当OTA可用时,首先转到(Magisk app → 卸载 → 恢复映像),**不要重新启动,否则将卸载 Magisk。** 这将使 Magisk 修改的分区从安装时的生成备份恢复到官方,以便通过 OTA 前的块验证。**在执行以下步骤之前,需要执行此步骤** 14 | 15 |

16 | 17 | ## 带 A/B 分区的设备 18 | 19 | 可以将 OTA 安装到非活动插槽,并让 Magisk app 将 Magisk 安装到更新的分区上。开箱即用的 OTA 安装工作无缝,安装后可以保存 Magisk。 20 | 21 | - 恢复官方映像后,按正常方式应用 OTA(设置 → 系统 → 系统更新)。 22 | - 等待安装完成(OTA 的 步骤1:“安装更新” 和 步骤2:“优化您的设备”),**不要按“重新启动”按钮!** 相反,请转到(Magisk app → 安装 → 安装到非活动插槽)将 Magisk 安装到更新的插槽。 23 | 24 |

25 | 26 | - 安装完成后,按下 Magisk app 中的重新启动按钮。在 hood 下,Magisk app 强制您的设备切换到更新的插槽,绕过任何可能的 OTA 后验证。 27 | 28 |

29 | 30 | ## “非 A/B” 设备 31 | 32 | 不幸的是,在这些设备上应用 OTA 并没有真正好的方法。以下教程不会保留 Magisk;升级后,您必须手动重新 root 设备,这将需要通过电脑。这些只是“最佳实践”。 33 | 34 | - 如果您安装了第三方 recovery,则可以从以前的备份、在线转储或 OEM 提供的出厂映像中恢复。 35 | 如果您决定在不接触 recovery 分区的情况下开始安装 Magisk,您可以有几种选择,无论是哪种方式,您都可以最终使用 Magisk root 的设备,但 recovery 仍然保持不变: 36 | - 如果支持,请使用 `fastboot boot ` 启动第三方 Recovery 并安装 Magisk。 37 | - 如果您有官方映像转储的副本,请使用 Magisk app 的“修补映像”功能安装 Magisk 38 | - 恢复到官方映像和其他映像后,下载 OTA。可选地,一旦下载了 OTA 的更新 zip,就可以找到提取 zip 的方法(因为它通常涉及 root 用户) 39 | - 应用 OTA 并重启设备。这将使用您设备的官方映像 OTA 安装机制来升级您的系统。 40 | - 一旦完成,您将得到一个升级的、100% 官方的、未 root 的设备。你必须手动将 Magisk 刷回。如果您想经常接收官方 OTA,请考虑使用 步骤1 中所述的方法,在不接触恢复分区的情况下刷入 Magisk。 41 | 42 | ## 参考链接 43 | 44 | - [Magisk OTA Upgrade Guides](https://topjohnwu.github.io/Magisk/ota.html)(官方) 45 | -------------------------------------------------------------------------------- /releases/21000.md: -------------------------------------------------------------------------------- 1 | # 2020.10.3 Magisk v21.0 2 | 3 | Long time no see! v21.0 is the largest release in Magisk's history. It comes with full Android 11 support (tons of stuff had to be rewritten from scratch!), and a completely redesigned Magisk Manager. These are the reasons why this particular public release took me over half a year to wrap up. 4 | 5 | To the end user, not much has changed other than the fact that Magisk Manager has completely changed its appearance. However developers should pay attention to some changes due to adjustments for Android 11. Full changelogs are too massive to fit, so here I'll point out the main changes and links to updated documentations. 6 | 7 | ## Highlights 8 | 9 | - Android 11 support 🎉 10 | - Completely redesigned Magisk Manager 11 | - Safe Mode detection: if you installed a module that bootloops your device, reboot into Safe Mode and all modules will be disabled. More instructions on how to deal with broken modules is linked [here](https://topjohnwu.github.io/Magisk/faq.html). 12 | 13 | The following are for advanced users/developer: 14 | 15 | - On Android 8.0+, Magisk now uses a new SELinux setup that keeps Android sandbox less compromised. This provides better security to rooted users, and also separates Magisk rules from original rules. Details [here](https://topjohnwu.github.io/Magisk/details.html#selinux-policies). 16 | - On Android 11, `/sbin` may no longer exist. For developers, this means the Magisk's internal `tmpfs` directory is no longer always `/sbin`, and instead randomly created every boot. To get the `tmpfs` path, use the command `magisk --path` (more details [here](https://topjohnwu.github.io/Magisk/details.html)). For custom kernel developers that uses `overlay.d`, updated docs are [here](https://topjohnwu.github.io/Magisk/guides.html#root-directory-overlay-system). 17 | - `magiskpolicy` gained more features and some minor syntax changes, details [here](https://topjohnwu.github.io/Magisk/tools.html#magiskpolicy). 18 | 19 | **完整更新日志: [这里](/changes.html)** 20 | -------------------------------------------------------------------------------- /faq.md: -------------------------------------------------------------------------------- 1 | # 常见问题 2 | 3 | ## Q: 我安装了一个模块,然后启动时卡在了开机动画。求助 4 | 5 | 如果在开发人员选项中启用了USB调试,请将手机连接到 PC。如果检测到了设备(通过 `adb devices` 检查),请进入 ADB shell 并运行命令 `magisk --remove-modules`。这将删除所有模块并自动重新启动设备。 6 | 7 | ::: tip 译者提示 8 | 如果您不知道什么是 ADB shell ,那么请在电脑上直接运行以下命令 9 | 10 | ``` shell 11 | adb shell magisk --remove-modules 12 | ``` 13 | 14 | 如果您还不知道什么是 ADB ,那么请查看[《Android 调试桥 (adb)》](https://developer.android.google.cn/studio/command-line/adb?hl=zh-cn) 15 | ::: 16 | 17 | 如果您没有启用 USB 调试功能,那么您可以使用安全模式组合键来启动设备,这将使 Magisk 在模块目录中创建一个名为 `disable` 的空文件,以便在下次使用 Magisk 启动时禁用模块。大多数现代 Android 设备都支持在启动时通过特殊的组合键进入系统的安全模式作为紧急选项,但**请注意**,Magisk 的组合键检测发生在系统检测**之前**,因此许多在线指南中指示的组合键的时间可能需要调整,以激活 Magisk 的安全模式。(可能激活了系统的安全模式而没有激活 Magisk 的安全模式,反之亦然。) 18 | 19 | 以下细节应确保模块被正确禁用: 20 | 21 | 1. 许多在线指南中提到,进入安全模式时要“当动画标志出现时,按住音量减小键直到系统启动”或类似的说法。然而,这对于 Magisk 检测来说可能**已经太晚**,导致系统安全模式被激活,但模块没有被禁用。 22 | 2. 在动画开始前几秒钟按下音量减小键,并在动画出现后立即释放,这样可以激活 Magisk 的安全模式而不激活系统的安全模式(从而避免禁用其他设备和应用程序设置),然后设备将正常启动,但模块被禁用。 23 | 3. 在动画开始前几秒钟按下音量减小键,并一直按住直到系统启动,这样既可以激活 Magisk 的安全模式,也可以激活系统的安全模式。接下来,在重新启动到正常系统后,模块将被禁用。 24 | 25 | ## Q: 为什么 XXX应用会检测到 Root? 26 | 27 | Magisk 不再处理 Root 隐藏。有大量 Magisk/Zygisk 模块专门提供这些功能,请在网络上查找它们。😉(您可以在“酷安”或者“哔哩哔哩”中搜索) 28 | 29 | 比较流行的模块是 [Shamiko](https://github.com/LSPosed/LSPosed.github.io/releases/latest) 。 30 | 31 | ::: warning 警告 32 | 如果你使用的是「[Magisk Delta](https://huskydg.github.io/magisk-files/)」,则[无法使用](https://huskydg.github.io/magisk-files/docs/faq.html#should-i-install-shxxxxo-module-to-hide-root)此模块! 33 | ::: 34 | 35 | ## Q: 在我隐藏 Magisk App 后,应用图标显示异常 36 | 37 | 当隐藏 Magisk App 时,它将安装一个“占位”APK,其中没有任何内容。这个占位应用程序的唯一功能是将完整的 Magisk app APK 下载到内部存储并动态加载。由于 APK 实际上是 _empty_,因此它不包含 APP 的图标资源。 38 | 39 | 当您打开隐藏的 Magisk App 时,它将为您提供在主屏幕中创建快捷方式的选项(其中包含正确的应用名称和图标),以方便您使用。您还可以手动要求应用在应用设置中创建图标。 40 | 41 | ## Q: 为什么这个文档很多错误或者不通顺的地方 42 | 43 | 这个文档本质上还是机器翻译的,然而机器翻译的正确率有待提高。如果您发现了这些错误或者不通顺的地方,希望您可以向我们[提交反馈](https://gitee.com/Jesse205/magisk-chinese-document/issues)。 44 | 45 | ## 参考链接 46 | 47 | * [Magisk Frequently Asked Questions](https://topjohnwu.github.io/Magisk/faq.html)(官方) 48 | -------------------------------------------------------------------------------- /releases/24000.md: -------------------------------------------------------------------------------- 1 | # 2022.1.26 Magisk v24.0 2 | 3 | It has been a while since the last public release, long time no see! A personal update for those unaware: I am now working at Google on the Android Platform Security team. Without further ado, let's jump right into it! 4 | 5 | ## MagiskHide Removal 6 | 7 | I have lost interest in fighting this battle for quite a while; plus, the existing MagiskHide implementation is flawed in so many ways. Decoupling Magisk from root hiding is, in my opinion, beneficial to the community. Ever since my announcement on Twitter months ago, highly effective "root hiding" modules (much **MUCH** better than MagiskHide) has been flourishing, which again shows that people are way more capable than I am on this subject. So why not give those determined their time to shine, and let me focus on improving Magisk instead of drowning in the everlasting cat-and-mouse game 😉. 8 | 9 | ## Sunsetting Magisk-Modules-Repo 10 | 11 | Due to lack of time and maintenance, the centralized Magisk-Modules-Repo was frozen, and the functionality to download modules from the repo is removed in v24.0. As a supplement, module developers can now specify an `updateJson` URL in their modules. The Magisk app will use that to check, download, and install module updates. 12 | 13 | ## Introducing Zygisk 14 | 15 | Zygisk is **Magisk in Zygote**, the next big thing for Magisk! When this feature is enabled, a part of Magisk will run in the `Zygote` daemon process, allowing module developers to run code directly in every Android apps' processes. If you've heard of [Riru](https://github.com/RikkaApps/Riru), then Zygisk is inspired by that project and is functionally similar, though the implementation is quite different internally. I cannot wait to see what module developers can achieve using Zygisk! 16 | 17 | ## Documentation 18 | 19 | For developers, details about `updateJson` and building Zygisk modules can all be found in the updated [documentation](https://topjohnwu.github.io/Magisk/guides.html#magisk-modules). 20 | 21 | **完整更新日志: [这里](/changes.html)** 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Magisk 中文文档 | Magisk Chinese Document 2 | 3 | 这是由 Jesse205 根据 [Magisk 官方文档](https://topjohnwu.github.io/Magisk/) 翻译的中文文档,并补充了一些内容。 4 | 5 | This is a Chinese translation by Jesse205 based on [Magisk official documentation](https://topjohnwu.github.io/Magisk/) with some additions. 6 | 7 | [![License](https://img.shields.io/github/license/Jesse205/MagiskChineseDocument)](./LICENSE) 8 | 9 | ![截图](https://jesse205.github.io/images/graphs/magisk_chinese_document.webp) 10 | 11 | **这不是官方支持的 topjohnwu 项目!** 12 | 13 | - 文档链接: 14 | - 官方文档: 15 | 16 | > [!NOTE] 17 | > 18 | > 此仓库分别存在 Gitee 与 Github 上,Gitee 为主仓库,Github 为镜像仓库 19 | > 20 | > - [Gitee 仓库](https://gitee.com/Jesse205/magisk-chinese-document) 21 | > - [GitHub 仓库](https://github.com/Jesse205/MagiskChineseDocument) 22 | 23 | ## 开发 24 | 25 | 本项目使用 pnpm,开发环境需要安装 [pnpm](https://pnpm.io/)。 26 | 27 | - 调试:`pnpm dev` 28 | - 构建:`pnpm build` 29 | 30 | ## 贡献 31 | 32 | - 请尽量采用[《中文技术文档写作规范》](https://github.com/ruanyf/document-style-guide)。 33 | - 建议尽量使用 Gitee 提交 pr,其他镜像平台提交的内容可能会因强制推送丢失。 34 | 35 | ## 许可 36 | 37 | ``` txt 38 | Copyright (C) 2023 Jesse205 39 | 40 | This program is free software: you can redistribute it and/or modify 41 | it under the terms of the GNU General Public License as published by 42 | the Free Software Foundation, either version 3 of the License, or 43 | (at your option) any later version. 44 | 45 | This program is distributed in the hope that it will be useful, 46 | but WITHOUT ANY WARRANTY; without even the implied warranty of 47 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 48 | GNU General Public License for more details. 49 | 50 | You should have received a copy of the GNU General Public License 51 | along with this program. If not, see . 52 | ``` 53 | 54 | > [!NOTE] 55 | > 56 | > 如果您**只是**引用了本文档**翻译**的内容,则您的代码无需遵循 GPL 许可。 57 | 58 | ## Star 历史 59 | 60 | [![Star 历史图表](https://api.star-history.com/svg?repos=Jesse205/MagiskChineseDocument&type=Date)](https://star-history.com/#Jesse205/MagiskChineseDocument&Date) 61 | -------------------------------------------------------------------------------- /releases/26300.md: -------------------------------------------------------------------------------- 1 | # 2023.9.4 Magisk v26.3 2 | 3 | ## v26.3 4 | 5 | - [常规] 修复设备信息检测脚本 6 | - [常规] 将 BusyBox 更新到 1.36.1 7 | - [常规] 更新工具链,生成损坏的 arm32 可执行文件 8 | - [应用] 修复根服务无法绑定一加设备的问题 9 | 10 | ::: details 英文原版 11 | 12 | - [General] Fix device information detection script 13 | - [General] Update BusyBox to 1.36.1 14 | - [General] Update toolchain that produces broken arm32 executables 15 | - [App] Fix root service unable to bind on OnePlus devices 16 | 17 | ::: 18 | 19 | ## v26.2 20 | 21 | - [MagiskBoot] 支持从`payload.bin`中提取启动映像 22 | - [MagiskBoot] 支持包含字符文件的 cpio 文件 23 | - [MagiskBoot] 支持列出 cpio 内容 24 | - [MagiskBoot] 直接处理 AVB 1.0 签名和验证,无需通过 Java 实现 25 | - [守护进程] 使守护程序套接字成为 MAGISKTMP 中的固定路径 26 | - [resetprop] 支持打印属性上下文 27 | - [resetprop] 仅支持从存储中打印持久属性 28 | - [resetprop] 正确支持设置持久属性绕过 property_service 29 | - [MagiskSU] 支持 `-g` 和 `-G` 选项 30 | - [MagiskSU] 支持使用 `-t` 将挂载命名空间切换到 PID 31 | - [MagiskPolicy] 修复修补扩展权限 32 | - [MagiskPolicy] 支持更多语法以获得扩展权限 33 | - [MagiskPolicy] 支持打印加载的 sepolicy 规则 34 | - [应用程序] 支持从 ROM 压缩包修补启动映像 35 | - [应用程序] 使用 `init_boot.img` 修补三星固件时正确保留 `boot.img` 36 | 37 | ::: details 英文原版 38 | 39 | - [MagiskBoot] Support extracting boot image from `payload.bin` 40 | - [MagiskBoot] Support cpio files containing character files 41 | - [MagiskBoot] Support listing cpio content 42 | - [MagiskBoot] Directly handle AVB 1.0 signing and verification without going through Java implementation 43 | - [Daemon] Make daemon socket a fixed path in MAGISKTMP 44 | - [resetprop] Support printing property context 45 | - [resetprop] Support only printing persistent properties from storage 46 | - [resetprop] Properly support setting persistent properties bypassing property_service 47 | - [MagiskSU] Support `-g` and `-G` options 48 | - [MagiskSU] Support switching mount namespace to PID with `-t` 49 | - [MagiskPolicy] Fix patching extended permissions 50 | - [MagiskPolicy] Support more syntax for extended permissions 51 | - [MagiskPolicy] Support printing out the loaded sepolicy rules 52 | - [App] Support patching boot image from ROM zips 53 | - [App] Properly preserve `boot.img` when patching Samsung firmware with `init_boot.img` 54 | 55 | ::: 56 | 57 | **完整更新日志: [这里](/changes.html)** 58 | -------------------------------------------------------------------------------- /releases/24100.md: -------------------------------------------------------------------------------- 1 | # 2022.1.28 Magisk v24.1 2 | 3 | > For those coming from v24.0, v24.1 only has some minor app improvements. The following are copied from v24.0 release notes. 4 | 5 | It has been a while since the last public release, long time no see! A personal update for those unaware: I am now working at Google on the Android Platform Security team. Without further ado, let's jump right into it! 6 | 7 | ## MagiskHide Removal 8 | 9 | I have lost interest in fighting this battle for quite a while; plus, the existing MagiskHide implementation is flawed in so many ways. Decoupling Magisk from root hiding is, in my opinion, beneficial to the community. Ever since my announcement on Twitter months ago, highly effective "root hiding" modules (much **MUCH** better than MagiskHide) has been flourishing, which again shows that people are way more capable than I am on this subject. So why not give those determined their time to shine, and let me focus on improving Magisk instead of drowning in the everlasting cat-and-mouse game 😉. 10 | 11 | ## Sunsetting Magisk-Modules-Repo 12 | 13 | Due to lack of time and maintenance, the centralized Magisk-Modules-Repo was frozen, and the functionality to download modules from the repo is removed in v24.0. As a supplement, module developers can now specify an `updateJson` URL in their modules. The Magisk app will use that to check, download, and install module updates. 14 | 15 | ## Introducing Zygisk 16 | 17 | Zygisk is **Magisk in Zygote**, the next big thing for Magisk! When this feature is enabled, a part of Magisk will run in the `Zygote` daemon process, allowing module developers to run code directly in every Android apps' processes. If you've heard of [Riru](https://github.com/RikkaApps/Riru), then Zygisk is inspired by that project and is functionally similar, though the implementation is quite different internally. I cannot wait to see what module developers can achieve using Zygisk! 18 | 19 | ## Documentation 20 | 21 | For developers, details about `updateJson` and building Zygisk modules can all be found in the updated [documentation](https://topjohnwu.github.io/Magisk/guides.html#magisk-modules). 22 | 23 | **完整更新日志: [这里](/changes.html)** 24 | -------------------------------------------------------------------------------- /index.md: -------------------------------------------------------------------------------- 1 | --- 2 | aside: false 3 | titleTemplate: false 4 | 5 | --- 6 | 7 | # Magisk 中文文档 8 | 9 | ![logo](/images/logo.png) 10 | 11 | > 本文档翻译了 [Magisk 官方文档](https://topjohnwu.github.io/Magisk/) 和 [Magisk Delta 文档](https://huskydg.github.io/magisk-files/) 并补充了很多内容。 12 | 13 | - [安装说明](install.md) 14 | - [常见问题](faq.md) 15 | - [发布日志](releases/) 16 | - [Magisk 更新日志](changes.md) 17 | 18 | **以下部分面向开发者**: 19 | 20 | - [构建和开发 Magisk](build.md) (开发 Magisk 本身) 21 | - [开发者指南](guides.md) (针对 **使用 Magisk** 的开发人员) 22 | - [Magisk 工具](tools.md) 23 | - [内部细节](details.md) 24 | - [Android 引导诡计](boot.md) 25 | 26 | **Magisk Delta**: 27 | 28 | - [常见问题](./delta/faq.md) 29 | - [内部文档](./delta/internal-guide.md) 30 | 31 | ## Magisk 许可(License) 32 | 33 | ::: warning 34 | 中文汉化版许可仅供参考,**请以英文原版为准!** 35 | ::: 36 | 37 | ::: code-group 38 | 39 | ``` txt [中文汉化 ] 40 | Magisk,包括所有 git 子模块都是自由软件: 41 | 您可以根据自由软件基金会发布的 GNU 通用公共许可证的条款(许可证的第3版, 42 | 或(根据您的选择)任何更高版本重新分发和/或修改它。 43 | 44 | 分发此程序是希望它有用,但没有任何保证;甚至没有适销性或特定用途适用性 45 | 的隐含保证。有关详细信息,请参阅 GNU 通用公共许可证。 46 | 47 | 你应该已经收到了GNU通用公共许可证的副本以及这个程序。如果没有,请参见 48 | 。 49 | ``` 50 | 51 | ``` txt [英文原版] 52 | Magisk, including all git submodules are free software: 53 | you can redistribute it and/or modify it under the terms of the 54 | GNU General Public License as published by the Free Software Foundation, 55 | either version 3 of the License, or (at your option) any later version. 56 | 57 | This program is distributed in the hope that it will be useful, 58 | but WITHOUT ANY WARRANTY; without even the implied warranty of 59 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 60 | GNU General Public License for more details. 61 | 62 | You should have received a copy of the GNU General Public License 63 | along with this program. If not, see . 64 | ``` 65 | 66 | ::: 67 | 68 | ## 感谢 69 | 70 | - [@0ZDragon](https://github.com/0ZDragon) 71 | - 翻译工具:文心一言、百度翻译、Bing 翻译、DeepL 72 | 73 | ## 相关链接 74 | 75 | - [Magisk 官方仓库](https://github.com/topjohnwu/Magisk) 76 | - [Magisk 官方文档](https://topjohnwu.github.io/Magisk/) 77 | - [Magisk Delta](https://huskydg.github.io/magisk-files/) 78 | 79 | ## 友情链接 80 | 81 | - [刷机指南](https://jesse205.github.io/FlashAndroidDevicesGuidelines) 82 | - [Edde 系列](https://jesse205.github.io/) 83 | - [Magisk 资源分享](https://main.suchenqaq.club/) 84 | -------------------------------------------------------------------------------- /.vitepress/theme/styles/custom.scss: -------------------------------------------------------------------------------- 1 | @import url(./JetBrains-Mono.scss); 2 | 3 | :root { 4 | /* Base Colors */ 5 | --c-md-teal-50-alpha: #00968819; 6 | --c-md-teal-100-alpha: #0096874d; 7 | --c-md-teal-100: #b2dfdb; 8 | --c-md-teal-300: #4db6ac; 9 | --c-md-teal-400: #26a69a; 10 | --c-md-teal-500: #009688; 11 | --c-md-teal-600: #00897b; 12 | --c-md-teal-700: #00796b; 13 | 14 | --c-md-pink-50-alpha: #e91e6319; 15 | --c-md-pink-100-alpha: #e91e634d; 16 | --c-md-pink-100: #f8bbd0; 17 | --c-md-pink-300: #f06292; 18 | --c-md-pink-400: #ec407a; 19 | --c-md-pink-500: #e91e63; 20 | --c-md-pink-600: #d81b60; 21 | --c-md-pink-700: #c2185b; 22 | } 23 | 24 | :root { 25 | /* Theme Colors */ 26 | --vp-c-brand-1: var(--c-md-teal-500); 27 | --vp-c-brand-2: var(--c-md-teal-300); 28 | --vp-c-brand-3: var(--c-md-teal-300); 29 | --vp-c-brand-soft: var(--c-md-teal-50-alpha); 30 | --color-selection: var(--c-md-teal-100-alpha); 31 | --vp-code-block-color: var(--vp-c-text-1); 32 | 33 | /* Fonts */ 34 | --vp-font-family-mono: 'JetBrains Mono', 'JetBrains Mono Online', ui-monospace, SFMono-Regular, 'SF Mono', Menlo, 35 | Monaco, Consolas, 'Liberation Mono', 'Courier New', var(--vp-font-family-base), monospace; 36 | --vp-code-line-height: 1.5; /* 1.5对于文件树友好,可以产生连体效果 */ 37 | } 38 | 39 | .delta { 40 | /* Theme Colors */ 41 | --vp-c-brand-1: var(--c-md-pink-500); 42 | --vp-c-brand-2: var(--c-md-pink-300); 43 | --vp-c-brand-3: var(--c-md-pink-300); 44 | --vp-c-brand-soft: var(--c-md-pink-50-alpha); 45 | --color-selection: var(--c-md-pink-100-alpha); 46 | } 47 | 48 | ::selection { 49 | background-color: var(--color-selection); 50 | } 51 | 52 | .vp-doc [class*='language-txt'] pre, 53 | .vp-doc [class*='language-txt'] code { 54 | -webkit-hyphens: auto; 55 | -moz-hyphens: auto; 56 | -ms-hyphens: auto; 57 | hyphens: auto; 58 | } 59 | 60 | // 当拥有侧边栏时显示底部信息 61 | 62 | .VPDoc.VPDoc { 63 | padding-bottom: 48px; 64 | @media (min-width: 960px) { 65 | padding-bottom: 0; 66 | .content { 67 | padding-bottom: 48px; 68 | } 69 | } 70 | } 71 | 72 | .VPFooter.VPFooter { 73 | .vp-doc a:hover { 74 | color: var(--vp-c-brand-2); 75 | } 76 | 77 | &.has-sidebar { 78 | display: block; 79 | @media (min-width: 960px) { 80 | margin-left: var(--vp-sidebar-width); 81 | } 82 | @media (min-width: 1440px) { 83 | margin-right: calc((100vw - var(--vp-layout-max-width)) / 2); 84 | margin-left: calc((100vw - var(--vp-layout-max-width)) / 2 + var(--vp-sidebar-width)); 85 | } 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /releases/25000.md: -------------------------------------------------------------------------------- 1 | # 2022.6.7 Magisk v25.0 2 | 3 | Another major release! A lot of the changes aren't visible at the surface, but v25 is actually a really substantial upgrade! 4 | 5 | ## MagiskInit Rewrite 6 | 7 | A significant portion of `magiskinit` (the critical software that runs before your device boots up) is completely rewritten from scratch. Ever since Android introduced [Project Treble](https://android-developers.googleblog.com/2017/05/here-comes-treble-modular-base-for.html) in Android 8.0, Magisk has been constantly fighting against the increasingly complex partitioning and early mount setups of all kinds of devices, sometimes with weird OEM specific implementations. It got to a point that `magiskinit` had become so complicated that few people (including myself!) were aware of every detail, and maintaining this piece of software like this was clearly not sustainable. After many months of planning (yes, this whole re-architecture has been in my head for a long time) and some help from external contributors, a whole new `sepolicy` injection mechanism is introduced into Magisk, solving the "SELinux Problem" once and for all. 8 | 9 | Since this is a full paradigm shift on how Magisk hot-patch the device at boot, several behaviors that many developers implicitly relied on might not exist. For example, Magisk no longer patches fstabs in most scenarios, which means AVB will remain intact; some custom kernels rely on AVB being stripped out for them by Magisk. 10 | 11 | ## MagiskSU Security Enhancements 12 | 13 | The superuser functionality of Magisk has not seen much changes ever since its introduction. v25 focuses on making root permission management more accurate and secure: 14 | 15 | - Add a whole new package tracking system to ensure malicious UID reuse attack cannot be performed 16 | - Properly support and implement the UX in the Magisk app for packages using `sharedUserId` 17 | - Enforce root manager APK signature verification to combat the rampant unofficial Magisk app "mods" 18 | 19 | Many might not realize, but using a trusted, unmodified Magisk app is really important. Magisk's root daemon treats the Magisk app differently and gives it blanket root access without any restrictions. A modded Magisk app can potentially backdoor your device. 20 | 21 | And in case some of you are about to put on your tin foil hats, this is not designed to "vendor lock-in"; the goal is to make sure your root management app comes from the same developer of the underlying root implementation. Magisk's build system allows custom distributors to use its own signing keys, and in addition, I am also providing official debug builds which skips any signature verification for development. 22 | 23 | **完整更新日志: [这里](/changes.html)** 24 | -------------------------------------------------------------------------------- /releases/25100.md: -------------------------------------------------------------------------------- 1 | # 2022.6.19 Magisk v25.1 2 | 3 | > v25.1 fixes some minor bugs over v25.0. The following are the same as v25.0 release notes. 4 | 5 | Another major release! A lot of the changes aren't visible at the surface, but v25 is actually a really substantial upgrade! 6 | 7 | ## MagiskInit Rewrite 8 | 9 | A significant portion of `magiskinit` (the critical software that runs before your device boots up) is completely rewritten from scratch. Ever since Android introduced [Project Treble](https://android-developers.googleblog.com/2017/05/here-comes-treble-modular-base-for.html) in Android 8.0, Magisk has been constantly fighting against the increasingly complex partitioning and early mount setups of all kinds of devices, sometimes with weird OEM specific implementations. It got to a point that `magiskinit` had become so complicated that few people (including myself!) were aware of every detail, and maintaining this piece of software like this was clearly not sustainable. After many months of planning (yes, this whole re-architecture has been in my head for a long time) and some help from external contributors, a whole new `sepolicy` injection mechanism is introduced into Magisk, solving the "SELinux Problem" once and for all. 10 | 11 | Since this is a full paradigm shift on how Magisk hot-patch the device at boot, several behaviors that many developers implicitly relied on might not exist. For example, Magisk no longer patches fstabs in most scenarios, which means AVB will remain intact; some custom kernels rely on AVB being stripped out for them by Magisk. 12 | 13 | ## MagiskSU Security Enhancements 14 | 15 | The superuser functionality of Magisk has not seen much changes ever since its introduction. v25 focuses on making root permission management more accurate and secure: 16 | 17 | - Add a whole new package tracking system to ensure malicious UID reuse attack cannot be performed 18 | - Properly support and implement the UX in the Magisk app for packages using `sharedUserId` 19 | - Enforce root manager APK signature verification to combat the rampant unofficial Magisk app "mods" 20 | 21 | Many might not realize, but using a trusted, unmodified Magisk app is really important. Magisk's root daemon treats the Magisk app differently and gives it blanket root access without any restrictions. A modded Magisk app can potentially backdoor your device. 22 | 23 | And in case some of you are about to put on your tin foil hats, this is not designed to "vendor lock-in"; the goal is to make sure your root management app comes from the same developer of the underlying root implementation. Magisk's build system allows custom distributors to use its own signing keys, and in addition, I am also providing official debug builds which skips any signature verification for development. 24 | 25 | **完整更新日志: [这里](/changes.html)** 26 | -------------------------------------------------------------------------------- /releases/20400.md: -------------------------------------------------------------------------------- 1 | # 2020.3.23 Magisk v20.4 2 | 3 | ## Miscellaneous 4 | This release is mainly focused on stability and bug squashing. Please be aware that MagiskHide is no longer enabled by default. Since Google has enabled [hardware-based key attestation](https://twitter.com/topjohnwu/status/1237656703929180160?s=20) in SafetyNet ([FAQ](https://twitter.com/topjohnwu/status/1237830555523149824?s=20)), there is no effective way to pass full CTS SafetyNet anymore (although Google seems to have temporarily [reverted the change](https://twitter.com/topjohnwu/status/1238514375150850048?s=20)). 5 | 6 | I decided that the fully redesigned Magisk Manager isn't fully ready for prime time yet, so this time around no Magisk Manager update is released. The WIP manager will continue to be improved and is available for testing on the canary channel. 7 | 8 | ## BusyBox Standalone Mode 9 | Starting with Magisk v20.4, all Magisk related scripts, including boot scripts and module installation scripts, will run on BusyBox's shell (ash) in **standalone mode**. In BusyBox ash standalone mode, **every single command** will be **forced** to use the one that is in Magisk's BusyBox (if available). For instance, no matter how you change the environment variable `PATH`, the `rm` command will always use the one in BusyBox, not the one in system, external BusyBox, vendor, or included in custom recovery. 10 | 11 | The reason behind this change is that all scripts will be guaranteed to have 100% consistent results no matter how the environment is setup. The internal BusyBox is significantly beefed up with patches from @osm0sis, and also with SELinux features enabled. It shall offer a very complete, reliable, and consistent scripting environment. If in any case you **require** to use a command outside of BusyBox, please call it with the full path (e.g. `/system/bin/nslookup`) 12 | 13 | ## Magisk Changelog 14 | - [MagiskInit] Fix potential bootloop in A-only 2SI devices 15 | - [MagiskInit] Properly support Tegra partition naming 16 | - [General] Load libsqlite.so dynamically, which removes the need to use wrapper scripts on Android 10+ 17 | - [General] Detect API level with a fallback method on some devices 18 | - [General] Workaround possible bug in x86 kernel readlinkat system call 19 | - [BusyBox] Enable SELinux features. Add chcon/runcon etc., and '-Z' option to many applets 20 | - [BusyBox] Introduce standalone mode. More details in release notes 21 | - [MagiskHide] Disable MagiskHide by default 22 | - [MagiskHide] Add more potential detectable system properties 23 | - [MagiskHide] Add workaround for Xiaomi devices bootloop when MagiskHide is enabled on cross region ROMs 24 | - [MagiskBoot] Support patching special Motorolla DTB format 25 | - [MagiskPolicy] Support 'genfscon' sepolicy rules 26 | - [Scripts] Support NAND based boot images (character nodes in /dev/block) 27 | - [Scripts] Better addon.d (both v1 and v2) support 28 | - [Scripts] Support Lineage Recovery for Android 10+ 29 | -------------------------------------------------------------------------------- /releases/18000.md: -------------------------------------------------------------------------------- 1 | # 2018.12.7 Magisk v18.0 2 | 3 | Here comes a stable release, this time with quite a few major updates! 4 | 5 | ## MagiskHide Improvements 6 | Starting from v18, the process monitor matches component names instead of process names. Android allow app services to name their process arbitrarily, and many apps starting to use dedicated services to detect root; it used to require adding all of these service process names to the list to hide Magisk effectively. Component names have the format: `/`, which means we can always know which application spawned a given process. 7 | 8 | **TL;DR, ALL processes spawned from the applications on the hide list will be targeted.** 9 | 10 | Recently I discovered a *very widespread Linux kernel bug* affecting tons of Android devices (full write-up: [Medium Article](https://medium.com/@topjohnwu/from-anime-game-to-android-system-security-vulnerability-9b955a182f20)). This bug exposes the supposedly protected `procfs`, which is abused in some apps to detect Magisk with information leaked from other processes. Magisk will patch this bug on all Android 7.0+ devices. Yes, a fully effective MagiskHide requires the enhanced Android Sandbox in modern Android versions. 11 | 12 | ## Path Changes 13 | The name of the folder `/sbin/.core` is confusing and will no longer be used; it is replaced with `/sbin/.magisk`. Another major change is the location to store general boot scripts. As these boot scripts should still run even if `magisk.img` is not mounted, they are moved out of `magisk.img`, from `/.core/.d` to `/data/adb/.d` (stage is either `post-fs-data` or `service`). Say goodbye to stupid paths like `/sbin/.core/img/.core/post-fs-data.d`! 14 | 15 | Quick recap: 16 | 17 | - New `magisk.img` mountpoint: `/sbin/.magisk/img` 18 | - New internal busybox PATH: `/sbin/.magisk/busybox` 19 | - The folder `/.core` is no longer used in any places. `magisk.img` is solely used for storing modules, no other functionality depends on it. 20 | - **Symlinks are created so all old paths will still work. None of the existing apps/scripts depending on these internal paths should break, but please migrate to the new paths ASAP.** 21 | 22 | ## Dropping Legacy Support 23 | **The NEXT Magisk Manager upgrade (not this one) will only support v18+, please upgrade ASAP.** Magisk Manager is always designed to be fully functional across a wide range of Magisk versions. However, to enforce full obfuscation, I will have to drop legacy support eventually. 24 | 25 | This is also a good opportunity to push the whole community forward, all module developers should forget about backward compatibility (e.g. stop supporting the old Magisk paths, please don't torture yourself...). I expect very few structural changes in the near future, so again, please upgrade ASAP :) 26 | 27 | ## Modern C++ Code Base 28 | Although this has nothing to do with the end user, tons of effort was done to migrate Magisk to a more modern C++ code base instead of the previous good plain old C. This makes the code easier to maintain and allows me to utilized many C++ language features. 29 | 30 | **完整更新日志: [这里](/changes.html)** 31 | -------------------------------------------------------------------------------- /releases/20000.md: -------------------------------------------------------------------------------- 1 | # 2019.10.11 Magisk v20.0 2 | The following release notes are mostly the same as v19.4. Compared to v19.4 beta, the most notable change is adding tons of support for more devices on Android 10, along with several bug fixes. 3 | 4 | ## New System-as-root Implementation 5 | Magisk has supported system-as-root devices for a long time since the first Pixel came out. The goal is always to revert things back to the good old initramfs based root dir. However, this not only creates tons of issues on many devices, not easily hide-able with MagiskHide, but most importantly not even possible on Android 10. Magisk will now start to follow how Google has designed system-as-root: mounting system actually to `/` (root). 6 | 7 | This implies several **MASSIVE** consequences for system-as-root devices: 8 | - `/system` is no longer a valid mount point. For existing root apps that remounts `/system` to `rw`, you will have to remount `/` instead of `/system` 9 | - The root directory (`/`) is no longer `rootfs`, but actually system. Remounting `/` to `rw` and modify files means you are writing to the actual system partition, NOT volatile storage as it used to be in `rootfs`. This is not recommended as user is not necessary aware that you are tampering an actual partition, sometimes dangerous if dm-verity/AVB-verity is enforced, or sometimes outright impossible since many devices now ship with read-only system partitions (e.g. EROFS, EXT4 dedup) 10 | - Several custom kernel rely on Magisk's root directory overlay system (`overlay`) for modifying `/`. This is no longer compatible with the new implementation. A new overlay system (`overlay.d`) will replace the existing one as an alternative (details in [documentations](https://topjohnwu.github.io/Magisk/guides.html#root-directory-overlay-system)). To provide backwards compatibility, Magisk will switch to "Compat Mode" when `/overlay` is detected, which simply reverts to the old system-as-root setup. **Compat Mode will not work on Android 10 and will cause bootloop**. Although things will still work as it used to, **please upgrade to `overlay.d` ASAP**. 11 | 12 | ## Android 10 Support 13 | Android 10 is now fully supported with MagiskHide working as expected. Android 10's biggest challenge is the new "2-Stage-Init" system-as-root implementation, which requires modding early mount fstab in a specific way, and in many devices' cases involves patching DTBs in the boot image. 14 | 15 | (For those interested in "2-Stage-Init" and other details of system-as-root, check [this Twitter thread I tweeted](https://twitter.com/topjohnwu/status/1174392824625676288)) 16 | 17 | ## Product Partition Support 18 | Magisk Module developers can now finally properly modify files in `/product`! This partition is now an essential part in Android 10, and many files are moved from system to product. Please check [documentations](https://topjohnwu.github.io/Magisk/details.html#magic-mount) for more details. 19 | 20 | ## A-Only System-as-root 21 | A huge number of new devices have A-only system-as-root setups (Android 9.0). These unfortunate devices will have to install Magisk into the recovery partition. Please check the fully updated [Installation Guide](https://topjohnwu.github.io/Magisk/install.html) for more details. 22 | 23 | **完整更新日志: [这里](/changes.html)** 24 | -------------------------------------------------------------------------------- /delta/internal-guide.md: -------------------------------------------------------------------------------- 1 | # Magisk Delta 内部文档 2 | 3 | 本文档介绍了适用于安卓设备的无系统 root 解决方案 Magisk Delta 的部分高级功能。Magisk Delta 允许你在不改变原始启动映像的情况下修改设备,并提供一个统一的界面来管理模块、root 访问权限等。 4 | 5 | ## 早期挂载 6 | 7 | 有些文件需要在启动过程中尽早挂载,即在执行“启动”进程之前。Magisk Delta 提供了一种在“预启动”阶段使用 `early-mount.d` 目录挂载文件的方法。 8 | 9 | - 要检查 Magisk Delta 是否支持 `early-mount.d/v2`,请使用此代码: 10 | 11 | ``` bash 12 | EARLYMOUNTV2=false 13 | if grep "$(magisk --path)/.magisk/early-mount.d" /proc/mounts | grep -q '^early-mount.d/v2'; then 14 | EARLYMOUNTV2=true 15 | fi 16 | ``` 17 | 18 | - 要查找 `early-mount.d` 目录(Magisk v26+),请使用此代码: 19 | 20 | ``` bash 21 | $(magisk --path)/.magisk/early-mount.d 22 | ``` 23 | 24 | ### 常规挂载 25 | 26 | - 由于在 Magisk Delta v26.0+ 中使用了新的 sepolicy 规则实施 `early-mount.d/v2`,一般的早期挂载分区将挂载到 `$MAGISKTMP/.magisk/early-mount.d`。早期挂载分区与预启动分区相同,可以是其中之一: `data` 、`cache` 、`metadata` 、`cust` 、`persist`等。Magisk 在修补引导映像时会对预启动分区进行硬编码。 27 | 28 | > (*) 使用 `persist` 或 `metadata` 进行早期挂载时要小心,因为这些分区的大小非常有限。填满它们可能会导致设备无法启动。 29 | 30 | - 您可以将文件放到 `early-mount.d` 目录下的相应位置。例如,如果您想替换 `/vendor/etc/vintf/manifest.xml`,请将您的 `manifest.xml` 复制到 `$MAGISKTMP/.magisk/early-mount.d/system/vendor/etc/vintf/manifest.xml`。Magisk Delta 将在下次重启时挂载您的文件。其他不在 `early-mount.d/system` 中的文件将被忽略。 31 | 32 | ### 模块挂载 33 | 34 | - 自 Magisk Delta v26.0+ 使用 `early-mount.d/v2` 以来,您也可以将早期挂载文件放在 `/data/adb/modules//early-mount` 中。 35 | 36 | ::: tip 37 | 早期启动挂载只支持简单挂载,即可以替换文件,但不能添加新文件、文件夹或替换文件夹。 38 | ::: 39 | 40 | ## init.rc 注入 41 | 42 | ### 常规注入 43 | 44 | 如果您想在不重新打包启动映像的情况下将自定义 `*.rc` 脚本注入设备,Magisk Delta 提供了一种无系统地实现这一目标的方法。您可以使用 `initrc.d` 目录来存储自定义脚本,Magisk Delta 会在每次启动时将它们注入到 `init.rc` 中。 45 | 46 | - 自定义 `*.rc` 脚本的位置是 `$PRENITDIR/early-mount.d/initrc.d`。Magisk Delta 会在每次启动时将此文件夹中的所有脚本注入到 `init.rc` 中。 47 | - 您可以使用 `${MAGISKTMP}` 来引用 Magisk 的 tmpfs 目录。当 magiskinit 将 `${MAGISKTMP}` 注入到 `init.rc` 时,您的 `*.rc` 脚本中出现的 `${MAGISKTMP}` 模式将被替换为 Magisk 的 tmpfs 目录。 48 | - 启动时,Magisk 的镜像不可用,因此需要使用 `${MAGISKTMP}/.magisk/early-mount.d` 模式来访问 `early-mount.d` 目录的副本。 49 | 50 | 下面是一个自定义脚本的示例,名为 `custom.rc`,可以与 `initrc.d` 一起使用: 51 | 52 | ```bash 53 | # 使用 ${MAGISKTMP} 引用 Magisk 的 tmpfs 目录 54 | 55 | on early-init 56 | setprop sys.example.foo bar 57 | insmod ${MAGISKTMP}/.magisk/early-mount.d/libfoo.ko 58 | start myservice 59 | 60 | service myservice ${MAGISKTMP}/.magisk/early-mount.d/myscript.sh 61 | oneshot 62 | ``` 63 | 64 | ### 模块注入 65 | 66 | 自 Magisk Delta v26.0+ 使用 `early-mount.d/v2` 后,您也可以将 initrc.d 文件放到 `/data/adb/modules//early-mount/initrc.d` 中。 67 | 68 | ## 删除文件和文件夹 69 | 70 | 使用 Magisk 模块是修改系统分区的简便方法,无需对系统分区进行实际修改,而且修改非常容易。Magisk 模块可以替换或添加任何文件或文件夹到系统中。但仍不允许使用 Magisk 模块删除文件。 71 | 72 | 在 Magisk 文档中: 73 | 74 | > 实际删除文件很复杂(有可能,但不值得这么做)。用一个假文件替换它就足够了 75 | > 76 | > 要真正删除文件夹非常复杂(有可能,但不值得费力)。用一个空文件夹替换就足够了。将文件夹添加到模块模板中 "config.sh" 的替换列表中,它将用一个空文件夹替换该文件夹 77 | 78 | 在某些情况下,仅将文件或文件夹替换为空文件或文件夹是不够的,还可能导致问题,因为某些修改需要文件消失才能生效。因此,Magisk Delta 为模块添加了删除支持:在模块目录的相应位置创建指向 `/xxxxx` 的损坏的符号链接 79 | 80 | 以创建符号链接 `/data/adb/modules/mymodule_id/system/vendor/etc/thermal-engine-normal.conf` 为例,目标 `/vendor/etc/thermal-engine-normal.conf` 将被忽略并消失。 81 | 82 | ```bash 83 | ln -s "/xxxxx" /data/adb/modules/mymodule_id/system/vendor/etc/thermal-engine-normal.conf 84 | ``` 85 | 86 | ## 参考链接 87 | 88 | - [Magisk Delta Internal Documentation](https://huskydg.github.io/magisk-files/docs/internal-guide.html)(官方) 89 | -------------------------------------------------------------------------------- /delta/faq.md: -------------------------------------------------------------------------------- 1 | # 常见问题 2 | 3 | ## 如何安装 Magisk Delta? 4 | 5 | - 过程类似安装 Magisk: 6 | 7 | ## 如何从当前的 Magisk 切换到 Magisk Delta,反之亦然? 8 | 9 | 就像更新 Magisk 时一样! 10 | 11 | ### 直接安装(推荐) 12 | 13 | 1. 安装并打开 Magisk Delta,然后授予 root 访问权限。 14 | 2. 在**Magisk**部分,点击“安装”,然后点击“直接安装”。如果看不到,请尝试关闭并打开应用程序。 15 | 16 | ### 只需从当前的 Magisk 应用程序刷入 Magisk Delta 17 | 18 | 1. 将扩展名 `magisk.apk` 重命名为 `magisk.zip` 19 | 2. 打开 Magisk 应用程序,点击“模块”选项卡 -> “从存储安装”,然后选择 `magisk.zip` 20 | 21 | ### 将 Magisk 直接安装到 `/system`(不推荐) 22 | 23 | > 请仅在具有 SELinux 宽容模式的 ROM 上使用此方法,或在 sepolicy 规则中使用许可 "u:r:su:s0 "上下文执行 SELinux,如 LineageOS 等用户调试 ROM。你应该备份你的 ROM,以防系统无法启动,也不要使用已损坏的第三方 Recovery。你的 ROM 必须能够挂载为读写,内核必须支持动态 SeLinux 规则补丁。使用此方法风险自负! 24 | 25 | 由于某些原因,你不想用常规方法安装 Magisk(补丁启动映像),可以直接将 Magisk 安装到 `/system`。 26 | 27 | 1. 如果已安装 Magisk,则还原为默认启动映像 28 | 2. 启动到 recovery,将 `magisk.apk` 重命名为 `systemmagisk.zip` 并刷入。 29 | 3. 如果要更新 Magisk,请使用**直接安装到系统分区**,而不是**直接安装**。 30 | 31 | ## 如何将 Magisk 安装到 Android-x86 项目或 Android 模拟器中 32 | 33 | ### 开始之前 34 | 35 | 1. 只有 Magisk Delta 支持将 Magisk 安装到系统分区。 36 | 2. 虽然模拟器有 ramdisk 映像,但不使用修补 ramdisk,因为 ramdisk 存储在单独的分区中,磁盘空间非常小,不足以存储 Magisk 二进制文件。 37 | 3. 已采用最新的 Magisk Delta Canary 来支持 Bluestacks,~~但需要 [app_process wrapper](https://github.com/HuskyDG/app_process_wrapper/releases) 来运行 Zygisk.~~ 38 | 4. 已测试的模拟器列表: NoxPlayer、LDPlayer、MEmu。 39 | 5. 已测试的 Android x86 项目列表: BlissOS, PrimeOS 40 | 6. Waydroid 支持 Canary 版本。 41 | 42 | ### 将 Magisk 安装到 NoxPlayer、LDPlayer、MemuPlayer 等模拟器的步骤 43 | 44 | 1. 在模拟器设置中启用 Root 访问 45 | 2. 安装并打开 Magisk Delta 46 | 3. 授予 Magisk Delta root 访问权限,点击 Magisk 卡片下的 "安装",使用“直接安装到系统分区”选项,而不是“直接安装”选项(如果没有看到此选项,请关闭并重新打开 Magisk Delta 应用程序),现在不要重启! 47 | 4. ~~ 在模拟器设置中禁用 Root 访问。 ~~ 备份内置 `su` (`/system/bin/su` 和 `/system/xbin/su`)并删除它们(以防卸载 Magisk 后恢复内置 `su`),然后重启。由于 LDPlayer 等模拟器会在设置中禁用 ROOT 后删除所有`su`,因此**切勿**在模拟器设置中禁用 Root 访问。 48 | 5. 享受 Magisk! 49 | 50 | ### 将 Magisk 安装到 Bluestacks 的步骤 51 | 52 | 1. 从 [此处](https://bstweaker.tk/) 下载 Bluestacks Tweaker 53 | 2. 并单击“解锁”解锁 Bluestacks 实例,然后启动它,否则无法安装 Magisk。 54 | 3. 实例成功启动后,点击“补丁”打开 root 访问,安装 Magisk Delta 并执行“直接安装到系统分区”操作 55 | 4. 完成后,单击“UnPatch”,然后重新注册实例。 56 | 5. 享受 Magisk! 57 | 58 | ### 将 Magisk 安装到 Android-x86 项目的步骤 59 | 60 | - 你可以使用 [initrd-magisk](https://github.com/HuskyDG/initrd-magisk) 或按照上述指南直接将 Magisk 安装到系统分区中。 61 | 62 | ### 在 Waydroid 上安装 Magisk 的步骤 63 | 64 | - 详情请查阅 了解更多信息。 65 | 66 | ## 启用 MagiskHide 后,为什么我的应用程序/游戏仍能检测到模拟器? 67 | 68 | MagiskHide 不是模拟器检测绕过程序 69 | 70 | ## 如何在 Recovery 手动触发核心模式? 71 | 72 | 在以下位置创建名为 `.disable_magisk` 的空文件:`/cache`、`/persist` 或 `/metadata`。 73 | 74 | ## 为什么不恢复 Magisk 模块的在线 repo? 75 | 76 | Magisk 的官方模块库已经死亡,不再维护。因此,将它们添加回去毫无意义。不过,[Fox2Code](https://github.com/Fox2Code) 开发了 [Magisk 模块管理器](https://github.com/Fox2Code/FoxMagiskModuleManager) 应用程序,允许您在线下载 Magisk 模块。 77 | 78 | ## 我应该安装 Shxxxxo 模块来隐藏 root 吗? 79 | 80 | - 不建议使用,你应该卸载它。如果不这样做,就不要向我抱怨死机了。MagiskHide 就足够了。 81 | - 如果你真的想使用 Shxxxxo,那就卸载 Magisk Delta,使用官方 Magisk ¯\_(ツ)_/¯ 82 | 83 | ## 为什么启用 SuList 后某些模块会损坏? 84 | 85 | SuList 意味着 MagiskSU 和模块默认未加载,只有列表中的应用程序才会加载 Magisk,因此无法完全支持模块的功能,因为大多数模块必须在所有应用程序中加载,这相当于被检测到。有关 SuList 的更多信息,请[阅读](./internal-guide.html#magiskhide-sulist) 86 | 87 | ## 参考链接 88 | 89 | - [FAQ](https://huskydg.github.io/magisk-files/docs/faq.html)(官方) 90 | -------------------------------------------------------------------------------- /releases/19400.md: -------------------------------------------------------------------------------- 1 | # 2019.9.19 Magisk v19.4 2 | This version is heavily tested and tons of bugs were squashed before release. However due to the massive changes, it is decided to release a public beta for people/root app developers to adjust/update before things hit public stable. 3 | 4 | ## New System-as-root Implementation 5 | Magisk has supported system-as-root devices for a long time since the first Pixel came out. The goal is always to revert things back to the good old initramfs based root dir. However, this not only creates tons of issues on many devices, not easily hide-able with MagiskHide, but most importantly not even possible on Android 10. Starting with v19.4, Magisk will follow how Google has designed system-as-root: mounting system actually to `/` (root). 6 | 7 | This implies several **MASSIVE** consequences for system-as-root devices: 8 | - `/system` is no longer a valid mount point. For existing root apps that remounts `/system` to `rw`, you will have to remount `/` instead of `/system` 9 | - The root directory (`/`) is no longer `rootfs`, but actually system. Remounting `/` to `rw` and modify files means you are writing to the actual system partition, NOT volatile storage as it used to be in `rootfs`. This is not recommended as user is not necessary aware that you are tampering an actual partition, sometimes dangerous if dm-verity/AVB-verity is enforced, or sometimes outright impossible since many devices now ship with read-only system partitions (e.g. EROFS, EXT4 dedup) 10 | - Several custom kernel rely on Magisk's root directory overlay system (`overlay`) for modifying `/`. This is no longer compatible with the new implementation. A new overlay system (`overlay.d`) will replace the existing one as an alternative (details in [documentations](https://topjohnwu.github.io/Magisk/guides.html#root-directory-overlay-system)). To provide backwards compatibility, Magisk will switch to "Compat Mode" when `/overlay` is detected, which simply reverts to the old system-as-root setup. **Compat Mode will not work on Android 10 and will cause bootloop**. Although things will still work as it used to, **please upgrade to `overlay.d` ASAP**. 11 | 12 | ## Android 10 Support 13 | Other than A-only devices running Android 10, Android 10 is fully supported with MagiskHide fully functioning. Android 10's biggest challenge is the new "2-Stage-Init" system-as-root implementation, which is the sole reason why A-only is not support yet. Stay tuned for further updates as that is the next thing on the list. 14 | 15 | (For those interested in "2-Stage-Init" and other details of system-as-root, check [this Twitter thread I tweeted](https://twitter.com/topjohnwu/status/1174392824625676288)) 16 | 17 | ## Product Partition Support 18 | Magisk Module developers can now finally properly modify files in `/product`! This partition is now an essential part in Android 10, and many files are moved from system to product. Please check [documentations](https://topjohnwu.github.io/Magisk/details.html#magic-mount) for more details. 19 | 20 | ## A-Only System-as-root 21 | A huge number of new devices have A-only system-as-root setups (Android 9.0). These unfortunate devices will have to install Magisk into the recovery partition. Please check the fully updated [Installation Guide](https://topjohnwu.github.io/Magisk/install.html) for more details. 22 | 23 | **完整更新日志: [这里](/changes.html)** 24 | -------------------------------------------------------------------------------- /releases/19000.md: -------------------------------------------------------------------------------- 1 | # 2019.3.28 Magisk v19.0 2 | 3 | I would say this is one of my most ambitious release of all time! Due to the extremely massive changes, this release will be a public beta. Calling it v18.2 doesn't do it justice, so v19.0 we go. 4 | 5 | ## Magisk Module installer 6 | **Magisk module developers: pay extra attention!** A completely new [Magisk Module Installer](https://github.com/topjohnwu/magisk-module-installer) replaces the old Magisk module template. This new format decouples **ALL** installation logic from modules, and encourages developers to use the provided API for installation. This new format is **ENFORCED**, meaning all existing modules should upgrade ASAP, and new modules are **REQUIRED** to follow the rules. 7 | 8 | Carefully read through the [updated docs](https://topjohnwu.github.io/Magisk/guides.html)! 9 | 10 | **Warning: All existing modules that does not use the new module format will be automatically removed on May 1st, 2019. Module devs: upgrade your existing modules ASAP!** 11 | 12 | ## Imageless Magisk 13 | Since the existence of Magisk, all modules are stored within an EXT4 image which will be loop mounted at boot. This approach has a few problems: resizing the image is a huge headache (no live resizing, `resize2fs` on some devices refuse to work properly), and also MANY devices using F2FS ships a broken driver with the kernel, causing EXT4 loop devices unable to be mounted at all. All these problems come to an end now: modules are now directly stored in `/data`! Backwards compatibility is provided, for modules that uses the official module template, installation should work just fine. 14 | 15 | **Warning: Although module migration was tested, there are still chances that your modules will get lost in the process. Be prepared to reinstall your existing modules in that case.** 16 | 17 | ## Native 64 Bit is Back 18 | At one point in history, Magisk uses native 64 binaries. However due to binary size considerations, all binaries was switched to 32 bit. Starting from v19, all static binaries are still 32 bit only, but the most important part: the main `magisk` binary now runs in native 64 bit on supported devices. 19 | 20 | ## Zygote Ptrace Based MagiskHide 21 | MagiskHide used to use `logcat` to monitor activity manager events for new process creation. That method is extremely unreliable: even with constant improvements since introduction, it is still not working 100% of the time. Here comes a fundamentally new approach: ptrace the zygote process and step through all fork events. In layman's term, this new method is able to target a process before it even starts to run! The code for it is extremely tricky, but it was tested for quite a while in the canary channel, so I'm confident enough to release this to the public :) 22 | 23 | ## Android Q 24 | Full support for Android Q Beta 1 is also introduced in this release. However, you cannot use it on the Pixel 3 (XL) due to the fact that Google decided to use logical partitions on the 3rd gen Pixels starting with Q. A solution is still WIP, please stay tuned! 25 | 26 | ## Final Words 27 | What you can expect in upcoming releases: Samsung S10 support, and full logical partition support. Also, I *AM* aware of Google Pay issues, but these are not my main focus now since there are still tons of other issues for me to focus on. Several discussion threads on XDA provide seemingly working solutions, please do some research on your own. 28 | 29 | **完整更新日志: [这里](/changes.html)** 30 | -------------------------------------------------------------------------------- /details.md: -------------------------------------------------------------------------------- 1 | # 内部细节 2 | 3 | ## 文档结构 4 | 5 | ### “Magisk tmpfs 目录”中的路径 6 | 7 | Magisk 将安装一个 `tmpfs` 目录来存储一些临时数据。对于带有 `/sbin` 文件夹的设备,将选择该文件夹,因为它还将充当将二进制文件注入 `PATH` 的覆盖层。从 Android 11 开始,`/sbin` 文件夹可能不存在,因此 Magisk 将 `/debug_ramdisk` 其用作基本文件夹。 8 | 9 | ``` bash 10 | # 为了获得Magisk正在使用的当前基本文件夹,使用命令 `magisk--path`。 11 | # 二进制文件,如 magisk、magiskinit 和所有小程序的符号链接直接存储 12 | # 在此路径中。这意味着当这是/sbin,这些二进制文件将直接在 PATH 中。 13 | MAGISKTMP=$(magisk --path) 14 | 15 | # Magisk 内部材料 16 | INTERNALDIR=$MAGISKTMP/.magisk 17 | 18 | # /data/adb/modules 将挂载到此处。 19 | # 由于 nosuid 挂载标志,未使用原始文件夹。 20 | $INTERNALDIR/modules 21 | 22 | # 当前 Magisk 安装配置 23 | $INTERNALDIR/config 24 | 25 | # 分区映像 26 | # 此路径中的每个目录都将装载其目录名的分区。 27 | # 例如 system,system_ext,vendor,data ... 28 | $INTERNALDIR/mirror 29 | 30 | # 根目录修补程序文件 31 | # 在 system-as-root 的系统上,/不可写。 32 | # 所有预初始化补丁文件都存储在这里绑定挂载。 33 | $INTERNALDIR/rootdir 34 | ``` 35 | 36 | ### `/data` 中的路径 37 | 38 | 一些二进制文件和文件应存储在 `/data` 中的非易失性存储中。为了防止检测,所有东西都必须存储在 `/data` 中安全且不可检测的地方。选 `/data/adb` 文件夹是因为其具有以下优点: 39 | 40 | - 它是现代安卓系统上的一个现有文件夹,因此不能作为 Magisk 存在的标志。 41 | - 文件夹的权限默认为 `700`,所有者为 `root`,因此非 root 进程无法以任何可能的方式进入、读取和写入文件夹。 42 | - 文件夹 secontext 标记为 `u:object_r:adb_data_file:s0`,很少有进程有权与该 secontext 进行任何交互。 43 | - 该文件夹位于*设备加密存储区*中,因此一旦数据正确装载到 FBE(File-Based Encryption,基于文件的加密)设备中,即可访问该文件夹。 44 | 45 | ``` bash 46 | SECURE_DIR=/data/adb 47 | 48 | # 存储常规 post-fs-data 脚本的文件夹 49 | $SECURE_DIR/post-fs-data.d 50 | 51 | #存储常规 late_start 服务脚本的文件夹 52 | $SECURE_DIR/service.d 53 | 54 | # Magisk 模块 55 | $SECURE_DIR/modules 56 | 57 | # 等待升级的 Magisk 模块 58 | # 模块文件在挂载时无法安全修改 59 | # 通过 Magisk app 安装的模块将存储在此处并将在下次重新启动时 60 | # 合并到 $SECURE_DIR/modules 中 61 | $SECURE_DIR/modules_update 62 | 63 | # 数据库存储设置和 Root 权限 64 | MAGISKDB=$SECURE_DIR/magisk.db 65 | 66 | # 所有与 magisk 相关的二进制文件,包括 busybox、脚本 67 | # 和 magisk 二进制文件。用于支持模块安装、addon.d、 68 | # Magisk app 等。 69 | DATABIN=$SECURE_DIR/magisk 70 | 71 | ``` 72 | 73 | ## Magisk 启动过程 74 | 75 | ### 预初始化(Pre-Init) 76 | 77 | `magiskinit` 将替换 `init` 作为第一个运行的程序。 78 | 79 | - 挂载早期所需的分区。在已停产 system-as-root 设备上,我们将 root 切换到系统;在 2SI 设备上,我们修补原始的 `init` ,将第二阶段的 init 文件重定向到 magiskinit,并执行它为我们装载分区。 80 | - 将 magisk 服务注入 `init.rc` 81 | - 在使用 monolithic 策略的设备上,从 `/sepolicy` 加载 sepolicy ;否则我们使用 FIFO 劫持 selinuxfs 中的节点,将 `LD_PRELOAD` 设置为钩住 `security_load_policy`,并在 2SI 设备上协助劫持,然后启动守护程序,等待 init 尝试加载 sepolicy。 82 | - 修补 sepolicy 规则。如果我们使用“劫持”方法,将修补的 sepolicy 加载到内核中,取消阻止 init 并退出守护进程 83 | - 执行原始的 `init` 以继续启动过程 84 | 85 | ### 解密后(post-fs-data) 86 | 87 | 当 `/data` 被解密和装载时会在 `post-fs-data` 上触发。守护程序 `magiskd` 将被启动,执行 post-fs-data 脚本,并神奇地安装模块文件。 88 | 89 | ### 后期启动(late_start) 90 | 91 | 在稍后的引导过程中,将触发类 `late_start` ,并启动 Magisk “服务”模式。在此模式下,执行服务(service)脚本。 92 | 93 | ## 重置属性(Resetprop) 94 | 95 | 通常,系统属性(properties)被设计为仅由 `init` 更新,并且对非 root 进程是只读的。使用 root,您可以通过使用诸如 `setprop` 之类的命令向 `property_service`(由 `init` 托管)发送请求来更改属性,但仍然禁止更改只读属性(以`ro.`开头的属性,如`ro.build.product`)和删除属性。 96 | 97 | `resetprop` 是通过从 AOSP 中提取出与系统属性相关的源代码来实现的,并进行了修补,以允许直接修改属性区域或 `prop_area`,而无需通过 `property_service` 。由于我们绕过了 `property_service` ,因此需要注意一些: 98 | 99 | - 如果属性更改未通过 `property_service` ,则不会触发在 `*.rc` 脚本中注册的`on property:foo=bar` 操作。`resetprop` 的默认设置属性行为与 `setprop` 匹配,**这将触发事件**(通过首先删除属性,然后通过 `property_service` 设置它来实现)。如果您需要此特殊行为,则有一个标志 `-n` 可以禁用它。 100 | - 持久属性(以 `persist.` 开头的属性,如 `persist.sys.usb.config` )存储在 `prop_area` 和 `/data/property` 中。默认情况下,删除属性不会将其从持久存储中删除,这意味着该属性将在下次重新启动后恢复;读取属性不会从持久存储中读取,因为这是 `getprop` 的行为。使用标志 `-p` ,删除属性将同时删除 `prop_area` 和 `/data/property` 中的属性,读取属性将从 `prop_area` 和持久存储中读取。 101 | 102 | ## SELinux 政策 103 | 104 | Magisk 将修补现成的 `sepolicy` ,以确保 Root 和 Magisk 操作能够以安全可靠的方式完成。新域 `magisk` 是有效的,这就是 `magiskd` 和所有 root shell 将在其中运行的内容。`magisk_file` 是一种新的文件类型,设置为允许每个域(不受限制的文件上下文)访问。 105 | 106 | 在 Android 8.0 之前,所有允许的 su 客户端域都可以直接连接到 `magiskd` 并与守护进程建立连接,以获得远程 root shell。Magisk 还必须放宽一些 `ioctl` 操作,以便 root shell 能够正常运行。 107 | 108 | 在 Android 8.0 之后,为了减少 Android 沙盒中规则的放宽,部署了新的 SELinux 模型。 `magisk` 二进制文件标记为 `magisk_exec` 文件类型,并且执行 `magisk` 二进制文件(包括 `su` 命令)的 su 客户端域将通过使用 `type_transition` 规则传输到 `magisk_client` 。规则严格限制仅允许 `magisk` 域进程将文件归因于 `magisk_exec` 。不允许直接连接到 `magiskd` 的 sockets;访问守护进程的唯一方法是通过 `magisk_client` 进程。这些更改使我们能够保持沙盒完好无损,并将 Magisk 特定规则与其他策略分开。 109 | 110 | 完整的规则可以在 `sepolicy/rules.cpp` 中找到。 111 | 112 | ## 参考链接 113 | 114 | - [Magisk Internal Details](https://topjohnwu.github.io/Magisk/details.html)(官方) 115 | - [Magisk 内部细节](https://e7kmbb.github.io/Magisk/details.html) 116 | -------------------------------------------------------------------------------- /boot.md: -------------------------------------------------------------------------------- 1 | # Android 引导诡计 2 | 3 | ## 术语 4 | 5 | - **rootdir**:根目录 (`/`)。所有 文件、文件夹或文件系统 都存储在 rootdir 中或挂载在 rootdir 下。在 Android 上,文件系统可以是 `rootfs` 或 `system` 分区。 6 | - **`initramfs`**:Android 启动映像中的一个部分,Linux 内核将使用它作为`rootfs`。人们也可以使用术语 **ramdisk** 7 | - **`recovery` 和 `boot` 分区**:这两个实际上非常相似:都是包含 ramdisk 和 Linux 内核的 Android 启动映像(加上其他一些东西)。 8 | 唯一的区别是,启动 `boot` 分区将把我们带到 Android,而 `recovery` 有一个用于修复和升级设备的极简自带 Linux 环境。 9 | - **SAR**:系统作为根(System-as-root)。也就是说,设备使用 `system` 作为 rootdir,而不是 `rootfs` 10 | - **A/B, A-only**:对于支持[无缝系统更新](https://source.android.google.cn/docs/core/ota/ab)的设备,它将具有所有只读分区的2个插槽(partition);我们称这些为**A/B设备**。为了区分,非A/B设备将称为**A-only** 11 | - **2SI**:两阶段初始化。Android 10+ 的启动方式。稍后提供更多信息。 12 | 13 | 以下是一些参数,可帮助您更精确地定义设备的 Android 版本: 14 | 15 | - **LV**:推出版本。设备**推出时**使用的安卓版本。也就是说,设备首次上市时预装的 Android 版本。 16 | - **RV**:运行版本。设备当前运行的 Android 版本。 17 | 18 | 我们将使用 **Android API 级别** 来表示 LV 和 RV 。API 级别和 Android 版本之间的映射可以在[这张表格](https://source.android.google.cn/setup/start/build-numbers#platform-code-names-versions-api-levels-and-ndk-releases)中看到。例如:Pixel XL 随 Android 7.1 发布,并运行 Android 10,这些参数将为 `(LV = 25, RV = 29)` 。 19 | 20 | ## 引导方法 21 | 22 | Android 启动可以大致分为 3 种主要的不同方法。我们提供了一个一般的经验法则,以确定您的设备最有可能使用哪种方法,但例外情况单独列出。 23 | 24 | | 方法 | 初始根目录 | 最终根目录 | 25 | | :---: | ---------- | ---------- | 26 | | **A** | `rootfs` | `rootfs` | 27 | | **B** | `system` | `system` | 28 | | **C** | `rootfs` | `system` | 29 | 30 | - **方法 A - 传统 ramdisk**:这是*所有* Android 设备过去启动的方式(过去的美好时光)。内核使用 `initramfs` 作为 rootdir,exec `/init` 来引导。 31 | - 不属于方法 B 和 C 标准中的设备 32 | - **方法 B - 传统 SAR**:此方法首次出现在 Pixel 1 上。内核直接挂载 `system` 分区作为 rootdir 并且 exec `/init` 来引导。 33 | - 具有 `(LV = 28)` 的设备 34 | - 谷歌:Pixel 1 和 2。Pixel3 和 3a 为 `(RV = 28)` 时 35 | - 一加:6 - 7 36 | - 也许一些 `(LV < 29)` Android Go 设备? 37 | - **方法 C - 2SI ramdisk SAR**:此方法首次出现在 Pixel 3 Android 10 开发者预览版中。内核使用 `initramfs` 作为 rootdir,在 `rootfs` 中使用 exec `/init`。这个 `init` 负责挂载 `system` 分区并将其用作新的 rootdir,最后执行 `/system/bin/init` 来引导。 38 | - 具有 `(LV >= 29)` 的设备 39 | - 具有 `(LV < 28, RV >= 29)` 的设备,不包括已在使用方法 B 的设备 40 | - 谷歌:Pixel 3 和 3a 为 `(RV >= 29)` 时 41 | 42 | ### 讨论 43 | 44 | 从文档来看,谷歌对 SAR 的定义只考虑了内核如何引导设备(上表中的**初始根目录**),这意味着从谷歌的角度来看,只有使用**方法B**的设备才被正式视为 SAR 设备。 45 | 46 | 然而,对于 Magisk 来说,真正的区别在于设备在完全启动时使用的是什么(上表中的**最终根目录**),这意味着**就 Magisk 而言,方法 B 和方法 C 都是 SAR 的一种形式**,但实施方式不同。除非另有特别说明,否则本文件后面提到的每一个 SAR 实例都将参考 **Magisk 的定义**。 47 | 48 | 通俗地说,方法 C 的标准有点复杂:您的设备足够现代,可以使用 Android 10+ 启动,或者您在使用方法 A 的设备上运行 Android 10+ 第三方 ROM。 49 | 50 | - 任何运行 Android 10+ 的设备都将自动使用方法 C 51 | - **方法 B 设备卡在方法 B 上**,唯一的例外是 Pixel 3 和 3a,Google 对设备进行了改造以适应新方法。 52 | 53 | SAR 是 [Project Treble](https://source.android.google.cn/devices/architecture#hidl) 中非常重要的一部分,因为 rootdir 应该与平台绑定。这也是方法 B 和 C 带有 `(LV >= ver)` 标准的原因,因为谷歌每年都强制所有 OEM 遵守更新的要求。 54 | 55 | ## 一些历史 56 | 57 | 当谷歌发布第一代 Pixel 时,它还推出了 [A/B(无缝)系统更新](https://source.android.google.cn/devices/tech/ota/ab)。由于[存储大小问题](https://source.android.google.cn/devices/tech/ota/ab/ab_faqs),与仅 A 相比有几个区别,最相关的是删除 `recovery` 分区和 recovery ramdisk ,合并到`boot`中。 58 | 59 | 让我们回到 Google 第一次设计 A/B 的时候。如果使用 SAR(当时只有引导方法 B 存在),内核不需要 `initramfs` 来引导 Android(因为 rootdir 在 `system` 中)。这意味着我们可以很聪明,只需将 recovery ramdisk(包含极简的 Linux 环境)塞入 `boot` ,删除 `recovery` ,然后让内核根据引导加载程序的信息选择要使用的任何根目录(ramdisk 或 `system`)。 60 | 61 | 随着时间从 Android 7.1 到 Android 10 的流逝,谷歌推出了[动态分区](https://source.android.google.cn/devices/tech/ota/dynamic_partitions/implement)。这对 SAR 来说是个坏消息,因为 Linux 内核无法直接理解这种新的分区格式,因此无法直接将 `system` 挂载为 rootdir。这是他们想出引导方法 C 的时候:总是引导到 `initramfs` ,并让 userspace 处理其余的引导。这包括决定启动到 Android 或 recovery,或者他们正式称之为 `USES_RECOVERY_AS_BOOT` 。 62 | 63 | 一些使用带有 2SI 的 A/B 的现代设备还带有 `recovery_a/_b` 分区。谷歌的标准正式支持这一点。当 recovery 存储在单独的分区中时,这些设备将只使用 boot ramdisk 引导到 Android。 64 | 65 | ## 将这些拼凑在一起 66 | 67 | 有了上面的所有知识,现在我们可以将所有 Android 设备分类为以下不同类型: 68 | 69 | | 类型 | 引导方式 | 分区 | 2SI | 在 `boot` 里的 ramdisk | 70 | | :-----: | :------: | :----: | :---: | :--------------------: | 71 | | **I** | A | A-only | No | `boot` ramdisk | 72 | | **II** | B | A/B | Any | `recovery` ramdisk | 73 | | **III** | B | A-only | Any | ***N/A*** | 74 | | **IV** | C | Any | Yes | 混合 ramdisk | 75 | 76 | 这些类型按首次可用时的时间顺序排序。 77 | 78 | - **I 类**:好的旧传统 ramdisk 引导 79 | - **II 类**:旧版 A/B 设备。Pixel 1 是这种类型的第一个设备,同时也是第一个 A/B 和 SAR 设备。 80 | - **III 类**:2018 年末 - 2019 年 A-only 的设备。**就 Magisk 而言,这是迄今为止最糟糕的一种设备类型** 81 | - **IV 类**:所有使用引导方法 C 的设备都是 IV 型设备。A/B IV 类 ramdisk 可以根据引导加载程序的信息启动到 Android 或 recovery;A-only IV 类 ramdisk 只能引导到 Android。 82 | 83 | 关于 III 类设备的更多详细信息:Magisk 始终安装在引导映像的 ramdisk 中。对于所有其他类型的设备,由于其 `boot` 分区包含 ramdisk,因此可以通过 Magisk app 或第三方 recovery 中的刷入 ZIP 修补引导映像来轻松安装 Magisk。然而,对于 III 型设备,它们**仅限于将 Magisk 安装到 `recovery` 分区**中。Magisk 在正常启动时无法运行;相反,III 类设备用户必须始终重新启动到 recovery,以保持 Magisk 访问。 84 | 85 | 一些 III 类设备的引导加载程序仍然会接受并提供手动添加到内核 `boot` 映像中的 `initramfs`(例如一些小米手机),但许多设备不接受(例如三星 S10,Note 10)。这完全取决于 OEM 如何实现其引导加载程序。 86 | 87 | ## 参考链接 88 | 89 | - [Magisk Android Booting Shenanigans](https://topjohnwu.github.io/Magisk/boot.html)(官方) 90 | -------------------------------------------------------------------------------- /delta/main.md: -------------------------------------------------------------------------------- 1 | # 狐妖面具(Kitsune Mask) 2 | 3 | ![Delta](https://user-images.githubusercontent.com/84650617/222942594-63336f63-6a26-492e-a1d1-a356b5f777b3.png) 4 | 5 | ## 介绍 6 | 7 | **这不是官方支持的 [topjohnwu](https://github.com/topjohnwu) 项目。** 8 | 9 | ::: tip 10 | 这不是官方 Magisk,请[转到此页面下载官方 Magisk](https://github.com/topjohnwu/Magisk) 11 | ::: 12 | 13 | ## 下载 14 | 15 | ### 稳定版 / Beta 16 | 17 | - [26.4 Stable](https://github.com/HuskyDG/download/raw/main/magisk/26.4-kitsune.apk) 18 | 19 | ### Canary / Debug 20 | 21 | > 如有任何问题,请联系 。只接受来自**最新 DEBUG** 版本的错误报告 22 | 23 | - [Canary (app-release.apk)](https://huskydg.github.io/magisk-files/app-release.apk) 24 | - [Debug (app-debug.apk)](https://huskydg.github.io/magisk-files/app-debug.apk) 25 | - [源代码](https://github.com/HuskyDG/magisk) 26 | - [更新日志](./note.md) 27 | 28 | ### 其他版本 29 | 30 | - [发行页面](https://github.com/HuskyDG/magisk-files/releases) 31 | 32 | ## 如何安装 33 | 34 | ### 如何从头开始安装 Kitsune Mask? 35 | 36 | 与安装 Magisk 的过程相似: 37 | 38 | ### 如何从当前的 Magisk 切换到 Kitsune Mask,反之亦然? 39 | 40 | 很简单,就像更新 Magisk 时一样! 41 | 42 | #### 直接安装(推荐) 43 | 44 | 1. 安装、打开并授予 Kitsune Mask root 权限。 45 | 2. 在 **Magisk** 中,点击“安装”,然后点击“直接安装”。如果看不到,请尝试重启应用程序。 46 | 47 | #### 或从当前的 Magisk 应用程序中刷入 Kitsune Mask 48 | 49 | 1. 将扩展名 `magisk.apk` 重命名为 `magisk.zip` 50 | 2. 打开 Magisk 应用程序,点击“模块”选项 -> “从存储安装”,然后选择 `magisk.zip` 51 | 52 | #### 直接将 Magisk 安装到 `/system`,而不是修补启动映像(不推荐) 53 | 54 | 此方法仅适用于具有宽松的 SELinux 模式或强制 SELinux 的 ROM,其中在 sepolicy 规则中有允许的“u:r:su:s0”上下文,例如 LineageOS 等 user-debug 的 ROM。请确保您有 ROM 的备份和可用的自定义Recovery。您的 ROM 和内核必须支持读写挂载和动态 SELinux 规则修补。此方法可能会导致启动失败,因此请自行承担风险! 55 | 56 | 1. 如果已安装 Magisk,请还原启动镜像。 57 | 2. 重启到 recovery,将 `magisk.apk` 重命名为 `systemmagisk.zip`,然后刷入。 58 | 3. 要更新 Magisk,请使用**直接安装到系统分区**而不是**直接安装**。 59 | 60 | ### 如何将 Magisk 安装到安卓模拟器中 61 | 62 | 由于 ramdisk 分区没有足够空间容纳 Magisk 二进制文件,因此模拟器无法为 ramdisk 添加补丁。已对以下模拟器和 Android-x86 项目进行了测试:NoxPlayer、LDPlayer、MEmu、BlissOS 和 PrimeOS。 63 | 64 | #### 将 Magisk 安装到 NoxPlayer、LDPlayer、MemuPlayer 等模拟器的步骤 65 | 66 | 1. 在模拟器设置中启用 Root 访问。 67 | 2. 安装并打开 Kitsune Mask。 68 | 3. Grant root access to Kitsune Mask, click "Install" under the Magisk field, and use "Direct Install into system partition" option instead of "Direct Install" option. (If you don't see this option, close and re-open Kitsune Mask app.) Don't restart now! 69 | 4. Backup built-in `su` (`/system/bin/su` and `/system/xbin/su`) and delete them (in case you want to uninstall Magisk and restore to built-in `su`), then reboot. Because emulators like LDPlayer will remove any `su` after disabling ROOT from settings, **DO NOT** disable Root access in emulator settings. 70 | 5. Enjoy Magisk! 71 | 72 | #### 在 Bluestacks 上安装 Magisk 的步骤 73 | 74 | 1. Download Bluestacks Tweaker [here](https://bstweaker.ru). 75 | 2. Use Bluestacks Tweaker and click "Unlock" to unlock Bluestacks instance, and then launch it. Otherwise, you can't install Magisk. 76 | 3. When the instance starts up successfully, click "Patch" to open root access, install Kitsune Mask, and execute the "Direct Install into system partition" action. 77 | 4. When you are done, click "UnPatch" and then restart the instance. 78 | 5. Enjoy Magisk! 79 | 80 | ## 捐赠我 81 | 82 | - Paypal: [paypal.me/huskydg](http://paypal.me/huskydg) 83 | - 感谢您的支持,祝您有美好的一天!👍 84 | 85 | ## Credits 86 | 87 | - Magisk 作者:[topjohnwu](https://github.com/topjohnwu/magisk) 88 | - Magisk 贡献者:[vvb2060](https://github.com/vvb2060), [yujincheng08](https://github.com/yujincheng08), [RikkaW](https://github.com/RikkaW), [canyie](https://github.com/canyie) 89 | - ptrace 实现的 Zygisk:[ZygiskNext](https://github.com/Dr-TSNG/ZygiskNext), [Dr-TSNG](https://github.com/Dr-TSNG/ZygiskNext) and [5ec1cff](https://github.com/5ec1cff) 90 | 91 | ## 许可 92 | 93 | 我们的许可证与 [Magisk 的许可证](https://github.com/topjohnwu/Magisk#License) 相同 94 | 95 | ::: warning 96 | 中文汉化版许可仅供参考,**请以英文原版为准!** 97 | ::: 98 | 99 | ::: code-group 100 | 101 | ``` txt [中文汉化 ] 102 | Magisk,包括所有 git 子模块都是自由软件: 103 | 您可以根据自由软件基金会发布的 GNU 通用公共许可证的条款(许可证的第3版, 104 | 或(根据您的选择)任何更高版本重新分发和/或修改它。 105 | 106 | 分发此程序是希望它有用,但没有任何保证;甚至没有适销性或特定用途适用性 107 | 的隐含保证。有关详细信息,请参阅 GNU 通用公共许可证。 108 | 109 | 你应该已经收到了GNU通用公共许可证的副本以及这个程序。如果没有,请参见 110 | 。 111 | ``` 112 | 113 | ``` txt [英文原版] 114 | Magisk, including all git submodules are free software: 115 | you can redistribute it and/or modify it under the terms of the 116 | GNU General Public License as published by the Free Software Foundation, 117 | either version 3 of the License, or (at your option) any later version. 118 | 119 | This program is distributed in the hope that it will be useful, 120 | but WITHOUT ANY WARRANTY; without even the implied warranty of 121 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 122 | GNU General Public License for more details. 123 | 124 | You should have received a copy of the GNU General Public License 125 | along with this program. If not, see . 126 | ``` 127 | 128 | ::: 129 | 130 | ## 参考链接 131 | 132 | - [Kitsune Mask](https://huskydg.github.io/magisk-files/main.html)(官方) 133 | -------------------------------------------------------------------------------- /.vitepress/config.ts: -------------------------------------------------------------------------------- 1 | import fs from 'fs' 2 | import { DefaultTheme, defineConfigWithTheme } from 'vitepress' 3 | import { OriginDocumentConfig, ThemeConfig } from './theme/ts/theme.interfaces' 4 | 5 | const MATCH_RELEASE_REG = /- \[(v[\d.]*)\]\((\d*).md\)/g 6 | 7 | function getCommitHtmlLink(config: OriginDocumentConfig): string { 8 | return `${config.commit}` 9 | } 10 | 11 | const base = '/MagiskChineseDocument/' 12 | 13 | const releaseItems: (DefaultTheme.NavItemChildren | DefaultTheme.NavItemWithLink)[] = [] 14 | 15 | const NORMAL_LINKS: DefaultTheme.NavItem[] | DefaultTheme.SidebarItem[] = [ 16 | { 17 | text: '面向普通用户', 18 | // collapsed: false, 19 | items: [ 20 | { text: '安装说明', link: '/install.html' }, 21 | { text: '常见问题', link: '/faq.html' }, 22 | { 23 | text: '发布日志', 24 | link: '/releases/', 25 | items: releaseItems, 26 | collapsed: true, 27 | }, 28 | { text: 'Magisk 更新日志', link: '/changes.html' }, 29 | ], 30 | }, 31 | ] 32 | const DEVELOPER_LINKS: DefaultTheme.NavItem[] | DefaultTheme.SidebarItem[] = [ 33 | { 34 | text: '面向开发人员', 35 | // collapsed: false, 36 | items: [ 37 | { text: '构建和开发 Magisk', link: '/build.html' }, 38 | { text: '开发者指南', link: '/guides.html' }, 39 | { text: 'Magisk 工具', link: '/tools.html' }, 40 | { text: '内部细节', link: '/details.html' }, 41 | { text: 'Android 引导诡计', link: '/boot.html' }, 42 | ], 43 | }, 44 | ] 45 | 46 | const DELTA_LINK: DefaultTheme.NavItem[] = [ 47 | { 48 | text: 'Magisk Delta', 49 | // collapsed: false, 50 | link: '/delta/', 51 | activeMatch: '/delta/', 52 | }, 53 | ] 54 | 55 | const DELTA_LINKS: DefaultTheme.SidebarItem[] = [ 56 | { 57 | text: 'Magisk Delta', 58 | items: [ 59 | { text: '主页', link: '/delta/main.html' }, 60 | { text: '日志', link: '/delta/note.html' }, 61 | ], 62 | }, 63 | { 64 | text: '已废弃', 65 | collapsed: true, 66 | items: [ 67 | { text: '常见问题', link: '/delta/faq.html' }, 68 | { text: '内部文档', link: '/delta/internal-guide.html' }, 69 | ], 70 | }, 71 | ] 72 | 73 | const sidebar: DefaultTheme.Sidebar = { 74 | '/delta/': DELTA_LINKS, 75 | } 76 | 77 | let allItems: DefaultTheme.NavItem[] | DefaultTheme.SidebarItem[] = [...NORMAL_LINKS, ...DEVELOPER_LINKS] 78 | // 生成侧边栏 79 | for (let group of allItems) { 80 | if (group.items) { 81 | for (let item of group.items) { 82 | if (item.link) { 83 | sidebar[item.link.replace('.html', '')] = [group] 84 | } 85 | } 86 | } 87 | } 88 | 89 | // 匹配版本号 90 | const releaseFileContent = fs.readFileSync('./releases/index.md', 'utf8') 91 | for (const iterator of releaseFileContent.matchAll(MATCH_RELEASE_REG)) { 92 | const verName = iterator[1] 93 | const verCode = iterator[2] 94 | releaseItems.push({ 95 | text: verName, 96 | link: `/releases/${verCode}.html`, 97 | }) 98 | } 99 | 100 | const originDocument: Record = { 101 | magisk: { 102 | date: '2024-03-07', 103 | commit: '2b5fc75', 104 | url: 'https://github.com/topjohnwu/Magisk', 105 | }, 106 | delta: { 107 | date: '2023-12-22', 108 | commit: '927d965', 109 | url: 'https://github.com/HuskyDG/magisk-files', 110 | }, 111 | } 112 | 113 | export default defineConfigWithTheme({ 114 | lang: 'zh-CN', 115 | title: 'Magisk 中文文档', 116 | description: 'Magisk 中文文档,由 Jesse205 手动机翻。', 117 | base, 118 | ignoreDeadLinks: true, 119 | lastUpdated: true, 120 | head: [ 121 | ['link', { rel: 'icon', href: `${base}favicon.ico`, sizes: 'any' }], 122 | ['link', { rel: 'apple-touch-icon', href: `${base}apple-touch-icon.png` }], 123 | ], 124 | themeConfig: { 125 | logo: '/favicon.ico', 126 | outlineTitle: '本页内容', 127 | lastUpdatedText: '更新时间', 128 | darkModeSwitchLabel: '深色模式', 129 | sidebarMenuLabel: '菜单', 130 | returnToTopLabel: '回到顶部', 131 | docFooter: { 132 | prev: '上一篇', 133 | next: '下一篇', 134 | }, 135 | outline: [2, 3], 136 | socialLinks: [ 137 | { 138 | icon: { 139 | svg: '', 140 | }, 141 | link: 'https://gitee.com/Jesse205/magisk-chinese-document', 142 | }, 143 | { 144 | icon: 'github', 145 | link: 'https://github.com/Jesse205/MagiskChineseDocument', 146 | }, 147 | ], 148 | nav: [ 149 | ...NORMAL_LINKS, 150 | ...DEVELOPER_LINKS, 151 | ...DELTA_LINK, 152 | { text: '官方文档', link: 'https://topjohnwu.github.io/Magisk/' }, 153 | ] as DefaultTheme.NavItem[], 154 | sidebar, 155 | footer: { 156 | message: ` 157 | 158 | 原始 Magisk 文档版本: ${originDocument.magisk.date} ${getCommitHtmlLink(originDocument.magisk)}
159 | 原始 Magisk Delta 文档版本: ${originDocument.delta.date} ${getCommitHtmlLink(originDocument.delta)}
160 | 在 GPL-3.0 许可下发布 161 |
162 |
163 | `, 164 | }, 165 | editLink: { 166 | pattern: 'https://gitee.com/Jesse205/magisk-chinese-document/edit/master/:path', 167 | text: '在 Gitee 上编辑此页面', 168 | }, 169 | search: { 170 | provider: 'local', 171 | options: { 172 | translations: { 173 | button: { 174 | buttonText: '搜索', 175 | }, 176 | modal: { 177 | displayDetails: '显示详情信息', 178 | resetButtonTitle: '清空内容', 179 | backButtonTitle: '关闭搜索', 180 | noResultsText: '未找到', 181 | footer: { 182 | selectText: '选择', 183 | selectKeyAriaLabel: '进入', 184 | navigateText: '导航', 185 | navigateUpKeyAriaLabel: '向上', 186 | navigateDownKeyAriaLabel: '向下', 187 | closeText: '关闭', 188 | closeKeyAriaLabel: '退出', 189 | }, 190 | }, 191 | }, 192 | }, 193 | }, 194 | externalLinkIcon: true, 195 | originDocument, 196 | }, 197 | }) 198 | -------------------------------------------------------------------------------- /tools.md: -------------------------------------------------------------------------------- 1 | # Magisk 工具 2 | 3 | Magisk 为开发人员提供了大量安装工具、守护程序和实用程序。本文档涵盖了4个二进制文件和所有包含的小程序。二进制文件和小程序如下所示: 4 | 5 | ``` txt 6 | magiskboot /* binary */ 7 | magiskinit /* binary */ 8 | magiskpolicy /* binary */ 9 | supolicy -> magiskpolicy 10 | magisk /* binary */ 11 | resetprop -> magisk 12 | su -> magisk 13 | ``` 14 | 15 | ## magiskboot 16 | 17 | 一个用于解压缩/重新打包 boot 映像、解析/修补/解压缩 cpio 、修补 dtb 、十六进制修补二进制文件,以及使用多种算法压缩/解压缩文件的工具。 18 | 19 | `magiskboot` 支持常见的压缩格式(这意味着它不依赖于外部工具),包括 `gzip`、`lz4`、`lz4_legacy`([仅在LG上使用](https://events.static.linuxfound.org/sites/events/files/lcjpcojp13_klee.pdf))、`lzma`、`xz` 和 `bzip2`。 20 | 21 | `magiskboot` 的概念是使 boot 映像修改更简单。对于解包,它解析标头并提取映像中的所有部分,如果在任何部分中检测到压缩,则会立即解压缩。对于重新打包,需要原始 boot 映像,以便可以使用原始标头,只需更改必要的内容,如节大小和校验和。如果需要,所有部分将被压缩回原始格式。该工具还支持许多 CPIO 和 DTB 操作。 22 | 23 | ``` bash 24 | 用法: ./magiskboot <操作> [参数...] 25 | 26 | 支持的操作: 27 | unpack [-n] [-h] 28 | 将 解压缩到其各个组件,每个组件到一个文件,并在当前目录中具有相 29 | 应的文件名。 30 | 支持的组件:kernel、kernel_dtb、ramdisk.cpio、second、dtb、extra 和 31 | recovery_dtbo。 32 | 默认情况下,每个组件将在写入输出文件之前即时自动解压缩。 33 | 如果提供“-n”,则将跳过所有解压缩操作;每个组件将保持不变,以原始格式转储。 34 | 如果提供了“-h”,则启动映像标头信息将转储到文件“header”,该文件可用于 35 | 在重新打包期间修改标头配置。 36 | 37 | 返回值: 38 | 0:valid 1:error 2:chromeos 39 | 40 | repack [-n] <原始bootimg> [输出bootimg] 41 | 使用当前目录中的文件将启动映像组件重新打包到 [输出bootimg],如果未指 42 | 定,则为“new-boot.img”。 43 | <原始bootimg> 是用于解压缩组件的原始启动映像。 44 | 默认情况下,每个组件将使用 <原始bootimg> 中检测到的相应格式自动压缩。如 45 | 果当前目录中的组件文件已被压缩,则不会对该特定组件执行任何附加压缩。 46 | 如果提供“-n”,则将跳过所有压缩操作。 47 | 如果 env 变量 PATCHVBMETAFLAG 设置为 true,则将设置启动映像的 vbmeta 48 | header 中的所有禁用标志。 49 | 50 | hexpatch <文件> 51 | 在 <文件> 中搜索 ,并将其替换为 52 | 53 | cpio [命令...] 54 | 对 执行 cpio 命令(修改已到位) 55 | 每个命令都是一个参数,请为每个命令添加引号。 56 | 支持的命令: 57 | exists ENTRY 58 | 如果 ENTRY 存在,则返回 0,否则返回 1 59 | rm [-r] ENTRY 60 | 删除 ENTRY,指定 [-r] 以递归删除 61 | mkdir MODE ENTRY 62 | 在 MODE 权限下创建目录 ENTRY 63 | ln TARGET ENTRY 64 | 使用名称 ENTRY 创建指向 TARGET 的符号链接 65 | mv SOURCE DEST 66 | 将 SOURCE 移动到 DEST 67 | add MODE ENTRY INFILE 68 | 在 MODE 权限中添加 INFILE 作为 ENTRY;替换 ENTRY(如果存在) 69 | extract [ENTRY OUT] 70 | 将 ENTRY 解压到 OUT,或将所有条目解压到当前目录 71 | test 72 | 测试 cpio 的状态 73 | 返回值为0或或运算以下值: 74 | 0x1:Magisk 0x2:unsupported 75 | patch 76 | 应用 ramdisk 补丁 77 | 用 env 变量进行配置:KEEPVERITY KEEPFORCEENCRYPT 78 | backup ORIG 79 | 从 ORIG 创建 ramdisk 备份 80 | restore 81 | 从 incpio 中存储的 ramdisk 备份恢复 ramdisk 82 | sha1 83 | 如果以前已在 ramdisk 中备份,则输出原始引导SHA1 84 | 85 | dtb <文件> <操作> [参数...] 86 | 对 <文件> 执行与 dtb 相关的操作 87 | 支持的操作: 88 | print [-f] 89 | 打印 dtb 的所有内容以进行调试 90 | 指定 [-f] 以仅打印 fstab 节点 91 | patch 92 | 搜索 fstab 并删除 verity/avb 93 | 直接对文件进行修改 94 | 使用 env 变量进行配置:KEEPVERITY 95 | test 96 | 测试 fstab 的状态 97 | 返回值: 98 | 0:valid 1:error 99 | 100 | split <文件> 101 | 将 image.*-dtb 拆分为 kernel + kernel_dtb 102 | 103 | sha1 <文件> 104 | 出 <文件> 的 SHA1 校验和 105 | 106 | cleanup 107 | 清理当前工作目录 108 | 109 | compress[=格式] <输入文件> [输出文件] 110 | 使用 [格式] 将 <输入文件> 压缩为 [输出文件]。 111 | 可以是“-”,以作为 STDIN/STDOUT。 112 | 如果未指定 [格式],则将使用 gzip。 113 | 如果未指定 [输出文件],则 <输入文件> 将被替换为 114 | 后缀为匹配文件扩展名的另一个文件。 115 | 支持格式: gzip zopfli xz lzma bzip2 lz4 lz4_legacy lz4_lg 116 | 117 | decompress <输入文件> [输出文件] 118 | 检测格式并将 <输入文件> 解压缩到 [输出文件]。 119 | <输入文件>/[输出文件] 可以是“-”,以作为 STDIN/STDOUT。 120 | 如果未指定 [输出文件],则 <输入文件> 将替换为另一个文件, 121 | 删除其文件格式文件扩展名。 122 | 支持格式: gzip zopfli xz lzma bzip2 lz4 lz4_legacy lz4_lg 123 | ``` 124 | 125 | ## magiskinit 126 | 127 | 这个二进制文件将替换 Magisk 补丁启动映像的 ramdisk 中的 `init`。它最初是为支持以 system-as-root 的设备而创建的,但该工具被扩展为支持所有设备,并成为 Magisk 的关键部分。更多详细信息可以在 [Magisk 启动过程](details.md#magisk-启动过程) 中的 **预初始化(Pre-Init)** 部分找到。 128 | 129 | ## magiskpolicy 130 | 131 | (此工具别名为 `supolicy`,以与 SuperSU 的 sepolicy 工具兼容) 132 | 133 | 高级开发人员可以使用此工具修改 SELinux 策略。在像 Linux 服务器管理员这样的常见场景中,他们会直接修改 SELinux 策略源(`*.te`)并重新编译 `sepolicy` 二进制文件,但在 Android 上,我们直接修补二进制文件(或运行时策略)。 134 | 135 | Magisk 守护进程派生的所有进程,包括 root shell 及其所有分支,都在上下文 `u:r:magisk:s0` 中运行。所有安装了 Magisk 的系统上使用的规则都可以被视为官方的 `sepolicy` 具有以下补丁:`magiskpolicy --magisk 'allow magisk * * *'`。 136 | 137 | ``` bash 138 | 用法: ./magiskpolicy [--选项...] [策略声明...] 139 | 140 | 选项: 141 | --help 显示 policy 语句的帮助消息 142 | --load FILE 从 FILE 加载 sepolicy 143 | --load-split 从预编译的 sepolicy 加载或编译拆分的 cil 策略 144 | --compile-split 编译拆分的cil策略 145 | --save FILE 将整体策略转储到 FILE 文件 146 | --live 立即将 sepolicy 加载到内核中 147 | --magisk 应用内置 Magisk sepolicy 规则 148 | --apply FILE 应用 FILE 中的规则,作为策略语句逐行读取和分析 149 | (允许多重 --apply) 150 | 151 | 如果既没有指定 --load、--load-split,也没有指定 --compile-split,则它 152 | 将从当前活动策略(/sys/fs/selinux/policy)加载 153 | 154 | 155 | 一个策略声明应被视为一个参数,这意味着每个策略声明都应该用引号括起来。 156 | 可以在一个命令中提供多个策略语句。 157 | 158 | 语句的格式为“ [args...]”。 159 | 标有 (^) 的参数可以接受一个或多个条目。多个条目由大括号 ({}) 中的空格分隔列表组成。 160 | 标有 (*) 的参数与 (^) 相同,但另外支持 match-all 运算符 (*)。 161 | 162 | 示例:"allow { s1 s2 } { t1 t2 } class *" 163 | 将扩展到: 164 | 165 | allow s1 t1 class { all-permissions-of-class } 166 | allow s1 t2 class { all-permissions-of-class } 167 | allow s2 t1 class { all-permissions-of-class } 168 | allow s2 t2 class { all-permissions-of-class } 169 | 170 | 支持的策略声明: 171 | 172 | "allow *source_type *target_type *class *perm_set" 173 | "deny *source_type *target_type *class *perm_set" 174 | "auditallow *source_type *target_type *class *perm_set" 175 | "dontaudit *source_type *target_type *class *perm_set" 176 | 177 | "allowxperm *source_type *target_type *class operation xperm_set" 178 | "auditallowxperm *source_type *target_type *class operation xperm_set" 179 | "dontauditxperm *source_type *target_type *class operation xperm_set" 180 | - 唯一支持的操作是“ioctl” 181 | - xperm_set 格式为 “low-high”、“value”或“*”。 182 | “*”将被视为“0x0000-0xFFFF”。 183 | 所有值应以十六进制书写。 184 | 185 | "permissive ^type" 186 | "enforce ^type" 187 | 188 | "typeattribute ^type ^attribute" 189 | 190 | "type type_name ^(attribute)" 191 | - 参数“attribute”是可选的,默认为“domain” 192 | 193 | "attribute attribute_name" 194 | 195 | "type_transition source_type target_type class default_type (object_name)" 196 | - 参数“object_name”是可选的 197 | 198 | "type_change source_type target_type class default_type" 199 | "type_member source_type target_type class default_type" 200 | 201 | "genfscon fs_name partial_path fs_context" 202 | ``` 203 | 204 | ## magisk 205 | 206 | 当使用名称 `magisk` 调用 magisk 二进制文件时,它作为一个实用工具,具有许多助手函数和几个 Magisk 服务的入口点。 207 | 208 | ``` bash 209 | 用法: magisk [小程序 [参数]...] 210 | 或: magisk [选项]... 211 | 212 | 选项: 213 | -c 打印当前二进制版本 214 | -v 打印正在运行的守护程序版本 215 | -V 打印正在运行的守护程序版本号 216 | --list 列出所有可用的小程序 217 | --remove-modules 移除所有模块并重新启动 218 | --install-module ZIP 安装模块 zip 文件 219 | 220 | 高级选项(内部 APIs): 221 | --daemon 手动启动 Magisk 守护进程 222 | --stop 移除所有 Magisk 更改并停止守护程序 223 | --[init trigger] 初始化触发器上的回调。有效的触发器: 224 | post-fs-data, service, boot-complete, zygote-restart 225 | --unlock-blocks 将所有块设备的 BLKROSET 标志设置为 OFF 226 | --restorecon 恢复 Magisk 文件上的 selinux 上下文 227 | --clone-attr SRC DEST 克隆权限、所有者和 selinux 上下文 228 | --clone SRC DEST 克隆 SRC 到 DEST 229 | --sqlite SQL 执行 SQL 命令到 Magisk 数据库 230 | --path 打印 Magisk tmpfs 挂载路径 231 | --denylist ARGS 拒绝列表配置 CLI 232 | 233 | 可用的小程序: 234 | su, resetprop 235 | 236 | 用法: magisk --denylist [操作 [参数...] ] 237 | 操作: 238 | status 返回强制的状态 239 | enable 启用拒绝列表强制 240 | disable 禁用拒绝列表强制 241 | add PKG [PROC] 将新目标添加到拒绝列表 242 | rm PKG [PROC] 从拒绝列表中删除目标 243 | ls 打印当前拒绝列表 244 | exec CMDs... 在隔离的挂载命名空间中执行命令并执行 245 | 所有卸载操作 246 | ``` 247 | 248 | ## su 249 | 250 | MagiskSU 入口点 `magisk` 的小程序。不错的旧 `su` 命令。 251 | 252 | ``` bash 253 | 用法: su [选项] [-] [user [参数...]] 254 | 255 | 选项: 256 | -c, --command 命令 将命令传递给调用的 shell 257 | -h, --help 显示此帮助消息并退出 258 | -, -l, --login 将 shell 伪装成一个登录 shell 259 | -m, -p, 260 | --preserve-environment 保护整个环境 261 | -s, --shell SHELL 使用 SHELL 而不是默认的 /system/bin/sh 262 | -v, --version 显示版本名并退出 263 | -V 显示版本号并退出 264 | -mm, -M, 265 | --mount-master 在全局装载命名空间中强制运行 266 | ``` 267 | 268 | ::: tip 注意 269 | 尽管上面没有列出 `-Z, --context` 选项,但该选项仍然存在,以便与为 SuperSU 设计的应用程序进行 CLI 兼容。然而,该选项被默默地忽略,因为它不再相关。 270 | ::: 271 | 272 | ## resetprop 273 | 274 | `magisk` 的小程序。高级系统属性操作实用程序。查看 [Resetprop 详细信息](details.md#重置属性-resetprop) 以了解更多背景信息。 275 | 276 | ``` bash 277 | 用法: resetprop [标志] [选项...] 278 | 279 | 选项: 280 | -h, --help 显示此消息 281 | (no arguments) 输出所有属性 282 | NAME 获取 NAME 属性 283 | NAME VALUE 使用 VALUE 设置 NAME 属性 284 | --file FILE 从 FILE 加载属性 285 | --delete NAME 删除 NAME 属性 286 | 287 | 标志: 288 | -v 将详细输出打印到 stderr 289 | -n 设置 props 而不经过 property_service 290 | (此标志仅影响 setprop) 291 | -p 从/向持久存储读取/写入属性 292 | (此标志仅影响 getprop 和 delprop) 293 | ``` 294 | 295 | ## 参考链接 296 | 297 | * [Magisk Tools](https://topjohnwu.github.io/Magisk/tools.html)(官方) 298 | * [Magisk 工具](https://e7kmbb.github.io/Magisk/tools.html) 299 | -------------------------------------------------------------------------------- /install.md: -------------------------------------------------------------------------------- 1 | # 安装 2 | 3 | 如果您已经安装了 Magisk ,**强烈建议**直接通过 Magisk 应用程序的「直接安装」方法进行升级。以下教程仅针对初始安装。 4 | 5 | ## 入门 6 | 7 | 在你开始之前: 8 | 9 | - 本教程假设您了解如何使用 `adb` 和 `fastboot` 10 | - 如果您还计划安装第三方内核(kernel),请在安装 Magisk 之后安装它 11 | - 必须解锁设备的引导加载程序(bootloader) 12 | 13 | --- 14 | 15 | 下载并安装最新的 [Magisk 应用程序](https://github.com/topjohnwu/Magisk/releases/latest) (只需下载「Magisk-版本.apk」即可) 在主屏幕中,您应该看到: 16 | 17 |

18 | 19 | **Ramdisk** 的结果确定您的设备在 boot 分区中是否有 ramdisk。如果您的设备没有启动 ramdisk,请在继续之前阅读 [Recovery 中的 Magisk](#recovery-中的-magisk) 部分。 20 | 21 | ::: info 信息 22 | 不幸的是,有一些例外情况,因为某些设备的引导加载程序会接受 ramdisk,即使它不应该接受。 在这种情况下,您必须按照说明进行操作,就好像您的设备的 boot 分区**包含 ramdisk 一样**。 没有什么办法检测到这一点,因此唯一可以确定的方法就是实际尝试。 幸运的是,据我们所知,只有部分小米设备具有此属性,所以大多数人可以忽略这条信息。 23 | ::: 24 | 25 | 如果您使用的是华为设备,请查看[相应部分](#华为)。\ 26 | 如果您使用的是三星设备,请查看[相应部分](#三星设备)。 27 | 28 | 如果您的设备**有启动 ramdisk**,请获取 `boot.img` 或者 `init_boot.img`(如果存在。在出厂时搭载 Android 13 的设备通常是这样的)的副本。 29 | 30 | 如果您的设备**没有启动 ramdisk**,请获取 `recovery.img` 的副本。 31 | 32 | 您可以从官方固件包或第三方 ROM 刷机包中提取所需文件。 33 | 34 | 接下来,我们需要知道您的设备是否有单独的 `vbmeta` 分区。 35 | 36 | 48 | 49 | 快速回顾一下,此时,您应该已经知道并准备好了: 50 | 51 | 1. 设备是否有启动 ramdisk 52 | 2. 基于 (1) 的 `boot.img` 、`init_boot.img` 或 `recovery.img` 53 | 54 | 让我们继续[修补映像](#修补映像). 55 | 56 | ## 修补映像 57 | 58 | - 将 boot 、init_boot 或 recovery 映像( `*.img` 文件)复制到设备 59 | - 按下 Magisk 主屏幕中的 **「安装」** 按钮 60 | - 如果要修补 recovery 映像,请选中 **「Recovery 模式」** 选项 61 | - 在方式中选择 **「选择并修补一个文件」** ,然后选择 boot 、init_boot 或 recovery 映像 62 | - 开始安装,并使用 ADB 将修补的映像复制到您的电脑: 63 | ``` shell 64 | adb pull /sdcard/Download/magisk_patched_[随机字符].img PC上magisk_patched.img的路径 65 | ``` 66 | > 提示,你可以将文件从资源管理器直接拖到终端中来获得文件绝对路径。 67 | **不要使用 MTP**,因为它可能会损坏大文件。 68 | - 将修补好的 boot 、init_boot 或 recovery 映像刷入到您的设备。\ 69 | 对于大多数设备,可以重启到 fastboot 模式,并使用以下命令刷入: 70 | ::: code-group 71 | 72 | ``` shell [boot] 73 | fastboot flash boot PC上magisk_patched_[随机字符].img的路径 74 | ``` 75 | 76 | ``` shell [init_boot] 77 | fastboot flash init_boot PC上magisk_patched_[随机字符].img的路径 78 | ``` 79 | 80 | ``` shell [recovery] 81 | fastboot flash recovery PC上magisk_patched_[随机字符].img的路径 82 | ``` 83 | 84 | ::: 85 | - 如果您的设备有单独的 `vbmeta` 分区,则可以使用以下命令修补 `vbmeta` 分区 86 | ``` shell 87 | fastboot flash vbmeta --disable-verity --disable-verification vbmeta.img 88 | ``` 89 | ::: warning 90 | 此操作可能清除您的数据。 91 | ::: 92 | - 重启并启动 Magisk 应用程序(如果您清除数据,您将看到一个用于占位的 Magisk 应用程序),您将看到一个询问修复环境的对话框,点击它并等待重启。 93 | - 瞧! 94 | 95 | ::: warning 96 | **千万不要**刷写其他人共享的已修补的镜像,也不要在其他设备上修补镜像,即使它们具有相同的设备型号!您可能需要执行完整的数据擦除操作以恢复您的设备。**始终**在您要安装 Magisk 的同一设备上修补引导镜像。 97 | ::: 98 | 99 | ## 卸载 100 | 101 | 卸载 Magisk 的最简单方法是直接通过 Magisk 应用程序。如果您坚持使用第三方 Recovery,请将 Magisk APK 文件 重命名为 `uninstall.zip` 后像其他普通的刷机包一样刷入。 102 | 103 | ## Recovery 中的 Magisk 104 | 105 | 如果您的设备在 boot 映像中没有 ramdisk ,Magisk 别无选择,只能劫持 Recovery 分区。对于这些设备,每次启用 Magisk 时都必须**重新启动至 Recovery**。 106 | 107 | 当 Magisk 劫持 recovery 时,有一个特殊的机制允许您实际进入到 Recovery 模式。每个设备都有自己的启动到 Recovery 模式的按键组合,(例如几乎所有的小米设备均为「电源」+「音量增大」以及 Galaxy S10 的「电源」+「Bixby」+「音量增大」)。百度搜索(或者 Bing 搜索、Google 搜索)可以很容易地获得这些信息。一旦你按下组合键,设备就会显示启动屏幕(可能还会振动),释放所有按键即可启动 Magisk。如果您决定引导到实际的 Recovery 模式,请**长按音量增大,直到看到 Recovery 屏幕**。 108 | 109 | 总之,在 recovery 中安装 Magisk 后 **(从关机开始)**: 110 | 111 | - **(正常开机) → (无 Magisk 的系统)** 112 | - **(按键组合) → (启动屏幕) → (释放所有按钮) → (带有 Magisk 的系统)** 113 | - **(按键组合) → (启动屏幕) → (长按音量增大) → (Recovery 模式)** 114 | 115 | (注意:在这种情况下,您**不能使用 第三方 Recovery 来安装或升级 Magisk**!!) 116 | 117 | ## 三星设备 118 | 119 | 在继续之前,请确认: 120 | 121 | - 安装 Magisk **将熔断您的 Knox 保修位**,此操作无论如何都是不可逆的。 122 | - 首次安装 Magisk **需要完整的数据擦除**(这**不包括在解锁 bootloader 时的数据擦除**)。请备份您的数据。 123 | 124 | ### 刷机工具 125 | 126 | - [Samsung Odin3](https://dl2018.sammobile.com/Odin.zip)(仅限 Windows)(需要 [Samsung USB Drivers](https://developer.samsung.com/android-usb-driver)) 127 | - [Samsung Odin4](https://forum.xda-developers.com/t/official-samsung-odin-v4-1-2-1-dc05e3ea-for-linux.4453423/)(仅限Linux) 128 | - [Heimdall](https://www.glassechidna.com.au/heimdall/)(或 [Grimler's fork](https://git.sr.ht/~grimler/Heimdall)) 129 | 130 | ### 要求 131 | 132 | 要验证三星设备是否可以安装 Magisk,首先必须检查 OEM 锁和 KnoxGuard (RMM) 状态,为此请使用组合键在下载模式下启动设备。 133 | 134 | OEM 锁的值可能如下: 135 | 136 | - **ON (L)**:完全锁定。 137 | - **ON (U)**:启动加载程序已锁定,OEM 解锁已启用。 138 | - **OFF (U)**:完全解锁。 139 | 140 | 要解锁引导加载器,请按照以下说明操作。如果下载模式下未显示 OEM 锁的值,则可能由于市场限制(美国/加拿大设备),您的设备无法解锁。 141 | 142 | KnoxGuard 的值可能如下: 143 | 144 | - `Active` 、`Locked`:您的设备已被电信运营商或保险公司远程锁定。 145 | - `Prenormal`:您的设备被暂时锁定,达到 168 小时正常运行时间后会触发解锁。 146 | - `Checking` 、`Completed` 、`Broken`:您的设备已解锁。 147 | 148 | 启用 KnoxGuard 后,无论您的启动加载器处于何种锁定状态,都将无法安装/运行 Magisk。 149 | 150 | ### 解锁 Bootloader 151 | 152 | 1. 允许解锁 bootloader,在 **开发者选项 → OEM 解锁**。 153 | 2. 重启至下载模式:关闭设备电源并按下设备的下载模式组合键。 154 | 3. 长按音量上键解锁 bootloader。**这将清除你的数据并自动重启**。 155 | 4. 完成初始设置。跳过所有步骤,因为数据将在后面的步骤中再次清除。**请在设置过程中将设备连接到互联网。** 156 | 5. 启用开发者选项,**确认 OEM 解锁选项是否存在,并显示为灰色。**这意味着 KnoxGuard 没有锁定您的设备。 157 | 6. 您的 bootloader 现在在下载模式下可接受的非官方映像。 158 | 159 | ### 操作指南 160 | 161 | - 为您的设备下载最新固件包,您可以使用以下工具之一直接从三星服务器下载: 162 | - [SamFirm.NET](https://github.com/jesec/SamFirm.NET),[samfirm.js](https://github.com/jesec/samfirm.js) 163 | - [Frija](https://forum.xda-developers.com/s10-plus/how-to/tool-frija-samsung-firmware-downloader-t3910594) 164 | - [Samloader](https://forum.xda-developers.com/s10-plus/how-to/tool-samloader-samfirm-frija-replacement-t4105929) 165 | - [Bifrost](https://forum.xda-developers.com/t/tool-samsung-samsung-firmware-downloader.4240719/) 166 | - 解压缩固件并将 `AP` 归档文件复制到设备。它通常命名为 `AP_[device_model_sw_ver].tar.md5` 。 167 | - 按下 Magisk 主屏幕中的 **「安装」** 按钮。 168 | - 如果您的设备**没有**启动 ramdisk,勾选 **「Recovery模式」** 选项。 169 | - 在方式中选择 **「选择并修补一个文件」** ,然后选择 `AP` 归档文件。 170 | - 开始安装,并使用 ADB 将修补的归档文件复制到您的电脑: 171 | ``` shell 172 | adb pull /sdcard/Download/magisk_patched_[random_strings].tar 173 | ``` 174 | ::: warning 175 | **不要使用 MTP**,因为它可能会损坏大型文件。 176 | ::: 177 | > 译者注:如果有条件,可以验证一下哈希值。 178 | - 重新启动到下载模式。在您的 PC 上打开 Odin,将 `magisk_patched.tar` 作为 `AP`,连同原始固件中的 `BL` 、`CP` 和 `CSC`(**不是** `HOME_CSC`,因为我们要**清除数据**)一起刷入。 179 | - 一旦 Odin 完成刷机,您的设备应该会自动重启。**如果被要求恢复出厂设置,请同意。** 180 | - 如果您的设备**没有**启动 ramdisk,请立即重新启动到 recovery 以启用 Magisk(原因在 [Recovery 中的 Magisk](#recovery-中的-magisk) 中说明)。 181 | - 安装您已经下载的 [Magisk 应用程序](https://github.com/topjohnwu/Magisk/releases/latest) 并启动该应用程序。 它应该显示一个对话框,要求进行额外的设置。 182 | - 让应用程序完成它的工作并自动重启设备。瞧! 183 | 184 | ### 系统更新 185 | 186 | 一旦你的三星设备获得了 root 权限,你就不能再通过 OTA 进行 Android 系统更新了。要进行系统更新,您必须手动下载新的固件归档文件并完成上一节中编写的相同 `AP` 修补过程。这里唯一的区别在于Odin刷入步骤:**不要使用 `CSC` 归档文件,而是使用 `HOME_CSC` 归档文件,因为我们正在执行升级,而不是初始安装**。 187 | 188 | ### 注意事项 189 | 190 | - **永远、永远不要**尝试将 `boot`、`init_boot`、`recovery` 或 `vbmeta` 分区恢复到原样!您这样做会破坏您的设备,并且从中恢复的唯一方法是**清除数据并进行完整的 Odin 恢复**。 191 | - 要使用新的固件升级您的设备,**切勿**出于上述原因直接使用原厂 `AP` 归档文件。**始终**在 Magisk 应用程序中修补 `AP` 并改用它。 192 | 193 | ## 华为 194 | 195 | ::: danger 196 | 这部分现已从官方文档中移除。您正在浏览的是 [2021.03.22](https://github.com/topjohnwu/Magisk/blob/408399eae095b7cbd3e05278682c4bb4c7702ec0/docs/install.md) 时并修改补充后的版本。 197 | ::: 198 | 199 | Magisk 不再正式支持较新的华为设备,因为其设备上的 bootloader 不可通过官方途径解锁,更重要的是他们不遵循标准的 Android 分区方案。以下只是一些一般性指导。 200 | 201 | 使用了麒麟处理器的华为设备与大多数常见设备的分区方式不同。Magisk 通常安装在设备的 `boot` 分区,但是华为设备没有这个分区。根据您的设备运行的 EMUI 版本,说明会略有不同。 202 | 203 | :::: warning 204 | 建议不要使用最新版本的 Magisk 应用!推荐使用 [Magisk v23.0](https://github.com/topjohnwu/Magisk/releases/tag/v23.0) 或 [Magisk v20.4](https://github.com/topjohnwu/Magisk/releases/tag/v20.4) 搭配 [Magisk Manager v7.5.1](https://github.com/topjohnwu/Magisk/releases/tag/manager-v7.5.1) 205 | :::: 206 | 207 | ### 获得官方映像 208 | 209 | 华为不发布官方出厂映像以及 OTA 归档文件,但大多数固件压缩包可以从[华为固件下载站](https://professorjtj.github.io/)下载。 要从压缩包中的「UPDATE.APP」中提取映像,您必须使用 [Huawei Update Extractor](https://forum.xda-developers.com/showthread.php?t=2433454)(仅限 Windows!) 210 | 211 | ### EMUI 5 及以下 212 | 213 | 遵循[入门](#入门)的教程,唯一的不同在于**请勿使用最新版本的 Magisk 应用!** 214 | 215 | > 注意:华为设备进入 fastboot 模式需要将手机**使用数据线连接电脑**,而进入 Recovery 模式则**不能**将手机连接到电脑!所以如果您在 fastboot 模式中刷入 Recovery 映像后请**将手机与电脑断开连接后**再按下「电源」+「音量增大」来进入 Recovery,否则您将进入的是「eRecovery」。 216 | 217 | ### EMUI 8 218 | 219 | 对于运行 EMUI 8 的设备,您的设备有一个名为 `ramdisk` 的分区,这是将要安装 Magisk 的地方。 220 | 221 | - 如果您打算使用第三方 Recovery,只需按照[第三方 Recovery](#第三方-recovery) 的说明进行操作即可。 222 | - 如果您不打算使用第三方 Recovery,则必须从您的固件中提取 `RAMDISK.img` 。 按照上面的[修补映像](#修补映像)说明进行操作,但使用 `RAMDISK.img` 文件而不是 boot 映像! 223 | - 要将修补后的映像刷入您的设备,请使用 fastboot 命令: 224 | ``` shell 225 | fastboot flash ramdisk /path/to/magisk_patched.img 226 | ``` 227 | 请注意,您正在刷入 `ramdisk`,而不是 `boot` ! 228 | 229 | ### EMUI 9 或更高版本 230 | 231 | 对于 EMUI 9+ 设备,`ramdisk` 分区不再存在。 作为解决方法,Magisk 将安装到 `recovery_ramdisk` 分区。 **在按照以下说明操作之前,请先阅读 [Recovery 中的 Magisk](#recovery-中的-magisk) !** 232 | 233 | *译者注:正如在 荣耀 View 10 上测试的那样,华为的内核似乎无法在早期启动时捕获按键事件,因此长按音量增大不会在我的设备上**不会**启动到 Recovery。 您的体验可能会有所不同。* 234 | 235 | - 如果您打算使用第三方 Recovery,只需按照[第三方 Recovery](#第三方-recovery) 的说明进行操作即可。\ 236 | **警告:Magisk 将覆盖第三方 Recovery。** 237 | - 如果您不打算使用第三方 Recovery,则必须从固件中提取 `RECOVERY_RAMDIS.img` (这不是拼写错误),而不是 `recovery.img`(部分设备依旧需要修补 `recovery.img` )。 按照上面的引导映像修补说明进行操作,但使用 `RECOVERY_RAMDIS.img` 文件而不是 boot 映像! 238 | - 要将修补后的映像刷入您的设备,请使用 fastboot 命令: 239 | ``` shell 240 | fastboot flash recovery_ramdisk /path/to/magisk_patched.img 241 | ``` 242 | 请注意,您正在刷入 `recovery_ramdisk`,而不是 `boot` ! 243 | 244 | ## 第三方 Recovery 245 | 246 | ::: warning 247 | 这种安装方法已被弃用,并且可以用很小的工作量来维护。 248 | ::: 249 | 250 | 仅当您的设备启动 ramdisk 时,才能使用第三方 Recovery 进行安装。不建议在新的设备上通过第三方 Recovery 安装 Magisk。如果您遇到任何问题,请使用正确的[修补映像](#修补映像)方法。 251 | 252 | - 下载 [Magisk 安装包](https://github.com/topjohnwu/Magisk/releases) 253 | - 将 `.apk` 文件扩展名重命名为 `.zip` ,例如:`Magisk-v26.1.apk` → `Magisk-v26.1.zip` 。如果重命名文件扩展名时遇到问题(比如在 Windows 文件资源管理器中默认不显示文件扩展名),请使用 Android 上的文件管理器或第三方 Recovery 中的文件管理功能重命名文件。 254 | - 像其他普通的刷机包一样刷 zip。 255 | - 重新启动并检查是否已安装 Magisk 应用程序。如果未自动安装,请手动安装 APK。 256 | - 启动 Magisk 应用程序,它将显示一个让您重新安装的对话框。请**直接在 APP 内**重新安装并重新启动(MTK 设备将在重启后自动给 boot 分区上锁,请使用 fastboot 或者第三方 recovery [修补映像](#修补映像))。 257 | 258 | ::: warning 259 | 模块的 `sepolicy.rule` 文可能存储在 `cache` 分区中。请不要擦除 `CACHE` 分区。 260 | ::: 261 | 262 | ::: tip 263 | 您也可以提供 `adb sideload` 刷入 Magisk,这对于不能正常解密 data 分区且无外置存储设备(SD 卡,U 盘等)的设备特别友好,并且在这种情况下无需将 `.apk` 文件扩展名重命名为 `.zip`。 264 | ::: 265 | 266 | ## 参考链接 267 | 268 | - [Magisk Installation](https://topjohnwu.github.io/Magisk/install.html)(官方) 269 | - [Magisk 安装指南](https://cnoim.coding.net/s/41961bff-16f8-4370-9e0c-af8390a6ec89) 270 | -------------------------------------------------------------------------------- /guides.md: -------------------------------------------------------------------------------- 1 | # 开发者指南 2 | 3 | ## BusyBox 4 | 5 | Magisk 附带了一个完整的 BusyBox 二进制(包括完整的 SELinux 支持)。可执行文件位于 `/data/adb/magisk/busybox` 。Magisk 的 BusyBox 支持运行时可切换的“ASH独立外壳模式”。这种独立模式的意思是,当在 BusyBox 的 `ash` shell 中运行时,无论 `PATH` 设置为什么,每个命令都将直接使用 BusyBox 中的 applet。例如,像 `ls`、`rm`、`chmod` 这样的命令将**不使用** `PATH` 中的内容(在 Android 上,这些命令默认情况下分别为 `/system/bin/ls` 、`/system/bin/rm` 和 `/system/bin/chmod` ),而是直接调用内部 BusyBox 小程序。这确保脚本始终在可预测的环境中运行,并且无论在哪个 Android 版本上运行,都始终具有完整的命令集。要*强制命令不使用BusyBox*,必须使用完整路径调用可执行文件。 6 | 7 | 在 Magisk 环境下运行的每一个 shell 脚本都将在启用独立模式(Standalone Mode)的 BusyBox 的 `ash` shell 中执行。对于与第三方开发人员相关的内容,这包括所有启动脚本和模块安装脚本。 8 | 9 | 对于想在 Magisk 之外使用“独立模式”功能的开发者,有两种方法可以启用它: 10 | 11 | 1. 将环境变量 `ASH_STANDALONE` 设置为 `1`\ 12 | 示例:`ASH_STANDALONE=1 /data/adb/magisk/busybox sh