How To Guide [GUIDE][WINDOWS] Bootloader Unlock & Relock, Drivers, Magisk rooting, Firmware and GSI ROM flashing without TWRP

Search This thread

Introducing this Guide

Hello there and welcome to My Guide for Your Xperia Smartphone. This Guide will walk with You thru the whole Process of installing Drivers, getting an unlock Key for Your Bootloader, rooting with Magisk and even flashing GSI Custom ROMs up to re-locking Your Bootloader and re-flashing Stock for the total Factory Reset. This Thread/Guide is not meant as Wiki n'or will it teach You about Android at all. Inform Yourself using Google to enjoy the total Freedom and Customization of Android... If You can't solve Problems Yourself, by communicating and research, don't touch Your Bootloader!

IMPORTANT:
2020+ Xperias are using fastbootd, and equivalent to fastboot which runs in Userspace (Same as Recoveries).
You can access Your Recovery on Your Xperia by holding VolumeDown (-) & the Powerbutton (Your Device needs to be turned off before ofc). Release the Powerbutton after the Display turned on and hold VolumeDown (-) until You see the Recovery Screen. From there, You can enter fastbootd and fastboot. Labled as "Fastboot" for fastbootd and "Bootloader" which is the old fastboot. You can flash Kernels, Recoveries and other stuff from fastboot. Everything else like System Images (GSIs for example), Product Images, System_ext Images and any Userspace stuff has to be flashed from fastbootd. 2019 Xperias are still using fastboot only...
Fastboot and Fastbootd has nothing to do with SONYs Flashmode on Xperias!


INDEX:
  1. Requirements
  2. Installing Drivers
  3. Firmware Flashing
  4. Bootloader Unlocking & Magisk Root
  5. GSI ROM flashing with Fastboot (Optional)
  6. Bootloader Re-Locking (TheWayBack)
  7. Firmware Restoring after Re-Locking

1. Requirements:
  • Read! Inform Yourself about the Tools You use...
  • Xperia Basics:
    Your Device is turned Off...
    Blue LED=Fastboot (Hold VolumeUp (+) & Connect to USB)
    Green LED=Flashmode (Hold VoumeDown (-) & Connect to USB)
  • Windows 10/11 for Firmware flashing & downloading
  • Xperia Bootloader Unlock Key (From HERE)
  • Platform Tools alias ADB and Fastboot (From HERE)
  • Fastboot and Flashmode Drivers (From HERE and HERE)
  • EMMA for Firmware Updates (From HERE)
  • XperiFirm for Firmware Downloads (From XDA)
  • Unsin to extract the Kernel .sin from XperiFirm (From XDA)
  • Magisk Manager to patch the extracted Kernel .sin (From GitHub)
  • A working Android System for the Magisk Kernel patching
  • GSI & vbmeta Image (From Google) (Optional)
  • A Backup of Your Internal Devices Storage (Optional)


2. Installing Drivers:
  1. Download the Drivers from the Links above and extract them
  2. Install the downloaded and extracted Drivers by right clicking on the ***.inf Files "Install"


3. Flashing Firmwares with EMMA:
  1. Download EMMA and install it
  2. Start EMMA and connect Your Device to USB (Flashmode)

3.1. Downloading Firmwares with XperiFirm:
  1. Download and extract XperiFirm from the link above
  2. Run XperiFirm and Download the right Firmware for Your Device


4. Bootloader Unlocking and Magisk Root:

