[GUIDE][WIN10] Bootloader Unlock/Re-Lock, Rooting with Magisk and flashing Firmwares

Miustone

Senior Member
Jul 23, 2012
2,913
5,647
203
27
Marburg an der Lahn
sites.google.com
YOUR BOOTLOADER NEEDS TO BE/GET UNLOCKED. YOU CAN'T CONTINUE HERE OTHERWISE....
Please make sure You know what that means! HINT:
The Devices Hardware and Software Features can all be restored after re-locking except for the Device Key.
More about that at the very bottom of the Thread...


What You will need:

Windows 10 (With USB Access)
Xperia Bootloader Unlock Key (From HERE)
Platform Tools alias Fastboot/ADB (From HERE)
Fastboot and Flashmode Drivers (From HERE)
XperiFirm (From XDA)
NewFlasher (From XDA)
Unsin (From XDA)
Magisk Manager (GitHub)
A working Android System
A Backup of Your Internal Devices Storage (Maybe!?)


Let's start...
  1. Download the Drivers and install them with disabled Driver Signature Enforcement. To do so:
  2. Press and hold down the Shift key while you click the “Restart” Option in Windows 10 to do a advanced Restart
  3. Select the “Troubleshoot” Option, followed by the advanced Options and Select Startup Settings
  4. Click on Restart and select Option "7) Disable driver signature enforcement"
  5. Once back in Windows, Install the Fastboot and Flashmode Drivers
  6. Reboot Windows once more and You're prepared to flash Firmwares and to use Fastboot/ADB
  7. Download XperiFirm from XDA and extract it somewhere
  8. Download UnSin from XDA and extract it somewhere
  9. Download the Platform Tools (Fastboot/ADB) from Google and extract it to the root of Your Windows Drive
  10. Download the correct Firmware for Your Device Model with XperiFirm
  11. Download NewFlasher from XDA and extract it to Your Firmware Folder
  12. Download and install the Magisk Manager on Your Xperia Device
  13. Extract the File boot_********.sin with the Unsin Exe (Drag and drop the Image on the Exe)
  14. You will get a .img File which You can patch now with the Magisk Manager on Your Xperia
  15. Open the Magisk Manager and go into the Settings. Tap on the Update Channel and Select the Beta Channel
  16. Go back to the Main Page of Magisk and install Magisk by selecting the Image File You just got from UnSin
  17. Copy the magisk_patched.img in /download from Your Device to the Platform Tools Folder
  18. Grab Your Device again, go to "About Phone" in the Settings and tap several Times on the build Version
  19. Go now to the Developer Settings under "System" and enable "OEM-Unlock" and "USB-Debugging"
  20. Use now the Platform Tools with this Commands:
    (You can acces Fastboot and ADB by starting the Windows Command Prompt)
  21. Type now (Step by Step):
    Code:
    cd\
    cd platform-tools
    (To use the Platform Tools Folder as environment for Fastboot and ADB)
    (In case You extracted the Google platform-tools Folder to Your Windows Drive)
  22. Type now:
    Code:
    adb reboot bootloader
    (You will get a prompt on Your Xperia Device)
  23. Followed by Your Bootloader Unlock Code (You're in fastboot if You can see the BLUE LED on Your Xperia):
    Code:
    fastboot oem unlock 0xYOURKEY
  24. Wait for it... And type now:
    Code:
    fastboot reboot
  25. Wait for Your Device to Wipe and Start. Once in the Android System, turn Your Device off without USB Connected
  26. Press and hold now the Volume UP Button while connecting to USB to enable the fastboot Mode (You're in fastboot if You can see the BLUE LED on Your Xperia)
  27. Continue with flashing the Images for Root (Step by Step):
    Code:
    fastboot flash boot_a magisk_patched.img
    fastboot flash boot_b magisk_patched.img
    fastboot reboot

Done. You are unlocked and rooted now, just install the Magisk Manager and enjoy!


Flashing Firmwares and re-locking the Bootloader...

First of all. You can and should use NewFlasher, with an unlocked and locked Bootloader State.
That can prevent You from Bootloops and is the only way to Update Your Xperia in unlocked State since OTA don't work anymore.
Flashing a new Firmware will also wipe Your Device so make sure You have Backups!
So let's start with the Firmware Flashing (You should have followed the Steps from above before):
-Make sure Your Device is turned off and that it is disconnected from USB
-Press and hold the Volume DOWN Button while connecting to USB to access the Xperia Flashmode
-Go to Your Firmware Folder an start the NewFlasher Exe
-If it asks for rebooting choose what You want
-If it asks for extracting Drivers answer No as "n"
-If it asks for dumping the Trim Area answer No as "n"
-If it asks for flashing modem, bootloader etc. answer Yes as "y" (always do that)
Wait for it to finish and You're done with Updating/Flashing Your Firmware. Enjoy!


If You want to relock Your Bootloader...
-Just go into fastboot mode any type in the command prompt (like before in this Guide):
Code:
cd\
cd platform-tools
fastboot oem lock
-Wait for Your Device and disconnect it from USB
-Download and Install the "Xperia Companion" from SONY
-Open the Xperia Companion and select Software Repair
-Select that Your Device can't get recognized (or is a Smartwatch 3 lol)
-Go to the next Page and select the Xperia Smartphone Option
-Continue and wait for the Initialization
-Press and hold Volume DOWN while connecting to USB (You will see the Green Flashmode LED again)
-Continue once Your Device gets recognized and let the Xperia Companion do his work...

Done. Your Bootloader is locked again and most of Your DRMs are restored. But please Note, that unlocking Your Bootloader erases Your unique Device Key FOREVER. That will flag Your Device as "it was unlocked". This can be checked by SONY and everyone else who has this Device in his Hands... (SONY knows it anyways).


That helped? Leave a Thanks! <3
Donations are actually also really welcome!

 
Last edited:

Miustone

Senior Member
Jul 23, 2012
2,913
5,647
203
27
Marburg an der Lahn
sites.google.com
Where did you get the Customized EU 55.1.A.0.748 J9210 ?? I does not appear on XperiFirm.
My Bad, it is the UK one... I'm also still waiting for customized EU which was always My Choice for Xperia Sources and Development. I'm currently working with GSIs on My Xperia 5 but think i will Release some Stock work soon since i prefer Xperia Android actually over AOSP...

Users will be able to use any Base Firmwares (Android 10) for it but i will personally Test on Custom EU :fingers-crossed:
 

charlatan01

Senior Member
Jan 10, 2008
969
202
0
Denver
Just downloaded J9210_Customized EU3_1320-1208_55.1.A.3.49_R2B. I will release a Update after getting it running on My X5 this Weekend alongside with a Magisk Module Update for XPIXELERIA https://github.com/Miustone/XPIXELERIA

BR:cowboy:
@Miustone Sorry to bother you here, but I am struggling with patching the Xperia 1 .sin boot image with any current version of Magisk. I've tried a few versions but they all fail to create the image from the .sin file. Any help you can provide is greatly appreciated!
I should add, I was trying to use these instructions: https://forum.xda-developers.com/xperia-1/how-to/xperia-1-root-guide-t3938304
 
Last edited:

Miustone

Senior Member
Jul 23, 2012
2,913
5,647
203
27
Marburg an der Lahn
sites.google.com
@Miustone Sorry to bother you here, but I am struggling with patching the Xperia 1 .sin boot image with any current version of Magisk. I've tried a few versions but they all fail to create the image from the .sin file. Any help you can provide is greatly appreciated!
I should add, I was trying to use these instructions: https://forum.xda-developers.com/xperia-1/how-to/xperia-1-root-guide-t3938304
Just read the first Post of this Thread and You will get everything You'll need.

EDIT: Since You just need a .img File for Magisk is there no need to share it with Me actually. Just patch it in the Magisk Manager App and flash it with fastboot afterwards.
 
Last edited:

charlatan01

Senior Member
Jan 10, 2008
969
202
0
Denver
Just read the first Post of this Thread and You will get everything You'll need.

EDIT: Since You just need a .img File for Magisk is there no need to share it with Me actually. Just patch it in the Magisk Manager App and flash it with fastboot afterwards.
Ah, okay. Thanks. One last stupid question.. for the firmware, does it matter if the img file comes from the Android 10 firmware? I am planning to flash my Xperia 1 with PE, which is still Pie.
 

Miustone

Senior Member
Jul 23, 2012
2,913
5,647
203
27
Marburg an der Lahn
sites.google.com
Ah, okay. Thanks. One last stupid question.. for the firmware, does it matter if the img file comes from the Android 10 firmware? I am planning to flash my Xperia 1 with PE, which is still Pie.
Prefer a newer Base Firmware over a newer GSI. A Android 9 GSI will run better with Android 10 Kernel as vice versa. Pie will be no Problem if You run Android 10 Vendor and Kernels. Happy flashing! :fingers-crossed:

EDIT: There are also PE Android 10 Builds out there... https://forum.xda-developers.com/pr...iscussion/gsi-expressluke-built-gsis-t4003457
 
Last edited:
  • Like
Reactions: charlatan01

BuyXRPnow!

Member
Jun 21, 2018
18
2
0
After I get root, can I completely deGoogle my phone? Since there is no Lineage OS for XPERIA 5, can I manually get rid of all of Google's stuff?

Help is greatly appreciated.

Thank you.
 
Last edited:

Miustone

Senior Member
Jul 23, 2012
2,913
5,647
203
27
Marburg an der Lahn
sites.google.com
After I get root, can I completely deGoogle my phone? Since there is no Lineage OS for XPERIA 5, can I manually get rid of all of Google's stuff?

Help is greatly appreciated.

Thank you.
Yes You can. But You can also install LOS 17.1 from the GSI Forums. I also did Instructions for flashing GSI Treble ROMs in the Xpiera 5 Guides Forum :good:
After that You may want to have Magisk to pass safetynet and to install MicroG or NanoDroid to get everything working. I'm actually running PHHs AOSP with My SOM Module and it's one of My Favorites so far. You may also like Havoc OS Official which also comes as no Google Apps Version. You can do the same on Havoc like You can on LOS but + endless Costomization
 
  • Like
Reactions: BuyXRPnow!

BuyXRPnow!

Member
Jun 21, 2018
18
2
0
Yes You can. But You can also install LOS 17.1 from the GSI Forums. I also did Instructions for flashing GSI Treble ROMs in the Xpiera 5 Guides Forum :good:
After that You may want to have Magisk to pass safetynet and to install MicroG or NanoDroid to get everything working. I'm actually running PHHs AOSP with My SOM Module and it's one of My Favorites so far. You may also like Havoc OS Official which also comes as no Google Apps Version. You can do the same on Havoc like You can on LOS but + endless Costomization
I really appreciate your reply, but I am a complete noob and all this is extremely overwhelming.
"PHHs AOSP with My SOM Module" - this alone gives me terrors :)
I know nothing about these things but I understand you, it's just everyday business for you coz you are a developer. I tried reading your guides and there are so many things I don't understand. I also was traumatized by rooting my S10, which I sold and got Xperia 5 instead. I read here people said I will permanently lose DRM keys after rooting. This is my biggest problem. With S10 I knew I could go back to stock and not worry. Here, if I go all the way and deGoogle my Xperia and it doesn't work the way it should I won't be able to go back and on top of that selling it will be harder and I will lose money since not everyone is willing to buy a phone which can't get Netflix and other DMR-dependent garbage.

Maybe I could sponsor you to help me flashing all the stuff. I just don't know if it's a crazy idea. Also, asking you to rewrite your guides for idiots like me is asking too much, given how busy you are.

If you have some advice I would greatly appreciate it.
 

Miustone

Senior Member
Jul 23, 2012
2,913
5,647
203
27
Marburg an der Lahn
sites.google.com
I really appreciate your reply, but I am a complete noob and all this is extremely overwhelming.
"PHHs AOSP with My SOM Module" - this alone gives me terrors :)
I know nothing about these things but I understand you, it's just everyday business for you coz you are a developer. I tried reading your guides and there are so many things I don't understand. I also was traumatized by rooting my S10, which I sold and got Xperia 5 instead. I read here people said I will permanently lose DRM keys after rooting. This is my biggest problem. With S10 I knew I could go back to stock and not worry. Here, if I go all the way and deGoogle my Xperia and it doesn't work the way it should I won't be able to go back and on top of that selling it will be harder and I will lose money since not everyone is willing to buy a phone which can't get Netflix and other DMR-dependent garbage.

