How to Root Samsung Galaxy M40 using Magisk
If you’re a Samsung Galaxy M40 user looking to unlock the full potential of your device, then you’re in the right place! In this guide, I’ll take you through the process of rooting your Samsung Galaxy M40 using Magisk. Rooting your device opens up a world of new possibilities for customization and performance optimization. It gives you the power to tweak the software to your liking and unleash the full potential of your phone.
I’ll be showing you two methods to root your Samsung Galaxy M40 – one with TWRP recovery and one without TWRP recovery. TWRP is one of the most popular custom recoveries available for Android devices and is a great starting point if you’re new to rooting. With a custom recovery installed, you’ll be able to install custom ROMs, kernels, and mods that can enhance the performance, battery life, and overall functionality of your phone.
Whether you’re a seasoned rooting veteran or a newcomer, this guide will provide you with all the information you need to get started. So, let’s dive in and unlock the full potential of your Samsung Galaxy M40.
Installing TWRP on Samsung Galaxy M40
TWRP, or Team Win Recovery Project, is a custom recovery tool that provides users with a number of additional options and features. With TWRP installed, you’ll be able to flash custom ROMs, perform full backups of your device, and much more. Additionally, TWRP allows you to reboot into different modes, including system, bootloader, and download mode, giving you even more control over your device.
I’ve already written a full article on how to install TWRP on your Samsung Galaxy M40. Simply follow the instructions in the article to get started, and you’ll soon be able to root your phone using TWRP.
Read this: Install TWRP custom recovery on Samsung Galaxy M40
Rooting Samsung Galaxy M40 using TWRP and Magisk
If you’ve already installed TWRP recovery on your Samsung Galaxy M40, then you’re ready to start rooting your device using Magisk. This section will guide you through the process, step by step, so that you can have your phone rooted and ready to go in no time. So, let’s get started and see what rooting your Samsung Galaxy M40 with Magisk and TWRP can do for you!
- Download Magisk Zip file and keep on internal storage.
- Reboot your phone to TWRP recovery mode. (Keep pressing the “Volume Up” buttons and connect phone to pc using data cable).
- Press install button on TWRP recovery.
- Select your downloaded Magisk Zip file.
- After select the file swipe to flash.
- After successfully flash reboot phone to system.
- After phone restart you found new Magisk App.
Now that you have successfully installed Magisk using TWRP recovery on your Samsung Galaxy M40, you can enjoy the benefits of rooting your device. You can now install custom ROMs, custom mods, and take full advantage of your device’s capabilities.
Rooting Samsung Galaxy M40 without TWRP
In this guide, I’m providing a second option for rooting your Samsung Galaxy M40 in case TWRP recovery is not available for your device. This process can be a bit more complicated, but with careful attention to the steps outlined below, you should be able to root your phone without any issues. So, let’s get started and explore how you can root your Samsung Galaxy M40 without TWRP recovery.
Unlock Developer Options on Samsung Galaxy M40
- Go to Phone Settings on your Samsung Galaxy M40.
- Scroll down and select About phone.
- Next, select Software information.
- Tap on the Build number multiple times.
- Enter your phone’s lock screen Password.
- You will now see the “Developer mode has been enabled!” toast message on the phone screen.
Enable is the OEM unlocking option on Samsung Galaxy M40
- Go to Phone Settings on your Samsung Galaxy M40.
- Scroll down and select Developer options.
- Toggle ON the OEM unlocking option.
Unlocking the Bootloader
After enabling OEM unlocking, follow these steps to unlock the bootloader on your Samsung Galaxy M40:
- Power off your phone.
- Press and hold the Volume Up and Volume Down buttons.
- Connect your phone to your PC using the data cable.
- Once you see the bootloader warning screen, press and hold the Volume Up button to unlock the bootloader on your device.
Confirming Bootloader Unlock
You will be prompted to confirm whether you want to unlock the bootloader, use the volume buttons to navigate to ‘Yes’ and press the power button to confirm.
Downloading Stock Firmware for Samsung Galaxy M40
Before we proceed with rooting your Samsung Galaxy M40, it’s important to have the correct stock firmware for your device. You can download the stock firmware from a reputable website like Samfw.com.
To ensure that you get the correct firmware for your device, you will need two pieces of information: the model number and the CSC (Consumer Software Customization) code or regional code. You can easily find your phone’s model number by going to Settings → About phone. With these two pieces of information, you can download the correct stock firmware for your Samsung Galaxy M40.
Download 7zip and LZ4 Tools
After downloading the firmware, we need to extract it. To extract the firmware, we need to use a lz4 extract tool, which can be downloaded from the link provided below.
Download: 7zip Tool
Download: LZ4 Tool
To make sure you can extract the firmware file properly, you need to download and install the 7zip software on your PC. Once installed, use it to extract the LZ4 tool downloaded. This will make it easier for you to extract the firmware file and access the files inside it.
Preparing Patched Boot Image file
- Extract the “AP” firmware package using 7zip.
- Open the extracted folder and again Extract AP firmware file.
- Now you will find boot.img.lz4 file.
- Copy boot.img.lz4 to LZ4 Installed folder.
Converting boot.img.lz4 to boot.img File
- Open the lz4 extracted folder.
- Drag the boot.img.lz4 file to the lz4.exe program.
- This step converts the file to .img format.
Patching the boot.img Firmware File with Magisk
- Download and install the Magisk App on your phone.
- Open the Magisk App.
- Tap on the INSTALL button.
- Select “Patch a file”.
- Choose the boot.img file from your device.
- Tap “LET’S GO” after the file is selected.
- The patched file will be located in the Downloads folder.
- Connect your phone to the PC and copy the magisk_patched.img file to your PC.
Converting .IMG File to .TAR for ODIN Flash Tool
- Download and install the 7zip software on your PC.
- Select the magisk_patched.img file.
- Right-click the mouse and go to “7zip” > “Add to archive”.
- In the “Archive format” option, select “TAR”.
- Click “OK” to complete the conversion of the .IMG file to a .TAR file for ODIN flash tool.
Boot your Samsung Galaxy M40 into Download Mode
- First, power off your phone.
- Press Button Volume Up, Volume Down and connect your phone to your PC using data cable.
- You will now see the Bootloader warning screen.
- Long press Volume Up button to unlock bootloader.
- If your device bootloader already unlock just press one time volume up button.
- Following this method you enter to download mode.
Flashing Magisk_Patched.tar with Odin Flash Tool
- Run Odin Tool.
- Reboot your phone to download mode.
- Connect your Samsung Galaxy M40 device to a PC/Laptop.
- You will see ID:COM section light up blue. It means the port is working.
- BL: Select the firmware file starting BL.
- AP: Select the Magisk Patched AP firmware file (magisk_patched.tar)
- CP: Select the firmware file starting CP.
- CSC: Select the firmware file starting CSC.
- Once done, click Start to begin the flashing process.
- The first boot will take some time.
- After on phone you will see in app drawer Magisk APK installed.
In conclusion, we have shown you how to root your Samsung Galaxy M40 using TWRP and Magisk and also without TWRP recovery. By following the step-by-step instructions provided in this guide, you should now be able to gain full control over your device and unlock its full potential. Remember to always read and follow the instructions carefully, and if you have any questions, feel free to ask on comment box. Keep in mind that rooting your device may void the warranty and also be aware of the risks involved.