Top Ad unit 728 × 90

How to Install Magisk on your Android Phone

If you’ve ever thought of rooting your phone or modding certain aspects of it, the chances are you’ve heard of Magisk. But what is Magisk? Magisk is a tool that can be used to gain root access on your device, similar to SuperSU but it’s not limited to just that. Developed by topjohnwu, a Senior Recognized Developer at the XDA Forums, Magisk is a portal that enables all sorts of modifications on your Android phone. There are several Magisk Modules you can install on your phone for different purposes.

Magisk v17.2

There are modules for theming, ad blockers, enabling Camera2API, and a lot of other system-level modifications you can’t do otherwise. If you’re a power user and want to extend the functionality of your phone and push it to its limits, you need to try out Magisk. If all this sounds fun to you, we’ll tell you how you can install Magisk on your Android device to customize it and do things you never thought of doing on your phone.

How to Install Magisk

Installing Magisk requires you to have a custom recovery for which your phone needs to have an unlocked bootloader. If you’ve already unlocked the bootloader on your phone, you’re good to go. If you haven’t and you don’t know what we’re talking about, we recommend you head over to the XDA Forums, search for your device, and then look for a guide to unlocking the bootloader. There’s no universal method for this, as it differs from phone to phone. Once you’ve unlocked the bootloader, you can proceed further.

Disclaimer: Unlocking the bootloader will wipe all the data on your smartphone and in some cases, may even void your warranty. It’s advisable to back up all your data before performing these steps. It’s also important to understand that not following the steps correctly may result in a bricked phone so make sure you know how to recover your phone back to its original state in case you end up in a situation like that.

Furthermore, Magisk may cause issues with a few banking and payment-related apps so if those are absolutely vital to you, proceed with caution.

Before we begin, make sure you have access to a PC/Mac with ADB and Fastbbot installed.

Step 1: Identifying the type of boot image

Download the latest version of the Magisk app from the project’s GitHub repository. Since the APK of Magisk is hosted outside the Google Play Store, you may need to allow sideloading apps from unknown sources first and then manually install the downloaded package.

After installing, open the Magisk app. You should see a screen like this:

Magisk main app window

Now, we need to note down the values of the following parameters:

  • Ramdisk
  • A/B
  • SAR

Step 2: Locating the boot image

In order to patch the boot image for your device, you need to extract it from the official firmware packages. In case you’re using a custom ROM like LineageOS, the flashable ZIP file contains the boot image.

Case I: You have access to the recovery-flashable ZIP file

If you have a device that still uses the A-only partition scheme, you can find the ‘boot.img’ right inside the recovery-flashable ZIP file. Just extract it using a suitable archiver program.

POCO M3 boot.img inside recovery ZIP

Notice the boot.img file inside POCO M3’s recovery ZIP.

However, if your device utilizes the A/B partition scheme, then the boot image and other partition images are further packed inside a file named payload.bin as shown below.

Google Pixel 5 payload.bin inside recovery ZIP

The recovery ZIP of the Google Pixel 5 contains a payload.bin file. In that case, you have to extract the payload.bin file first, then use one of the community-developed payload.bin unpackers to get the boot.img out of it. We strongly suggest you opt for the extractor written in Go as it’s cross-platform and has been actively developed.

Known as ‘payload-dumper-go’, this fork even allows end-users to extract a single partition image without unpacking the whole payload.bin, which is particularly useful for this usage scenario.

  • First, use the -l parameter to list the partition images inside the payload.bin.
    payload-dumper-go -l payload.bin
  • Then use the -p parameter with the name of the boot image (commonly stored as “boot”) to extract it.
    payload-dumper-go -p boot payload.bin

ASUS ROG Phone 5 boot.img from payload.bin

Case II: You have access to the Fastboot-flashable image

A handful of OEMs like Google and Xiaomi provide Fastboot-flashable factory images for their devices. If you managed to grab such a package, then the raw ‘boot.img’ can easily be extracted from the archive.

Google Pixel 5 boot.img from Fastboot package

Special Case: Samsung

Samsung Galaxy devices don’t a traditional Fastboot interface, hence their factory images are packed differently.

  1. Use Samsung Firmware Downloader to download the factory image for your model.
  2. Unzip the decrypted package and locate the AP tar file to your device. It is normally named as AP_[device_model_sw_ver].tar.md5.

Step 3: Patching the boot image

Now we have the boot image in hand, we should proceed with the patching part.

