MagiskDocument

构建和开发 Magisk

设置环境

git clone --recurse-submodules https://github.com/topjohnwu/Magisk.git

构建

IDE 支持

在 Android Studio 中开发 Rust

由于 Magisk NDK 软件包 ONDK(与 ./build.py ndk 一起安装的软件包)包含一个完全独立的 Clang + Rust 工具链,因此单独构建 Magisk 项目不需要配置工具链。但是,由于 Intellij Rust 插件的工作方式,您必须进行一些额外的设置才能使 Android Studio 与 Magisk 的 Rust 代码库一起使用:

# 将 ONDK 工具链与名称“magisk”链接起来
rustup toolchain link magisk "$ANDROID_SDK_ROOT/ndk/magisk/toolchains/rust"
# 设置为默认
rustup default magisk

签名和分发

Building and Development

Setup Environment

Building

IDE Support

Developing Rust in Android Studio

Because the Magisk NDK package, ONDK (the one installed with ./build.py ndk), contains a fully self contained Clang + Rust toolchain, building the Magisk project alone does not require configuring toolchains. However, due to the way the IntelliJ Rust plugin works, you’ll have to go through some additional setup to make Android Studio work with Magisk’s Rust codebase:

# Link the ONDK toolchain with the name "magisk"
rustup toolchain link magisk "$ANDROID_SDK_ROOT/ndk/magisk/toolchains/rust"
# Set as default
rustup default magisk

Signing and Distribution