Maybe I could sponsor you to help me flashing all the stuff. I just don't know if it's a crazy idea. Also, asking you to rewrite your guides for idiots like me is asking too much, given how busy you are.

If you have some advice I would greatly appreciate it.
First of all. Good choice to get rid of a Samsung Device Like i did with My S9+! Sammy is pushing Android into a Appleish Edge that shouldn't exist...
Just like Huawei. But different Story...

Out of My View with Years of expierence with different Brands is SONY one of the Most supporting OEM in Views of Android Development besides the Fact they Always excluded some functionality of the included Smartphone Hardware. For example:

-Xperia Z1 lost the Complete Camera Function after unlocking (Got fixed with a Update later after Claims from Customers) and lost Display enhancements + Camera Noise reduction

-Xperia Z3 lost the Vibrant Display Colors after unlocking (Aka Bravia Engine) which ended Up in washed Out Colors and was still loosing Noise reduction

-Xperia XZ Premium still loosing enhancements after unlocking plus the loss of Camera Noise reduction

And now the Xperia 5...
Sony used for the First Time Samsung Sensors for the Cameras instead of own ones with High Resolution. So no Noise Reduction needed anymore. Finally OLED, so no washed Out colors without Display Enhancements.
I'm quite Happy with this One since you don't loose Something Essential. Besides that have i Always Managed since the Z3 to fix almost all Problems on Xperias with native Android functionalities that is used on other Devices. Eg. For the Display, Audio, Camera, Mics and so on.

