Upgrade Xperia SP to AEX Oreo
This procedure shows how to install AEX (AOSP Extended) Oreo onto your Xperia SP. It assumes that:
- Your phone is rooted
- You have TWRP installed in your boot partition
- You have taken a backup of the boot, system and data partitions in TWRP and copied them off the phone
The procedure will guide you first through flashing TWRP to the FOTA partition. AOSP and derivatives support booting a recovery environment from the FOTA partition of Sony Xperia’s instead of requiring the recovery environment to be merged into the boot partition.
But before we begin. . .
Part of the process of upgrading your phone to AOSP Extended involves flashing TWRP to the FOTA partition. I have found that if you run a version of TWRP between v3.1.0 and v3.2.2 on the phone, even once, that the data (user) partition is no longer writeable by the stock Sony (Jellybean) version of firmware. To recover from this problem, I have had to reflash the entire phone from scratch using Flashtool with an FTF file.
TWRP 3.0.2 does not seem to cause this problem, so this is the only version of TWRP I would use for this process.
Flashing TWRP to the FOTA partition
On most Android phones, the recovery environment is stored in its own partition and can be activated when you Boot to Recovery or toggle keys at startup (usually the volume keys). Most Sony phones do not have a dedicated recovery partition and many Sony phones did not seem to have a stock recovery environment at all.
Although Sony do not use a Recovery partition on these phones, they do have a FOTA (firmware over the air) partition that is used to stage firmware upgrades that you download from Sony. Once you unlock the bootloader on your phone, the Sony OTA upgrades no longer work, so we can use the FOTA partition for our own purposes.
Although it is possible to flash TWRP directly to the FOTA partition, stock Sony firmware does not appear to recognise or boot from it, whereas AOSP (Android Open Source Project – vanilla Android before it’s customised by phone manufacturers) and AOSP derivatives will recognise TWRP in the FOTA partition and boot from it when asked. For this reason, we assume that we may have to merge TWRP into the boot partition again when we re-flash stock Sony firmware whereas we can change between different versions and editions of AOSP based Android without needing to do anything special to their boot partitions (as they will recognise and boot from TWRP in the FOTA partition).
If you have already flashed TWRP to your boot partition to work with your stock Sony firmware you could now easily flash TWRP 3.0.2 to your FOTA partition in case you wished to try loading AOSP onto your phone in future. I have loaded both Nougat and Oreo AOSP firmware on my Xperia SP but I kind of like the Xperia software so have gone back to stock Sony firmware.
Flashing TWRP to your FOTA partition.
- Copy TWRP 3.0.2 to a known folder (or root) on the SDcard of your Xperia SP. Read the warning at the top of this procedure if you’re thinking of flashing later versions of TWRP to your phone.
- Reboot into TWRP. https://kell.co.nz/tools/processes-and-procedures/reflash-sony-mobile-phone/rebuild-sony-xperia-sp/#how-to-boot-into-recovery
- Power off the phone then restart it. The LEDs at the bottom of the phone will light up green > cyan > red, then blue and vibrate. At this point tap the volume down key until the blue LED goes off. The LED bar will flash RED then the phone will boot into TWRP 2.6.3 (if you installed this as part of the stock rebuild of your phone). You could also run the script below by tapping the volume up key and during boot. Instead of glowing red, the LED bar will glow GREEN before booting into ClockWordMod.
- Select install from the TWRP menu and tap on the script you copied to the SDcard. TWRP will run the script and install TWRP 3.2 to your FOTA partition. It will sit there being ignored for as long as you use stock Sony firmware, but can be loaded as recovery if you choose to flash your phone to AOSP or a derivative such as AOSP Extended (which runs well on the Xperia SP).
Installing AOSP Extended Oreo on your Xperia
Now you have your phone working again, rooted and backed up.
Since my Xperia SP is a plaything I decided to try it with AOSP – both Nougat and Oreo. My Xperia SP runs better with AEX (AOSP Extended) Oreo than it does with the stock Sony firmware on Jellybean. If I made some time to get decent themes and the Sony Music Player back onto AEX I would definitely keep my Xperia running this software. I prefer AEX to AOSP as it has a few nicer touches, but under the bonnet they’re essentially identical so this guide works for both.
Anyway, if you want to try AOSP Extended on your Xperia SP, then here are my suggested steps:
- Download AOSP Extended 5.4 (Oreo) or StryFlex (Marshmallow) and copy it to the SDcard on your phone. If you’re into Gapps you can download a copy for Oreo and also add it to your SDcard.
- Boot your phone into TWRP and backup your boot, system and data partitions – enable compression to keep the backup small. This gives you a snapshot of your phone as it is now, including apps, contacts etc.
- Copy this backup to your computer via MTP (you don’t have to quit out of TWRP to do this).
- You’ve made your backup and copied it off the phone, right?
- Click on Install in the TWRP main menu and select the zip script for AEX. Run this. The script will replace stock Sony firmware in the system partition with AEX and replace the boot partition with code to boot AEX Oreo. If you’ve previously installed TWRP to the FOTA partition, this will now work if you tap the volume down key at boot time.
- When the script has finished, wipe the Dalvik, cache and data partitions to be safe (though the script probably does this). This will remove any artifacts on your phone from the stock Sony firmware, including user data.
- If you’re going to use them, install Gapps now before rebooting the phone.
- Reboot to the system and see how much more responsive Android is and how much longer your battery lasts.
- Find some themes to install in AEX before you die of boredom.
If you want to restore back to your stock firmware, then boot into TWRP and restore your backup (boot, system and data partition). Always wipe Dalvik, cache and data when you change OS unless you know what you’re doing.
That’s it. This page is done.