Note: Since You are going to unlock Your Bootloader, You may surely want to get Root. So let's start with Magisk or it will take more Time afterwards...

  1. Download UnSin from the link above and extract it somewhere
  2. Download the "Platform Tools" from Google and extract it to the root of Your main Windows Drive
  3. Download and install the Magisk Manager on Your Android Device
  4. Extract the File boot_********.sin (60MB+ File) with the Unsin Exe (Drag and drop the Image on the Exe)
  5. You will get a .img File which You can patch now with the Magisk Manager on Your Android Device
  6. Open the Magisk Manager and Install Magisk by selecting the Image File You just got from UnSin
  7. Copy the magisk_patched.img in /download from Your Device to the Platform Tools Folder
  8. Grab Your Device again, go to "About Phone" in the Settings and tap several Times on the build Version
  9. Go now to the Developer Settings under "System" and enable "OEM-Unlock" and "USB-Debugging"
  10. Use now the Platform Tools with this Commands (In Powershell):
  11. Type now (Step by Step):
    Code:
    cd\
    cd platform-tools
    Note: To use the Platform Tools Folder as environment for Fastboot and ADB. Or hold Shift and Make a right Click in the Platform Tools Folder to open the Command prompt there...

  12. Type now:
    Code:
    adb reboot bootloader
    You will get a prompt on Your Xperia Device. Your Device will Reboot afterwards...

  13. Now Your Bootloader Unlock Code:
    Code:
    fastboot oem unlock 0xYOURKEY

  14. Wait for it... And type now:
    Code:
    fastboot reboot

  15. Wait for Your Device to Wipe and Start. Once in the Android System, turn Your Device off without USB Connected

  16. Press and hold now the VolumeUp (+) Button while connecting to USB to enable the fastboot Mode

  17. 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

  18. Wipe and Reboot:
  19. Code:
    fastboot -w
    fastboot reboot
    Note: Your are unlocked and rooted now! Enjoy Your Unleashed Device :)



5. GSI flashing with Fastboot:

Note: GSI ROMs can be found around the Web. Like here...
Not all GSIs require the vbmeta change. You can use all GSIs that are made for ARM64 + A/B Devices. Play around. Systems can't damage Your Device since You keep the Stock Vendor & Kernel! You can use any Android Version! Don't forget to make backups if needed. You are going to Format Your Device!

  • Download a GSI Zip from Google
  • Extract the system.img and the vbmeta.img to Your Platform-Tools
  • Connect Your Device in Fastboot Mode and use Fastboot with:
    (On 2020+ Xperias run: "fastboot reboot fastboot" first after You booted into fastboot)
    Code:
    fastboot flash system_a system.img
    fastboot flash system_b system.img
    [Optional] fastboot --disable-verity --disable-verification flash vbmeta_a vbmeta.img
    [Optional] fastboot --disable-verity --disable-verification flash vbmeta_b vbmeta.img
    fastboot -w (This does Format Your Device and is needed everytime You change the GSI!)
    fastboot reboot


6. Bootloader Re-Lock:
  • Flash the latest Firmware for Your Device with EMMA
  • Erase all Userdata before You continue (like with fastboot -w or via Recovery)
  • Just go into Fastboot mode and type in the command prompt (like before in this Guide):
Code:
fastboot oem lock
  • Wait for Your Device and disconnect it from USB
  • Done... Continue with Step 7.
7. Firmware Restoring after Re-Locking:
  • 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 almost all of Your DRMs are restored.



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


BTC: 3A93fjg2KxZJEHUpBExs7rVgivfAUumQoJ
ETH&ERC20-USDT: 0xD27860248B7E51720DDf9CA5a1f861CA1029c14A
ERC20: 0xD27860248B7E51720DDf9CA5a1f861CA1029c14A
 
Last edited:
Not one notice that this nulls your warranty........
You get this Info from SONY, and it just makes Sense... You don't have trouble if You can relock Your Device. So stop spreading random Infos like "nulls Your Warranty". No One here complains about that...
Screenshot_20211104-125521.png
 
which file i need from there for A 11

Basic knowledge for all Tech around the World before You continue with anything of this:

ARM = Mobile Chips
ARM64 = Mobile Chips with 64Bit Support
X86 = Desktop Chips like from AMD or Intel
X86_64 = You guessed it? Desktop 64Bit Chips...
GMS = Google Services or Google Apps

You want to use an Xperia Mobile Device with GMS?
ARM64 GMS... No GMS no Play Store...
 
  • Like
Reactions: DanielMode

DanielMode

Senior Member
Jan 26, 2017
242
24
i don't get it where i have to look for this sin file

3. Extract the File boot_********.sin with the Unsin Exe (Drag and drop the Image on the Exe)
 
i don't get it where i have to look for this sin file

