Note: this guide copied from topjohnwu's. Original guide here
US/Canada bootloader unlock thread:
here
Before Installing Magisk
If you already have Magisk installed, it is strongly recommended to upgrade directly via Magisk Manager using the “Direct Install” method. The following tutorial is only for initial installation.
Getting Started
Before you start:
Download and install the latest Magisk app. In the home screen, you should see:
The result of Ramdisk determines whether your device has ramdisk in the boot partition.
Unlocking Bootloader
Unlocking BL on modern Samsung devices have some caveats, so I figure this would be helpful.
If you think the bootloader is fully unlocked, it is actually not! Samsung introduced VaultKeeper, meaning the bootloader will still reject any unofficial partitions before VaultKeeper explicitly allows it.
Patching Boot Image
If your device has boot ramdisk, you need a copy of the boot.img
Instructions
Patching AP
Instructions
Instructions
Thanks
@topjohnwu for magisk and guide, If you appreciate his effort, show some love and support
Donations
https://www.patreon.com/topjohnwu
https://www.paypal.me/topjohnwu
US/Canada bootloader unlock thread:
here
Before Installing Magisk
- Installing Magisk WILL trip KNOX
- Unlocking bootloader for the first time will do a data wipe.
If you already have Magisk installed, it is strongly recommended to upgrade directly via Magisk Manager using the “Direct Install” method. The following tutorial is only for initial installation.
Getting Started
Before you start:
- This tutorial assumes you understand how to use adb and fastboot
- If you plan to also install custom kernels, install it after Magisk
- Your device’s bootloader has to be unlocked
Download and install the latest Magisk app. In the home screen, you should see:

The result of Ramdisk determines whether your device has ramdisk in the boot partition.
Unlocking Bootloader
Unlocking BL on modern Samsung devices have some caveats, so I figure this would be helpful.
- Allow bootloader unlocking in Developer options → OEM unlocking
- Reboot to download mode: power off your device and press the download mode key combo for your device (Vol Down + Vol Up) while connected to usb.
- Long press volume up to unlock the bootloader. This will wipe your data and automatically reboot.
If you think the bootloader is fully unlocked, it is actually not! Samsung introduced VaultKeeper, meaning the bootloader will still reject any unofficial partitions before VaultKeeper explicitly allows it.
- Go through the initial setup. Skip through all the steps since data will be wiped again later when we are installing Magisk. Connect the device to Internet during the setup.
- Enable developer options, and confirm that the OEM unlocking option exists and is grayed out. This means the VaultKeeper service has unleashed the bootloader.
- Your bootloader now accepts unofficial images in download mode.
Patching Boot Image
If your device has boot ramdisk, you need a copy of the boot.img
Instructions
- Use either Frija or Samloader to download the latest firmware zip of your device directly from Samsung servers.
- Unzip the boot.img from AP and copy the file to your device.
- Press the Install button in the Magisk card
- Choose “Select and Patch a File” in method, and select the stock boot image
- Magisk Manager will patch the image to [Internal Storage]/Download/magisk_patched.img.
- Copy the patched image to your PC
- Flash the patched boot image to your device.
For most devices, reboot into fastboot mode and flash with command:
fastboot flash boot /path/to/magisk_patched.img or
Rename magisk_patched.img to boot.img and use 7zip to make flashable tar of your boot.img
Reboot to download mode. Open Odin on your PC, and flash boot_patched.tar as AP. - Reboot and voila!
Patching AP
Instructions
- Use either Frija or Samloader to download the latest firmware zip of your device directly from Samsung servers.
- Unzip the firmware and copy the AP tar file to your device. It is normally named as AP_[device_model_sw_ver].tar.md5
- Press the Install button in the Magisk card
- Choose “Select and Patch a File” in method, and select the AP tar file
- Magisk Manager will patch the whole firmware file to [Internal Storage]/Download/magisk_patched.tar
- Start the installation, and copy the patched tar file to your PC using ADB:
adb pull /sdcard/Download/magisk_patched_[random_strings].tar
DO NOT USE MTP as it is known to corrupt large files. - Reboot to download mode. Open Odin on your PC, and flash magisk_patched.tar as AP, together with BL, CP, and CSC (NOT HOME_CSC because we want to wipe data) from the original firmware.
- Your device should reboot automatically once Odin finished flashing. Agree to do a factory reset if asked.
- Install the Magisk app you’ve already downloaded and launch the app. It should show a dialog asking for additional setup.
- Let the app do its job and automatically reboot the device. Voila!
Custom Recovery
Installing using custom recoveries such as TWRP is only possible if your device has boot ramdisk.Instructions
- Download the Magisk APK
- Rename the .apk file extension to .zip, for example: Magisk-v2*.*.apk → Magisk-v2*.*.zip. If you have trouble renaming the file extension (like on Windows), use a file manager on Android or the one included in TWRP to rename the file.
- Flash the zip just like any other ordinary flashable zip.
- Reboot and check whether the Magisk app is installed. If it isn’t installed automatically, manually install the APK.
Thanks
@topjohnwu for magisk and guide, If you appreciate his effort, show some love and support
Donations
https://www.patreon.com/topjohnwu
https://www.paypal.me/topjohnwu
Last edited: