Adb Fastboot Magisk Module Repack
This write-up covers the process of repacking the ADB & Fastboot Magisk module, which is primarily used to run terminal commands from one Android device to another via OTG . 🛠️ Prerequisites Rooted Android device with Magisk installed . Terminal Emulator app (like Termux) .
Original Module Zip: Typically the "ADB & Fastboot for Android NDK" by osm0sis .
Computer (optional but recommended for easier file editing) . 📂 Module Structure A standard Magisk module consists of these essential files:
module.prop: Contains the module ID, name, version, and author .
customize.sh: Script for custom installation logic (e.g., setting permissions).
system/bin/: Where the adb and fastboot binaries are stored . META-INF/: Essential for the ZIP to be flashable. 🔄 Repacking Process 1. Extract the Original Module
Unzip the adb-fastboot-ndk.zip on your PC or Android device . You will see the structure mentioned above.
sky1wu/Magisk-ADB-and-Fastboot-Tools: adbtoolkitinstall - GitHub adb fastboot magisk module repack
This is a module to install ADB and Fastboot to your devices. Make a Device Tree - Minimal Manifest - GitHub Gist
Get some informations from device using adb-fastboot platform-tool; You can use termux if you want.
Rooting Android Devices and Building Custom Modules (Part I)
On your phone, download and install the Magisk Manager Application. Tap on the "Select and Patch a File" option, select the "boot. Just Mobile Security 2. Update Binaries (The "Repack" Goal) If you are repacking to update the ADB/Fastboot versions:
Obtain the latest static binaries for your architecture (ARM or ARM64) .
Replace the existing files in system/bin/adb and system/bin/fastboot with your new versions. 3. Modify Metadata Open module.prop in a text editor and update: version: Change this so you can track your custom build.
description: Add a note that this is a repacked/updated version. 4. Adjust Scripts (If Needed) This write-up covers the process of repacking the
If you need the binaries to behave differently, edit customize.sh. For instance, you can add commands to set specific execution permissions:set_perm_recursive $MODPATH/system/bin 0 0 0755 0755 5. Repack into ZIP
Select all the files (do not include the parent folder) and compress them into a new .zip file . ⚡ Installation & Verification
Transfer: Move your new .zip to your phone's internal storage .
Install: Open the Magisk App → Modules → Install from storage . Reboot: Restart your device to activate the module .
Test: Open Termux and type adb version or fastboot --version to verify the new binaries are active . ⚠️ Common Use Cases
Phone-to-Phone Rooting: Use your repacked module to flash magisk_patched.img to another phone via OTG .
Recovery Sideloading: Sideload ROMs or ZIPs to a secondary device in recovery mode . Part 2: Why Would You Need to Repack a Magisk Module
Bootloader Unlocking: Run fastboot flashing unlock from your handset on a friend's device .
If you'd like, I can provide specific shell script snippets for the customize.sh file or help you find the latest static binaries for your specific device architecture.
Part 2: Why Would You Need to Repack a Magisk Module?
You might need to repack a Magisk module for several reasons:
- Updating a module manually: The developer abandoned the project, but you need compatibility with a newer Android version.
- Merging modules: You have two small modules (e.g., a Viper4Android fix and a audio mod library) and want them in one zip.
- Changing module properties: Editing
module.propto rename the module, change the version, or alter the author. - Adding custom scripts: Injecting your own
post-fs-data.shorservice.shscripts. - Fixing conflicts: Removing conflicting files or libs from an existing module.
Installation
adb push <name>.zip /sdcard/ adb shell su -c "magisk --install-module /sdcard/<name>.zip"
Step 2: Modify Module Contents
Edit module.prop (change version, description, etc.)
Add/overlay files in system/ (e.g., system/etc/some_config)
Update or add scripts (post-fs-data.sh must be executable)
To add custom sepolicy.rule:
# Generate from boot image patching (outside scope)
# Place inside module root as sepolicy.rule
Use Case Scenarios
- The "Just In Case" Tool: Installing this module is great peace of mind for advanced users. If you are away from your PC and need to flash a patched boot image for a new update, it works flawlessly.
- The No-PC Method: For users who do not own a computer, this is often the only way to root a device using methods like "patching the boot image" directly on the device and flashing it locally.
What is it?
A "repack" usually refers to a modified Magisk module that packages the ADB and Fastboot binaries for Android. This allows a user to open a terminal emulator (or use an automated script) on the phone itself to flash partitions (like boot.img or recovery.img) without needing a computer.