3. Extract the File boot_********.sin with the Unsin Exe (Drag and drop the Image on the Exe)
Before Modding Your Device...
Download the Firmware for Your Model with Xperifirm. It will include everything that's needed. Including Your Way back to a working Device if You screw something...

I will edit the Threads soon with a hint for this. Sorry for the trouble!
 

DanielMode

Senior Member
Jan 26, 2017
242
24
already found it at patched too but was confusing buddy

to find at the main folder of downloaded FW from XperFirm
 
already found it at patched too but was confusing buddy

to find at the main folder of downloaded FW from XperFirm
To be honest with everyone, I don't have much time usually but I do my best to help out if I can! I have many Projects running and writing Guides isn't my Top Priority. But I will rework them ones more! Thank You for pointing out that part of the Guide! :)
 

DanielMode

Senior Member
Jan 26, 2017
242
24
so far so good, but now i'm getting nervis
after flashing patched boot.img i'm at this step now

PS C:\platform-tools> fastboot -w
erasing 'userdata'...
OKAY [ 39.720s]
formatting 'userdata' partition...

how long it takes to formating 'userdata' ??

i wait 30min already
 

DanielMode

Senior Member
Jan 26, 2017
242
24
looks like i messed it up

PS C:\platform-tools> fastboot -w
erasing 'userdata'...
OKAY [ 38.658s]
formatting 'userdata' partition...
Erase successful, but not automatically formatting.
File system type f2fs not supported.
OKAY [ 0.009s]
erasing 'cache'...
FAILED (remote: No such partition.)
finished. total time: 38.698s
PS C:\platform-tools>

how can i revive it now.??
 

DanielMode

Senior Member
Jan 26, 2017
242
24
k started all over again and now at this step again and waiting

formatting 'userdata' partition...

will see if its done when i get up tomorrow :rolleyes:
 

DanielMode

Senior Member
Jan 26, 2017
242
24
finaly i could flash latest FW with newflasher
but root wasn't there so
i flashed patched boot.img with fastboot again and i got root acces
was a bit of'n struggel but now its rooted

now i was trying die relock the bootloader...u said wipe userdata again and i did and got stuck there now

PS C:\platform-tools> fastboot -w
erasing 'userdata'...
OKAY [ 41.602s]
formatting 'userdata' partition...
Creating filesystem with parameters:
Size: 107809730560
Block size: 4096
Blocks per group: 32768
Inodes per group: 8192
Inode size: 256
Journal blocks: 32768
Label:
Blocks: 26320735
Block groups: 804
Reserved block group size: 1024
Created filesystem with 11/6586368 inodes and 461507/26320735 blocks
sending 'userdata' (144159 KB)...
writing 'userdata'...
 

mavicanuck

Member
Nov 24, 2021
16
2
Hi @Miustone ,
At the GSI flashing stage, I am getting an error.
fastboot flash system_a system.img
returns FAILED (remote: 'No such partition.')
I tried dropping the _a but that didn't help.
My eventual goal is to replace the MBN files following :https://forums.oneplus.com/threads/...ell-volte-and-vowifi-calling-working.1284987/

When I try to access su from adb shell, I just get a cursor that doesn't seem to execute commands. But doesn't give the error from before rooting. So I'm semi rooted?
 

Top Liked Posts

  • There are no posts matching your filters.
  • 1
    @Miustone

    bingo

    finaly....but not on Win 10
    for problems like this its always better to have your old Win 7 on backup partition.
    just to use it offline to root your newest device lol

    i don't no why but on Win 7 the driver installation worked perfekly automaticly and boom all adb commants ran through smothly
    '
    So I figured out how to install/select the fastboot driver in windows 11(xperia 5 IV for me).

    1 - unzip the usb driver folder then navigate to it (usb_driver_r13-windows)
    2 - right click the android_winusb.inf file and click install
    3 - boot the phone to fastboot mode
    4 - go to device manager in windows and find the Android device with the failed driver, right click and select update driver
    5 - select "browse my computer for drivers", then select "Let me pick from a list of available drivers on my computer"
    6 - scroll down and select "Universal Serial Bus Devices" then click next
    7 - under manufacturer select "WinUSB Device", then under model select "ADB Device". Click next
    8 - fastboot driver should be installed correctly. You may need to reboot the computer and boot the phone into fastboot mode again
  • 9

    Introducing this Guide

    Hello there and welcome to My Guide for Your Xperia Smartphone. This Guide will walk with You thru the whole Process of installing Drivers, getting an unlock Key for Your Bootloader, rooting with Magisk and even flashing GSI Custom ROMs up to re-locking Your Bootloader and re-flashing Stock for the total Factory Reset. This Thread/Guide is not meant as Wiki n'or will it teach You about Android at all. Inform Yourself using Google to enjoy the total Freedom and Customization of Android... If You can't solve Problems Yourself, by communicating and research, don't touch Your Bootloader!

    IMPORTANT:
    2020+ Xperias are using fastbootd, and equivalent to fastboot which runs in Userspace (Same as Recoveries).
    You can access Your Recovery on Your Xperia by holding VolumeDown (-) & the Powerbutton (Your Device needs to be turned off before ofc). Release the Powerbutton after the Display turned on and hold VolumeDown (-) until You see the Recovery Screen. From there, You can enter fastbootd and fastboot. Labled as "Fastboot" for fastbootd and "Bootloader" which is the old fastboot. You can flash Kernels, Recoveries and other stuff from fastboot. Everything else like System Images (GSIs for example), Product Images, System_ext Images and any Userspace stuff has to be flashed from fastbootd. 2019 Xperias are still using fastboot only...
    Fastboot and Fastbootd has nothing to do with SONYs Flashmode on Xperias!


    INDEX:
    1. Requirements
    2. Installing Drivers
    3. Firmware Flashing
    4. Bootloader Unlocking & Magisk Root
    5. GSI ROM flashing with Fastboot (Optional)
    6. Bootloader Re-Locking (TheWayBack)
    7. Firmware Restoring after Re-Locking

    1. Requirements:
    • Read! Inform Yourself about the Tools You use...
    • Xperia Basics:
      Your Device is turned Off...
      Blue LED=Fastboot (Hold VolumeUp (+) & Connect to USB)
      Green LED=Flashmode (Hold VoumeDown (-) & Connect to USB)
    • Windows 10/11 for Firmware flashing & downloading
    • Xperia Bootloader Unlock Key (From HERE)
    • Platform Tools alias ADB and Fastboot (From HERE)
    • Fastboot and Flashmode Drivers (From HERE and HERE)
    • EMMA for Firmware Updates (From HERE)
    • XperiFirm for Firmware Downloads (From XDA)
    • Unsin to extract the Kernel .sin from XperiFirm (From XDA)
    • Magisk Manager to patch the extracted Kernel .sin (From GitHub)
    • A working Android System for the Magisk Kernel patching
    • GSI & vbmeta Image (From Google) (Optional)
    • A Backup of Your Internal Devices Storage (Optional)


    2. Installing Drivers:
    1. Download the Drivers from the Links above and extract them
    2. Install the downloaded and extracted Drivers by right clicking on the ***.inf Files "Install"


    3. Flashing Firmwares with EMMA:
    1. Download EMMA and install it
    2. Start EMMA and connect Your Device to USB (Flashmode)

    3.1. Downloading Firmwares with XperiFirm:
    1. Download and extract XperiFirm from the link above
    2. Run XperiFirm and Download the right Firmware for Your Device


    4. Bootloader Unlocking and Magisk Root:

    Note: Since You are going to unlock Your Bootloader, You may surely want to get Root. So let's start with Magisk or it will take more Time afterwards...

    1. Download UnSin from the link above and extract it somewhere
    2. Download the "Platform Tools" from Google and extract it to the root of Your main Windows Drive
    3. Download and install the Magisk Manager on Your Android Device
    4. Extract the File boot_********.sin (60MB+ File) with the Unsin Exe (Drag and drop the Image on the Exe)
    5. You will get a .img File which You can patch now with the Magisk Manager on Your Android Device
    6. Open the Magisk Manager and Install Magisk by selecting the Image File You just got from UnSin
    7. Copy the magisk_patched.img in /download from Your Device to the Platform Tools Folder
    8. Grab Your Device again, go to "About Phone" in the Settings and tap several Times on the build Version
    9. Go now to the Developer Settings under "System" and enable "OEM-Unlock" and "USB-Debugging"
    10. Use now the Platform Tools with this Commands (In Powershell):
    11. Type now (Step by Step):
      Code:
      cd\
      cd platform-tools
      Note: To use the Platform Tools Folder as environment for Fastboot and ADB. Or hold Shift and Make a right Click in the Platform Tools Folder to open the Command prompt there...

    12. Type now:
      Code:
      adb reboot bootloader
      You will get a prompt on Your Xperia Device. Your Device will Reboot afterwards...

    13. Now Your Bootloader Unlock Code:
      Code:
      fastboot oem unlock 0xYOURKEY

    14. Wait for it... And type now:
      Code:
      fastboot reboot

    15. Wait for Your Device to Wipe and Start. Once in the Android System, turn Your Device off without USB Connected

    16. Press and hold now the VolumeUp (+) Button while connecting to USB to enable the fastboot Mode

    17. 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

    18. Wipe and Reboot:
    19. Code:
      fastboot -w
      fastboot reboot
      Note: Your are unlocked and rooted now! Enjoy Your Unleashed Device :)



    5. GSI flashing with Fastboot:

    Note: GSI ROMs can be found around the Web. Like here...
    Not all GSIs require the vbmeta change. You can use all GSIs that are made for ARM64 + A/B Devices. Play around. Systems can't damage Your Device since You keep the Stock Vendor & Kernel! You can use any Android Version! Don't forget to make backups if needed. You are going to Format Your Device!

    • Download a GSI Zip from Google
    • Extract the system.img and the vbmeta.img to Your Platform-Tools
    • Connect Your Device in Fastboot Mode and use Fastboot with:
      (On 2020+ Xperias run: "fastboot reboot fastboot" first after You booted into fastboot)
      Code:
      fastboot flash system_a system.img
      fastboot flash system_b system.img
      [Optional] fastboot --disable-verity --disable-verification flash vbmeta_a vbmeta.img
      [Optional] fastboot --disable-verity --disable-verification flash vbmeta_b vbmeta.img
      fastboot -w (This does Format Your Device and is needed everytime You change the GSI!)
      fastboot reboot


    6. Bootloader Re-Lock:
    • Flash the latest Firmware for Your Device with EMMA
    • Erase all Userdata before You continue (like with fastboot -w or via Recovery)
    • Just go into Fastboot mode and type in the command prompt (like before in this Guide):
    Code:
    fastboot oem lock
    • Wait for Your Device and disconnect it from USB
    • Done... Continue with Step 7.
    7. Firmware Restoring after Re-Locking:
    • 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 almost all of Your DRMs are restored.



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


    BTC: 3A93fjg2KxZJEHUpBExs7rVgivfAUumQoJ
    ETH&ERC20-USDT: 0xD27860248B7E51720DDf9CA5a1f861CA1029c14A
    ERC20: 0xD27860248B7E51720DDf9CA5a1f861CA1029c14A
    2
    Flash Firmware with newflasher ends in bootloop and "your device is corrupt"....
    How can i fix it?

    Edit: I Fixed it with set_active:a
    2
    no problems at all. apparently some DRM issues that may mean you can't watch Netflix in 4K (doesn't affect me at all), and that's about it.
    2
    Thanks for the great guide. This is my first Xperia device, and I'm loving it.
    Can I still perform OTA updates like normal using the OTA option in Magisk, or do I need to do the whole firmware patching process every time?
    Glad it helped You!
    You need to perform Manual Updates with NewFlasher every time. But You can keep Your Data. You Just need to Patch the new Boot Images after every Update...
    1
    which file i need from there for A 11

    Basic knowledge for all Tech around the World before You continue with anything of this:

    ARM = Mobile Chips
    ARM64 = Mobile Chips with 64Bit Support
    X86 = Desktop Chips like from AMD or Intel
    X86_64 = You guessed it? Desktop 64Bit Chips...
    GMS = Google Services or Google Apps

    You want to use an Xperia Mobile Device with GMS?
    ARM64 GMS... No GMS no Play Store...