Skip to content

refactor: use built-in bootimg crate, remove magiskboot (WIP)#3467

Draft
YuKongA wants to merge 2 commits into
mainfrom
bootimg
Draft

refactor: use built-in bootimg crate, remove magiskboot (WIP)#3467
YuKongA wants to merge 2 commits into
mainfrom
bootimg

Conversation

@YuKongA
Copy link
Copy Markdown
Collaborator

@YuKongA YuKongA commented May 15, 2026

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors KernelSU’s userspace boot image patch/restore flow to use the android-bootimg Rust crate instead of relying on magiskboot, and removes the now-unneeded magiskboot plumbing from the CLI, installer, and Manager command invocations.

Changes:

  • Replace magiskboot subprocess usage in boot_patch with in-process parsing/patching via android-bootimg + cpio edits.
  • Remove --magiskboot options/paths from ksud install/uninstall commands and Manager-side command construction.
  • Add new Rust dependencies to support the refactor (bootimg crate, memmap, SHA1 hex encoding helpers) and update the lockfile accordingly.

Reviewed changes

Copilot reviewed 8 out of 10 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
userspace/ksud/src/utils.rs Drops magiskboot installation/uninstall wiring and calls restore without magiskboot.
userspace/ksud/src/late_load.rs Updates call site for the new utils::install() signature.
userspace/ksud/src/defs.rs Removes the MAGISKBOOT_PATH constant.
userspace/ksud/src/cli.rs Removes --magiskboot CLI options and updates install/uninstall dispatch.
userspace/ksud/src/boot_patch.rs Reimplements boot patch/restore using android-bootimg + CPIO manipulation; adds direct partition flashing.
userspace/ksud/src/assets.rs Replaces file-copy helper with an in-memory asset accessor used by the new patcher flow.
userspace/ksud/Cargo.toml Adds android-bootimg, memmap2, base16ct, bumps sha1, updates bindgen.
manager/app/src/main/java/me/weishu/kernelsu/ui/util/KsuCli.kt Removes --magiskboot usage from Manager ksud command invocations.
Cargo.lock Updates lockfile for new/updated dependencies.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread userspace/ksud/Cargo.toml
Comment thread userspace/ksud/src/boot_patch.rs
- based on main...5ec1cff:KernelSU:bootimg
- missing dc1f174a
- not fully tested

Co-Authored-By: 5ec1cff <56485584+5ec1cff@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants