How to wipe, re-flash, and root a Samsung Galaxy S8+ using odin and magisk

Let’s assume your S8 is messed up beyond recognition, and you want to start over fresh by wiping and flashing the latest Samsung image…

So here’s a very short-worded step by step howto on what to do.




..I guess you got my point now. This can brick your phone. And Samsung’s going to tell you that you voided your warranty if you do.

Before you start: create a backup. Yes, create a backup. Preferably a real one, with Titanium Backup or something similar.

Once you’re done with the backup, you need to get the following things:


Now, make sure you have a backup of your phone. I mean it.

Then, turn the phone off, and then boot it to download mode. To do that: press and hold power, volume down, and bixby, until the phone comes on and shows you a screen where you can use the volume buttons to choose between download mode and reboot. Obviously you want to go to download mode, so press volume up now.

Now, turn to your (windows) PC. Unzip the zip file with your android image that you downloaded with friya (see above). It contains five files, I’ll name them after the start of the file names, there are the AP file, the BL file, the CP file, and two different CSC files.

Now, start odin. You have to run odin as administrator so it can get at your hardware – it needs to be able to access the usb device on a pretty low level.

In odin, load the BL, AP and CP files in the appropriate fields. Load one of the CSC files in the CSC slot, too (the “plain” CSC file results in a completely clean phone, the HOME_CSC file is supposed to retain your data, which is useless since part of this whole process is a factory reset in a few minutes…).Connect your phone to your PC. There are people who say you should use the original Samsung cable – I dunno about that but a good cable is not a bad idea here.

Look if odin shows “added” in the log window – you might have to reboot your phone and enable usb debugging if it doesn’t.

If odin shows “added”, and all four firmware files are loaded in the right spots, press start, and wait. The phone will reboot after the process, and you’ll be greeted by a fresh, clean phone that behaves as if it’s fresh out of the store.

Now we’re going to root it – enter at your own risk.

Transfer to your SD card:

  • the dm-verity-opt-encrypt patch
  • the Magisk zip file

Work your way through the “new user setup” on the phone, until you can access the settings to enable USB debugging by turning on developer mode, and going to the developer settings (you know the drill: in the software version screen tap “build number” seven times, then go into the developer settings screen that you can access now, and turn on usb debugging). While you work your way through initial setup, keep in mind that we’re going to do a factory reset in a few minutes – answer whatever you can with “skip for now”, anything more is a waste of time.

Anyway, once you have usb debugging turned on, power down the phone, and start odin again as administrator on your PC.

Boot your phone to download mode again (see above)

Load the TWRP file into the AP slot in odin, and make sure you turn OFF the “automatic reboot” option in odin (it’s on the options tab).

Make sure you see “Added” in odin in the log output, then press start. Once this is done, the phone will NOT reboot. That’s because if it did, the samsung firmware would replace TWRP with the normal recovery again. We don’t want that, so we boot directly to recovery from download mode now – to do so, press and hold power, bixby, and volume up until you’re in TWRP.

Once we’re in TWRP, insert the SD card containing the dm-verity-opt-encrypt patch and the latest Magisk zip file.

In TWRP, go to “storage” to select the SD card. Then, press “install” and select the dm-verity-opt-encrypt patch, and flash it. Do not reboot yet. Again in Storage, format data (this is the factory reset I mentioned earlier).

Now it’s time to flash Magisk, so do that by pressing install, selecting the Magisk zip file, and flashing it.

After this is finished you can reboot, and you’ll be greeted again by a shiny clean phone – but one with root access.

Walk your way through setup, setup your accounts, etc etc etc.

You’re done.

If you think you’re not yet completely done, here are a few odds and ends I do at this point:

Install a few magisk modules: sshd, l-speed, the f-droid privileged extension, busybox

In Magisk Manager Settings, enable systemless hosts,  and hide the manager.

Get a buildprop editor, and change ro.config.tima to 0 if you plan on using samsung health

Get a root file manager, and rename /system/priv-app/SamsungPass_1.3/SamsungPass_1.3.apk to /system/priv-app/SamsungPass_1.3/SamsungPass_1.3.apj, and delete /data/app/ if it exists – Samsing Pass is not going to work on a rooted device anyways, and with this gone you can use biometrics for websites again.

Install Titanium Backup, and insert the SD card with your backup from before – now you can restore your previous apps from that backup instead having to bother poor google or samsung for your cloud based backups.

By the way, this is directly related to my previous post…

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: