Sony is one of the few phone makers with an official bootloader unlock program, and the Xperia X Compact (F5321, codename kugo) is supported. Unlocking lets you install TWRP, root the phone and flash custom ROMs like LineageOS 20, which brings Android 13 to this 2016 phone.
This guide walks through the official method step by step, and covers the one big downside you should know about before you start.

Read this first: unlocking erases Sony’s DRM keys
On Sony phones, unlocking the bootloader permanently deletes the DRM keys stored in the phone’s TA (Trim Area) partition. Those keys are used by some Sony camera processing and by protected video playback, so after unlocking you may notice lower camera quality on stock firmware and lower-quality streaming in some apps. Relocking the bootloader later does not bring the keys back unless you made a TA backup before unlocking.
If the stock camera and DRM features matter to you, look into backing up the TA partition first. The methods depend on your firmware version, so check the Xperia X Compact section on XDA Forums. Unlocking also wipes all data on the phone and may affect your warranty.
What is a bootloader?
The bootloader is the first program that runs when you turn the phone on. It checks the software and starts Android. Sony locks it so only official software can run. Unlocking it lets you flash a custom recovery like TWRP, root the phone and install custom ROMs.
Before you start
- This guide is for the Sony Xperia X Compact F5321 only.
- Back up your data. Unlocking wipes the phone.
- Charge the phone to at least 60%.
- Install ADB and Fastboot and the Sony USB drivers on your PC.
- Write down your IMEI. Dial
*#06# or check Settings, then About phone, then Status.
GetDroidTips is not responsible for any damage to your device. Unlocking the bootloader erases your data and your DRM keys, and it can’t be fully undone. Proceed at your own risk.
How to unlock the bootloader on the Xperia X Compact
Step 1: Check that your phone can be unlocked
- Open the phone app and dial
*#*#7378423#*#* to open the service menu.
- Tap Service info, then Configuration, then Rooting status.
- If it says Bootloader unlock allowed: Yes, you can continue. If it says No, or the line is missing, your phone can’t be unlocked. This is common on carrier-locked models.
Step 2: Turn on OEM unlocking
- Go to Settings, then About phone, and tap Build number seven times to turn on Developer options.
- Go back to Settings, open Developer options, and turn on OEM unlocking and USB debugging.

Step 3: Get your unlock code from Sony
- Open Sony’s official unlock bootloader page.
- Select Xperia X Compact from the device list and continue.
- Enter your IMEI and accept the terms.
- Sony shows your unlock code. Copy it somewhere safe, because you’ll need it in the next step.

Step 4: Boot into fastboot mode
Turn the phone off. Hold Volume Up and connect the USB cable to your PC. The notification light turns blue when the phone is in fastboot mode.
You can also do this from Android with USB debugging on. Open a command window in your ADB folder and run:
adb reboot bootloader
Check that your PC sees the phone:
fastboot devices
Step 5: Unlock the bootloader
Run this command, replacing YOUR_UNLOCK_CODE with the code from Sony:
fastboot -i 0x0fce oem unlock 0xYOUR_UNLOCK_CODE
The phone unlocks and wipes itself. Then reboot it:
fastboot reboot
The first boot takes a little longer. Set the phone up again and turn USB debugging back on before you continue with installing TWRP.
Frequently asked questions
Is Sony’s unlock service still available?
Sony’s unlock page is still listed in its official support articles. If the Xperia X Compact no longer appears in the device list, the service may have changed, so check the Xperia X Compact section on XDA Forums for current advice.
Your phone’s carrier or region doesn’t allow unlocking. There’s no official way around this.
Can I relock the bootloader?
Yes, but it won’t restore the DRM keys unless you backed up the TA partition before unlocking. See our guide to relock the bootloader on Sony Xperia.
What should I do after unlocking?
Install TWRP and root the phone with our X Compact TWRP guide, or install LineageOS 20.
Im loss at no.2 . Im using a mac pro. i downloaded all the apps u stated but i still can see “tools” option in Andriod studio software. im stuck at point 12. do you have a youtube video of a step by step process?
appreciate much for you advise
12.Now Open the Extractor ADB and Fastboot folder and Open Command Window by pressing Shift Key + Right Mouse Click.