: You must download the exact stock firmware that matches your current build (ensure it is Binary 7).

, this involves enabling "OEM Unlocking" in Developer Options and then entering a specific bootloader mode to confirm the unlock.

: The resulting "patched" file is then flashed back to the device using Odin (a Samsung-specific flashing tool) on a PC. Prerequisites and Risks

: Within that firmware, you locate the AP file, extract the boot.img.tar (or recovery.img depending on the specific build), and use the Magisk app on the phone to "patch" it.

: Rooting and bootloader unlocking wipe all user data.