Case I: The value of the “Ramdisk” parameter is “Yes”

  • Copy the boot image to your device. In fact, you can patch it on a different Android device than the target one, but you need to install the Magisk app on the secondary device as well.
  • Press the Install button on the Magisk card.
  • Choose Select and Patch a File under method, and select the stock boot image.

Magisk select and patch image

  • The Magisk app will patch the image to [Internal Storage]/Download/magisk_patched_[random_strings].img.

Magisk is patching a boot image

  • Copy the patched image to your PC with ADB:
    adb pull /sdcard/Download/magisk_patched_[random_strings].img
  • Flash the patched boot image to your device. For most devices, reboot into Fastboot mode and flash with the following command:
    fastboot flash boot /path/to/magisk_patched.img
  • Reboot and enjoy Magisk!

Keep in mind it’s possible to patch the boot image on the fly on legacy devices having boot ramdisk through a custom recovery like TWRP, but the method is no longer recommended on modern devices. Having said that, if you have an old phone and want to stick with the custom recovery route, the steps are as follows:

  • Download the Magisk APK.
  • Rename the .APK file extension to .ZIP (e.g. Magisk-v23.0.APK → Magisk-v23.0.ZIP).
  • Flash the ZIP file just like any other ordinary flashable ZIP.

Magisk flashing via TWRP

  • Note that the sepolicy.rule file of modules may be stored in cache partition, so do not clear it.
  • Check whether the Magisk app is installed. If it isn’t installed automatically, manually install the APK.

Case II: The value of the “Ramdisk” parameter is “No”

In this case, you need to locate the recovery.img file from the factory image of your device instead of boot.img file. This is because Magisk needs to be installed in the recovery partition, which means you’ll have to reboot to the recovery mode every time you want to access Magisk.

  • Copy the recovery image to your device (or a secondary device with the Magisk app installed).
  • Press the Install button on the Magisk card.
  • Choose Select and Patch a File under method, and select the stock recovery image.
  • The Magisk app will patch the image to [Internal Storage]/Download/magisk_patched_[random_strings].img.
  • Copy the patched image to your PC with ADB:
    adb pull /sdcard/Download/magisk_patched_[random_strings].img
  • Flash the patched recovery image to your device. For most devices, reboot into Fastboot mode and flash with the following command:
    fastboot flash recovery /path/to/magisk_patched.img
  • Reboot.

At this stage, there are three possible scenarios:

  • Power up normally: You’ll end up with no Magisk.
  • Recovery Key Combo → Splash screen → Release all buttons: The system should boot with Magisk.
  • Recovery Key Combo → Splash screen → Keep pressing volume up: To access the stock recovery mode

Special Case: Samsung

  • Copy the extracted AP tar file to your device.
  • Press the Install button on the Magisk card.
  • If your device doesn’t have a boot ramdisk, make sure Recovery Mode is checked in options.
  • Choose Select and Patch a File under method, and select the AP tar file.
  • The Magisk app will patch the whole firmware file to [Internal Storage]/Download/magisk_patched_[random_strings].tar
  • Copy the patched tar file to your PC with ADB:
    adb pull /sdcard/Download/magisk_patched_[random_strings].tar
    • Don’t try to copy over the MTP interface 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 from the original firmware.
    • Don’t choose HOME_CSC because we want to wipe data.
  • Your device should reboot automatically once Odin finished flashing. Agree to do a factory reset if asked.
  • If your device doesn’t have a boot ramdisk, reboot to recovery now to enable Magisk.
  • Install the latest Magisk app and launch the app. It should show a dialog asking for additional setup. Let it do its job and the app will automatically reboot your device.
  • Reboot and enjoy Magisk!

Step 4: Verification

The last step is to verify that everything is working properly. Locate the newly installed Magisk app and open it. We want to see a version number beside the “Installed” parameter. This means you have successfully installed Magisk. Great job!

A successful installation of Magisk

Now you have Magisk installed, it’s time to try out some nice Magisk Modules. You can find lots of modules for specific purposes, and since Magisk gives you root access, you can even install some of the best apps for rooted devices. So install whichever apps and modules you like and get tweaking!

The post How to Install Magisk on your Android Phone appeared first on xda-developers.



from xda-developers https://ift.tt/2r3Kp6r
via IFTTT
How to Install Magisk on your Android Phone Reviewed by site on 08:05 Rating: 5

No comments:

All Rights Reserved by xda android © 2014 - 2015
Powered By Blogger, Designed by Sweetheme

Formulaire de contact

Name

Email *

Message *

Powered by Blogger.