[Xperia SP General] TechnoSparks:
WARNING

SONY has recently changed the method to unlock a bootloader. This guide is now obsolete. Please follow only latest guide in the subforum. You have been warned

Welcome to customising your phone! I made this guide specifically for new Xperia SP users (be it secondhand phones or you're just starting to do more with your XSP), and for future references until our Xperia SP forum cease from existence. There are many things to learn, if you search in the forums. This guide is to simply guide you into doing stuff in a more verbosely explained manner, at the same time will always be kept updated along with the progress of our Xperia SP. :D

This guide is universal — you can use any ROM versions that you like!**

"Universal Guide" Notice **

This guide mentioned "flashing custom ROMs". Though this guide is legitimate as it gets for flashing a ROM, I must warn you that methods provided here are exclusively a general outlook on how to flash a ROM. Always use the extraneous methods provided within a custom ROM's thread. If you fail to meet the exclusive requirements and steps of a ROM you will obviously encounter problems!

Disclaimer

Before you proceed, please understand that everything you do with your device, has many risks. If performed correctly, those terrible consequences may not happen. Any actions you will make are solely decided by yourself, and I have nothing to do with any damages that occur when you follow this very guide. Most importantly, following this guide will definitely void your warranty.

NOTE!

This post relies entirely on heavy formatting so you can understand better. Please open this post in a web browser, if you are viewing from a forum app. Tapatalk, for example. This also includes XDA Labs, which as of writing doesn't parse forum tags properly.

Things to consider before using Custom ROMs for your Xperia SP

Bootloaders

There are two different requirements for each custom ROMs here in the Xperia SP forum, in which there is one that require an unlocked bootloader and another is the one that can be used in a locked bootloader. What is a bootloader? A bootloader is a tiny program that enables you to get into an Operating System. Xperia phones have their bootloader locked by default. The one and only difference between a locked bootloader and an unlocked bootloader is the freedom to flash anything without so much concerns and risks of soft-bricking the device. In worse case scenario, even hard-brick too.

The choice to unlock your bootloader will be made by yourself. This guide will present on how to flash custom ROMs regardless of what bootloader you choose. NOTE however, some Xperia SPs are not allowed to unlock the bootloader. To check if you can unlock your bootloader, dial *#*#SERVICE#*#* (*#*#7378423#*#*) in Dialer. Tap on Service info > Configuration > Rooting Status and check if you can unlock your bootloader. The text "Bootloader unlock allowed: Yes" means that you can unlock the bootloader of your Xperia SP. If "No", I am sorry to say but you cannot do anything to unlock the bootloader. Don't worry yet! You can still use a special type of custom ROMs on a locked bootloader ;)

Unlocking the bootloader will indeed have some drawbacks.

This will remove your DRM keys from your TA partition.

You will lose Bravia Engine on stock ROM forever. This due to the fact that the Bravia Engine requires the DRM keys that resides in your TA partition. This can be remedied, as you can actually back up your TA partition thus preserving your DRM keys as well!

Warranty will be lost for good. If you still have warranty, and quite paranoia if your device somehow magically broken, you also need to know that DRM keys also plays a huge role on confirming whether you have tempered with your Xperia SP's bootloader or not. SONY service centres will always check for the TA partition and also to see if your device is rooted or not. Root is reversible, but lost DRM keys is not. Again, backing up TA partition helps.

For those who can unlock their bootloader, since Xperia SP is no longer maintained officially by Sony and its last official ROM / firmware version is and will always be Jellybean 4.3, it is highly recommended to unlock your bootloader and set your Xperia SP for freedom. Unlocking the bootloader will also and always help you simplify things in the future.

Features

Custom ROMs are ROMs that are specifically made by different developers and teams based on their preferences and general idea. Depending on the custom ROM you want to use, you should understand that stock ROM features (e.g Camera, Walkman, Xperia Keyboard, Bravia Engine, etc) will no longer be available. This only applies on the custom ROMs that does not use the original stock ROM as a base.

Custom ROMs which are based on stock ROM on the other hand, usually contain a customised experience, while also providing the stock features to put into good use.

Stock ROM features aside, custom ROMs mostly are packed with other exciting features and customisations for you to tinker with, thus allowing you to make your ROM as unique to you as possible. You can inspect the screenshots posted on the ROM thread for a view of what features the ROM provides, or alternatively, (my favourite method) flash the ROM and test to see if it meets your preferences, and if the features really hook you up.

Explanation by another website (you will leave XDA)

Concluding

Now choose your device's future:

If you don't give a darn about TA partition, please refer to the guide

1(a)

. This can greatly reduce the hassle required while following this guide.

If you wish to both preserve your TA partition and unlock your bootloader, follow the respective guide which is guide

1(b)

.

If you don't want to or can't unlock your bootloader, there is also a guide for that, which is guide number

1(c)

.

Got questions? Refer to the second post for Q and As. If your question isn't there, feel free to ask! :)

Requirements!

Backup your apps. Use Helium backup tool. Do a backup of the apps that you want (only user-installed apps, or in other words, the apps that doesn't come with your Xperia SP when you bought it)

Un-metered and fast internet connection :eek:

A custom ROM's flashable zip of course. Copy the downloaded zip to your SD Card.

Download it by:

Going through the Xperia SP Lollipop Hub by @TheAvengingTITAN

Going through the Xperia SP Marshmallow Hub by @TheAvengingTITAN

Going to the custom ROM's thread of your choice in the Development subforum or the Original Development subforum

gapps package. Download the one supplied or suggested in the thread of the custom ROM of your choice. If there isn't any, maybe OpenGapps might be useful for you: http://opengapps.org (our device's architecture is ARM). Copy the downloaded zip to your SD Card.

Additional requirements if you want to unlock your bootloader:

Flashtool. Flashtool is a great software for you to flash your stock ROM back and also to do some other stuff. Download and install

Proper device drivers. After installing Flashtool, install the drivers by executing an installer from C:\Flashtool\drivers (assuming you didn't change the install location)

TWRP Recovery. We need the Beta downloads. Please download the twrp-3.0.X-rX-fota-huashan.zip. Copy the downloaded zip to your SD Card.

Unlocking the bootloader will wipe your /data partition. Please backup any files that you find important in the internal storage before performing these steps

Your IMEI written somewhere else. Dial *#06# to get your IMEI

Acceptable battery level (80% recommended)

Bootloader unlock code:

Go to: http://unlockbootloader.sonymobile.com/ and read everything!

At the bottom click 'Start Unlocking the Bootloader'

A number of prompts will be given. All you have to do is proceed (reading is optional and is recommended!)

Eventually you'll end up in the "Create Unlock request" page. From here enter your IMEI, name and email address. If your IMEI is unaccepted, try to enter your IMEI again, but excluding the last digit.

You should then receive the bootloader unlock key inside your email inbox.

1(a) I don't care about TA partition

WARNING: Once gone, you'll never able to retrieve your DRM keys, which will result in unable to use the Bravia engine, if someday, you wish to return to stock.

Just skip the guides below and jump to guide number

2

.​

1(b) I wish to both backup TA partition and unlock my bootloader

A working adb bridge is required before you proceed. Install it on your computer from here

Make sure USB Debugging is enabled in Settings > Developer Options

Root your 4.3 ROM with Towelroot!

Download and install the Towelroot apk

Open the newly installed app

Hit the make it rain button

After succession, go to Play Store and install SuperSU

Open SuperSU

It will prompt to update your binary. Continue to do so

It will prompt and ask you to choose which method to update the binary. Choose "Normal"

Reboot your device

Backup your TA Partition. NOTE! You can do a "dry-run" to determine the integrity of your backup. NOTICE! If you are a Windows 10 user, do note that you will need to apply this "patch" for BackupTA to work on your operating system

Follow guide number

2

.

1(c) My bootloader is not unlockable / I don't want to unlock the bootloader

A working adb bridge is required before you proceed. Install it on your computer from here

Make sure USB Debugging is enabled in Settings > Developer Options

Root your 4.3 ROM with Towelroot!

Download and install the Towelroot apk

Open the newly installed app

Hit the make it rain button

After succession, go to Play Store and install SuperSU

Open SuperSU

It will prompt to update your binary. Continue to do so

It will prompt and ask you to choose which method to update the binary. Choose "Normal"

Reboot your device

Install CWM recovery

Reboot into CWM recovery by pressing the Camera button whilst on the BLUE light on the LED bar

You can navigate in CWM by using the volume and power keys or by swiping the screen up, right, down, left.

Wipe everything you can.

go to "Mounts and storage"

Format /system

Format /data

Format /cache

Go back to main menu

Get into "Advanced" > "Clear Dalvik Cache"

Go back to main menu

Attempt "Wipe data/factory reset"

Flash the custom ROM zip you've downloaded.

Go to "Install zip"

Choose "Choose zip from /storage/sdcard1" (I am assuming you've put the zip into your SD card)

Navigate to the zip you've copied, and select it

Choose "yes"

Flash gapps. The flashing process is similar to how you flashed the custom ROM zip based on the steps above.

Reboot the phone

You now have your preferred custom ROM installed! Congratulations! Set up your phone as usual now.

Restore your applications backup if you wish to have your apps back.

Your steps end here.

Now jump to the "Have fun" part to continue reading :D

2) Unlock the bootloader and flash TWRP recovery

Unlocking your bootloader:

Shut your phone down.

Open FlashTool as administrator.

Copy your unlock bootloader key that you received

Make sure drivers are installed. Install them by going to Flashtool install directory (default is C:\Flashtool) and then "drivers" folder. Install the .exe there in.

Click BLU on the toolbar

Connect your phone in flash mode (hold down vol down while device is powered off then connect to your computer. you can release vol button once phone is detected)

This will require you to enter IMEI and bootloader unlock key. You might need to check thrice for this to make sure the IMEI and bootloader unlock key is correctly copied.

Proceed. This will wipe your data completely. I've warned about this earlier on this post so I assume you've did a backup of important files.

Disconnect your phone upon completion. If it restarts, you need to shut it down after it booted.

Leave Flashtool open in order to proceed to the steps below.

Flashing the recovery:

Extract the TWRP recovery zip file you attained earlier. We will need to use the "twrp.img" file

Connect your phone in fastboot mode (hold down vol up while device is powered off then connect to your computer. you can release vol button once phone is detected)

Flash the kernel by selecting the Lightning icon in the toolbar, select Fastboot mode, then select "Select Kernel to Flash". Navigate to and choose the file "twrp.img" extracted earlier

Unplug your phone upon completion

Power up your phone. It will boot directly into TWRP Recovery

Once in recovery, you may now close Flashtool.

Please follow the guide below.

NOTE!​

This will only grant you temporary access to recovery, as we are flashing the recovery into your /boot partition. When you flash the ROM zip later, this partition will be replaced with the ROM's kernel and the recovery will be lost!​

3) Flashing the custom ROM

NOTE: Please understand methods are vary for different ROMs. Please prioritise steps provided in a custom ROM thread. This guide however, can be regarded as a "logic" for you to flash such custom ROM.

Wipe everything you can.

go to "Wipe"

Advanced Wipe

Tick Dalvik / ART Cache, System, Cache, Data

Slide the slider to wipe the ticked partitions

Go back to main menu

Flash the zips you've downloaded.

Go to "Install"

Tap on "Select Storage" button to select your storage that contains the flashable zip of your ROM and gapps. Assuming you put it in the sdcard, then it should be "Micro SDCard"

Navigate to the ROM zip, and select it

After that, hit the button "Add more Zips"

Navigate to the gapps zip, and select it

Make sure "Zip file signature verification" is disabled

Optional: You might want to flash the TWRP recovery zip downloaded earlier so that you would have a permanent TWRP recovery

Slide the slider to start flashing process

Choose "Reboot system"

You now have your preferred custom ROM installed! Congratulations! Set up your phone as usual now.

Restore your applications backup if you wish to have your apps back.

Your steps end here.

Have fun

You should now have completed the guide and have a custom ROM running on your device. Have fun with numerous new experiences in the time to come!

If you want to change ROMs in the future, after you have already flashed a custom ROM, you will just have to restart the same flashing procedure. :)

Don't forget to thank this post if my guide really helped you! :D