- Go to the Settings menu of your phone. First, enable "Developer options", then open the menu and activate "OEM unlocking".
- With the phone turned off, hold down the Volume Down key and the Home key. Keep holding the keys and connect your phone to a computer.
- Press the Volume Up key to unlock the bootloader.
- Repeat the first step. "OEM unlocking" must be enabled and greyed out.
- Download the stock firmware for your smartphone model to your computer and extract it.
- Go to the extracted folder and transfer the .tar file to your smartphone.
- Next, install Magisk Manager on your smartphone. Run the app and tap "Install".
- Then choose "Select and Patch a File". Navigate to the .tar file you transferred earlier and select it.
- When the patching process is completed, go to the "Download" folder, find the patched file, and transfer it to your computer.
- Now launch Odin, click on the "AP" button, and select the patched file ending with .tar.
- Hold down the Power key to turn off your phone.
- When the phone is off, hold down the Volume Down key, the Home key, and the Power key.
- Then connect the phone to your computer and click on "Start".
- When the flashing process is over, press the Volume Up key and the Power key.
- You will enter a new menu. Here navigate to "wipe data/factory reset" using the Volume keys and select the option using the Power key.
- Then select "Reboot system now" to turn on your phone.
- Now run Magisk Manager and follow the instructions that appear.
- Install a custom recovery using the TWRP recovery app.