And thats the final Point. While older Devices Had the Chance to Backup and restore the TA Partition or even to use a Recovery on locked Bootloader (I've also worked with this for some Time) which allowed to make Your Device Complete Stock again. We don't really have that Options anymore. So i would say an Unlock is a final Step. But to be honest. I sold many Devices claimed as unlocked and rooted and it hasn't Cut the Price at all. And even if You Don't. I don't think a normal Person will See a difference after unlocking and relocking :rolleyes:

Is it worth it? For Me a clear Yes! I never looked back after unlocking any of My "Hundreds" of Devices i used. Magisk and GSIs alone are really worth the Unlock Out of My View actually. You can do so much with Android and it finally doesn't feels Bad anymore on Xperias. My SOM (Magisk based ROM (Systemless-On-Memory) will do a lot of awesome Things with Our Xperias (1 & 5). Another good Reason maybe...



It could be smart to make a Video which explains how to get My Work on Your Xperias. From unlocking to Flashing... Would really like to do that after some preparing for it. Possible that there are a lot of People who don't even know about Bootloader unlocking so it really could be cool. I already did some Videos in the Past; https://www.youtube.com/user/TheMarius517

Think i got a bit lazy since the Software alone takes so much time These days. But i will do My best to get People in Touch and to Show everything step by step.

Lot of Text but Hope i made Your decision to Unlock or not easier... Don't think about the Future of Your Device. Think about what You want from it right now...:good:

Btw. Not Sure but You could try ADB to remove Apps. But idk. If IT IS possible with Google Apps (Locked Bootloader Method)

All the Best,
Miu:cowboy:
 
  • Like
Reactions: BuyXRPnow!