[GUIDE/TUTORIAL/HOWTO] Sony Xperia S stock to Android 8.1 Oreo

djibe89

Senior Member
May 24, 2014
598
366
83
[GUIDE/TUTORIAL/HOWTO] Sony Xperia S stock to Android 8.1 Oreo
[GUIDE/TUTORIAL/HOWTO] Sony Xperia S (Model LT26i codename nozomi) Android 2.3.7 to Android 8.1 Oreo / nAOSP Rom

This detailed step-by-step guide helps you transform your Sony Xperia S to a much fresher one with Android 8.1 Oreo.

To make sure you are with a compatible Xperia S:
On the smartphone, go to Settings > About phone. Check that "Model number" is correct: LT26i.

### We need to make sure Bootloader can be unlocked before going further.
Open dialer, enter code
Code:
*#*#7378423#*#*
In the follow menu, go to Service info > Configuration > Rooting status.
Bootloader unlock allowed: Yes
If it is set on No, you cannot update your device. You can quit this tutorial and cry, you will never unlock it.

### You must be logged as a Microsoft Windows administrator to run console commands below.


CHANGELOG -------------------

v2. Slight tutorial improvements
v1. Initial release


1) DOWNLOAD FILES

- djibe Xperia S pack: https://bit.ly/djibe-xperias-pack
(contains FlashTool Xperia Driver Pack 1.8 for USB drivers + fastboot/adb + recovery TWRP 3.5.0_9-0)

+ ROM nearAOSP 8.1 build 11: https://forum.xda-developers.com/t/rom-8-1-naosprom-for-xperia-s-acro-s.3853082/
Download latest build (2020/03 or newer): https://androidfilehost.com/?w=files&flid=240525&sort_by=date&sort_dir=DESC

+ OpenGApps ARM 8.1 Pico (Micro or Nano are OK): https://opengapps.org/?arch=arm&api=8.1&variant=pico

+ Charge phone to 100 %.

NB. Use a USB2 port to connect tablet to PC.


2) INSTALL DRIVERS

Commands below are for Windows 10 installation of unsigned drivers.
### For other Windows versions, Google "windows X install unsigned driver".

On the keyboard of PC, use "Windows key + R" combo.
In the command prompt that opens, type:
Code:
shutdown -r -t 0 -o
This opens a Windows menu:
Go to Troubleshooting > Advanced Options > Settings > Restart
Upon restart, press on keyboard : key 7 - Disables drivers signature verification

After boot,
Start Flashtool Xperia Driver Pack 1.8,
check the Flashmode Drivers, Fastboot drivers, Common drivers Fuji board (both lines) and Xperia S driver for ICS.
Start the installation and confirm the forcing the driver installation.
It ends by saying that everything was installed.

Restart Windows.


3) BACKUP ALL YOUR DATA

Backup every SMS, photo, app login or sync everything in the cloud.
You will lose everything, including what is contained in the microSD card during bootloader unlock.
So backup everything and transfer every file to your computer.

### Do it now or you will regret it.


4) IMEI NUMBER AND UPDATES

On phone, go to Settings > About phone > Status > IMEI
Note the IMEI (15 digits). Store it.


5) MAKE SURE PHONE IS NOT SIMLOCKED

We need to check phone is not SIMlocked.

Open dialer, enter code again
Code:
*#*#7378423#*#*
Go to Service info > SIM lock. If everything is blank/unchecked ( [] ), phone is Desimlocked.
If not, you must contact your network provider for an unlock code.

### Don't move further until phone is simlocked. You cannot debrand/desimlock it using a custom ROM.


6) GENERATE BOOTLOADER UNLOCK CODE

From your PC, go to https://developer.sony.com/develop/open-devices/get-started/unlock-bootloader/
At the bottom of the page, in "Select your device:" menu: select Xperia S.
Enter your IMEI, check first 2 checkboxes "I acknowledge that", click Submit and complete the captcha to generate unlock key.
Note the unlock code (beginning and end of page paragraph C.)


7) CONNECT PHONE IN FASTBOOT MODE

Phone powered off, hold "Volume up" while you plug phone in USB.
The blue light appears at the front bottom edge, the drivers install in Windows.


8) UNLOCK BOOTLOADER

In Windows, copy the path to the "flash" folder you unziped earlier.
Open a Windows command prompt : Start menu > Command prompt > Start as administrator
Then type
Code:
cd /d thePathToFlashFolder
(ex: E:\root\djibe Sony Xperia S\djibe\flash)
Type:
Code:
fastboot devices
If "PSDN:..." is returned, drivers are correctly installed.

Create this text: fastboot -i 0x0fce oem unlock 0xAPPENDYOURUNLOCKCODEAFTER0x

Paste the previous line in windows command:
Code:
fastboot -i 0x0fce oem unlock 0xAPPENDYOURUNLOCKCODEAFTER0x
confirm with Enter.
After 5 seconds, it is displayed Finished. Total time: ...
Bootloader is unlocked !


9) FLASH TWRP RECOVERY 3.5

Still in fastboot, type in console :
Code:
fastboot flash boot twrp-3.5.0_9-0-nozomi.img
. Confirm with Enter.
Wait, then once the confirmed success,
type :
Code:
fastboot reboot
(confirm with Enter).
Be fast to disconnect phone AND while it restarts, repeatedly click Volume+ AND Volume- buttons to access the recovery (can take a while).

Reconnect phone to PC once recovery has started.


10) BACKUP ORIGINAL ROM AND USE TWRP RECOVERY

You are now in TWRP recovery,
check Never show this screen during boot again and Swipe to Allow modifications.

Go to Backup, select all partitions.
Confirm with OK.
Then swipe to start backup.
Click the TWRP icon to return to home.

Go to Mount. Select Data partition and make sure bottom right button is dsiplaying Disable MTP text.
Phone must be connected to computer.
In Windows Explorer, open Xperia S device > Internal Storage.
Copy whole TWRP folder and save it somewhere safe on your PC.
In the opposite way, copy twrp.img and paste it in the same phone's folder you grabbed TWRP folder (SDcard root folder).


11) FLASH A PERMANENT TWRP RECOVERY

The TWRP recovery you are using is temporary.
We need to flash it on a partition.

Back to TWRP Home screen > Install > Install Image button > twrp.img > Select boot partition > Swipe to flash.


12) REPARTITION INTERNAL MEMORY

Newer Android versions changed the partition layout. We have to do so.

Back to TWRP Home screen > Mount.
Deselect ALL partitions.
You can copy-paste commands with right click in the Windows command.

From Windows command, type following commands:

Code:
adb devices
Command returns: List of devices attached
CB511Z8FWJ recovery

Code:
adb shell
Code:
fdisk -l /dev/block/mmcblk0
Command returns
Code:
4 heads, 16 sectors/track, 973824 cylinders
Units = cylinders of 64 * 512 = 32768 bytes

              Device Boot      Start         End      Blocks  Id System
/dev/block/mmcblk0p1               1          65        2048  f0 Linux/PA-RISC boot
Partition 1 does not end on cylinder boundary
/dev/block/mmcblk0p2   *          65          81         512  4d Unknown
Partition 2 does not end on cylinder boundary
/dev/block/mmcblk0p3             129         768       20480  48 Unknown
Partition 3 does not end on cylinder boundary
/dev/block/mmcblk0p4             769      954240    30511104   5 Extended
Partition 4 does not end on cylinder boundary
/dev/block/mmcblk0p5             785         800         512  46 Unknown
/dev/block/mmcblk0p6             833         928        3072  4a Unknown
/dev/block/mmcblk0p7             961        1056        3072  4b Unknown
/dev/block/mmcblk0p8            1089        1184        3072  58 Unknown
/dev/block/mmcblk0p9            1217        1376        5120  70 Unknown
/dev/block/mmcblk0p10           1409        1664        8192  83 Linux
/dev/block/mmcblk0p11           1665        2176       16384  f0 Linux/PA-RISC boot
/dev/block/mmcblk0p12           2177       34944     1048576  83 Linux
/dev/block/mmcblk0p13          34945       42944      256000  83 Linux
/dev/block/mmcblk0p14          42945      108480     2097152  83 Linux
/dev/block/mmcblk0p15         108481      954240    27064320   c Win95 FAT32 (LBA)
~ #
### Copy all the text of the partition layout to be able to reformat in case of a crash.
### Paste this text in a file somewhere safe on your PC.

We are interested by line /dev/block/mmcblk0p14, Start sector: 42945 in my case,
And /dev/block/mmcblk0p15 End sector: 954240 for me.
### These values may differ for you. USE YOUR OWN VALUES.

Now type
Code:
fdisk /dev/block/mmcblk0
Commands returns: Command (m for help):
Enter
Code:
p
Commands returns: Command (m for help):
Enter
Code:
d
Command returns: Partition number (1-15):
Enter
Code:
15
Commands returns Command (m for help):
Enter
Code:
d
Command returns: Partition number (1-15):
Enter
Code:
14
Commands returns: Command (m for help):
Enter
Code:
n
Command returns: First cylinder (769-954240, default 769):
Enter
Code:
42945
(Your /dev/block/mmcblk0p14 Start sector)

Command returns: Last cylinder or +size or +sizeM or +sizeK (42945-954240, default 954240):
If "default 954240" is the same as your /dev/block/mmcblk0p15 End sector, just press Enter.

Commands returns: Command (m for help):
Enter
Code:
t
Command returns: Partition number (1-14):
Enter
Code:
14
Command returns: Hex code (type L to list codes):
Enter
Code:
83
Commands returns: Command (m for help):
Enter
Code:
w
And let command return to its waiting state: ~ #

We must restart phone now, unplug USB and from TWRP go to Reboot > Recovery for a refresh of partition table.

### Your TWRP recovery is not compatible with new partition layout.


13) FORMAT PARTITIONS TO F2FS

nAOSP Rom doesn't support EXT4 filesystem. We need to repartition to F2FS, easily with TWRP.

### If you experience errors while flashing like "Unable to mount storage", use TWRP 3.2.3 instead: https://androidfilehost.com/?fid=1322778262904003720

Check Never show this screen during boot again and Swipe to Allow modifications.

Back to TWRP Home menu.
Go to Wipe > Wipe Advanced > Select Data > Repair or Change File System > Change File System > F2FS.
Repeat same procedure for Cache partition.

We must restart phone now, go to Reboot > Recovery for a refresh of partition table.
### If you don't, you won't be able to flash zipfiles.

After reboot, Swipe to Allow modifications.

### If you still see 0MB or a wrong size for data after the reboot, try to format data (Wipe/Format Data).
### In the worst case, convert data to ext4 and convert back to f2fs will do the job.


13) PUSH ROM AND GOOGLE APPS

Go to Mount > mamke sure nothing is mounted.

Connect phone to PC with USB.
Copy downloaded ROM and Google Apps to your /flash folder (along adb.exe and twrp.img).
Rename open_gapps-arm-8.1-*.zip to gapps.zip
Make sure adb is still running with adb devices.

Now push the ROM to the phone with
Code:
adb push nAOSProm-8.1.0-b11-nozomi.zip /sideload
Then
Code:
adb push gapps.zip /sideload

13) INSTALL ROM AND GOOGLE APPS

Go back to TWRP Home menu.

Go to Install > You are in /sdcard empty folder.
Tap on (Up a level) > sideload.

Select nAOSProm > Swipe to flash.
Wait during "Install Zip".

Then gapps > Swipe to flash.
## Problems flashing ? Use TWRP 3.2.3-0: https://eu.dl.twrp.me/nozomi/twrp-3.2.3-0-nozomi.img.html

At the end, tap on Wipe Cache/Dalvik and Swipe to wipe.
Then tap on Reboot system.

Wait during long first boot.

Enjoy your new phone.


14) BETTER PERFORMANCES

Go to Settings > About phone.
Tap 7 times on Build number.
Go to Settings > System > Developer options.
Set Windows animation scale, Transition animation scale and Animator duration scale to 0.5x.
Right below, you may try to switch Force GPU rendering Off or On. Test it.


15) ROOT

nAOSProm has a built-in root.
No extra Root manipulation needed.

Configure Android as you like.

For faster GPS fix, use GPS Status and Toolbox and download A-GPS data.


Your phone is up to date, enjoy ;-)

Thanks: @millosr, @mickybart, @AdrianDC, TWRP team, OpenGApps team, Flashtool Xperia Driver pack team

-----------------------------------------------------------------------

Android doesn't see Wifi channel 14 (or 13),
Your phone doesn't see your local Wifi network?
You are probably european and your wifi is set to channel >= 11.

Reboot to TWRP recovery.
Go to Mount > check System partition.
Open a Windows command like before:
Code:
adb pull /system/build.prop
Edit file with Notepad++ freeware.
Locate line: ro.wifi.channels=
Change it to: ro.wifi.channels=14
Add this line just below: ro.boot.wificountrycode=EU
Save file.
Send modified file to phone:
Code:
adb push build.prop /system/
Change file permissions with
Code:
adb shell
cd system
chmod 644 build.prop
Reboot phone.
Enjoy
 
Last edited:

TXUTXI72

Senior Member
Feb 27, 2016
188
20
38
Thank you very much for this detailed guide. I have two questions:
1) Why do you recommend to flash version 2.3.7 of Android before beginning this procedure?
2) Everytime I have Flashed nAOSProm-8.1.0-b11-nozomi.zip on my phone (folllowing the original guide), I've had a very annoying bug, which is that it's really difficult to answer a phone call (I have to swipe the phone icon up several times until it finally rsponds). Of course I have always made a totally clean flash of the rom. Do you know what the reason for this can be?
 

djibe89

Senior Member
May 24, 2014
598
366
83
Thank you very much for this detailed guide. I have two questions:
1) Why do you recommend to flash version 2.3.7 of Android before beginning this procedure?
2) Everytime I have Flashed nAOSProm-8.1.0-b11-nozomi.zip on my phone (folllowing the original guide), I've had a very annoying bug, which is that it's really difficult to answer a phone call (I have to swipe the phone icon up several times until it finally rsponds). Of course I have always made a totally clean flash of the rom. Do you know what the reason for this can be?
Hi,

1) By precaution. For some phones you have to flash latest firmwares which upgrade bootloaders. We never know and there is no information about this. Just precaution.
2) I will test it.
Have you tried another call app ? That's the benefit of Android.
 

TXUTXI72

Senior Member
Feb 27, 2016
188
20
38
Hi,

1) By precaution. For some phones you have to flash latest firmwares which upgrade bootloaders. We never know and there is no information about this. Just precaution.
2) I will test it.
Have you tried another call app ? That's the benefit of Android.
Hi again! Thanks for answering.
First of all, 2.3.7 was not the last firmware for Sony xperia s, but the first one. The last one was Jelly Bean (4.1.2, or something like that, as far as I remember). So I am confused by your answer.
Secondly, yesterday I flashed again nAOSProm-8.1.0-b11-nozomi.zip, and this time I didn't get that annoying bug related to the phone app. Why? Well, there are two possible reasons:
1) This time I Flashed TWRP the way you tell in your guide. I used to do it via Flashtool.
2) I have used Nano Gapps instead of Pico Gapps.

Another thing I would like to tell you, is that yesterday it was impossible for me to flash the rom with the official TWRP (the one you recommend). I had to use TWRP 3.2.3, the version the developer of this rom recommends. It is something I don't understand: Why does the official TWRP work for you, while it doesn't for me?
Thank you very much again for all your help. I am pretty much interested in bringing to life again this old phone. What I really like about Xperia S is its small size :)
Now I am going to try to flash the rom again, because, although it works correctly, I cannot reboot into recovery :(
Cheers!
 
Last edited:

djibe89

Senior Member
May 24, 2014
598
366
83
Hi again! Thanks for answering.
First of all, 2.3.7 was not the last firmware for Sony xperia s, but the first one. The last one was Jelly Bean (4.1.2, or something like that, as far as I remember). So I am confused by your answer.
Secondly, yesterday I flashed again nAOSProm-8.1.0-b11-nozomi.zip, and this time I didn't get that annoying bug related to the phone app. Why? Well, there are two possible reasons:
1) This time I Flashed TWRP the way you tell in your guide. I used to do it via Flashtool.
2) I have used Nano Gapps instead Pico Gapps.

Another thing I would like to tell you, is that yesterday it was impossible for me to flash the rom with the official TWRP (the one you recommend). I had to use TWRP 3.2.3, the version the developer of this rom recommends. It is something I don't understand: Why does the official TWRP work for you, while it doesn't for me?
Thank you very much again for all your help. I am pretty much interested in bringing to life again this old phone. What I really like about Xperia S is its small size :)
Now I am going to try to flash the rom again, because, although it works correctly, I cannot reboot into recovery :(
Cheers!
Hi,

Sorry for my late replay.

Sorry for the 2.3.7 version. When i tried to force updates nothing came out so I thought it was the last one. I will remove comments on version.

For the Recovery, everything went fin with latest version. However, with 3.4+ TWRP, every time you wipe a partition you must reboot recovery before flashing.

I'll put a comment for those who have problems flashing.

And now I must add the Magisk tuto.
 
  • Like
Reactions: TXUTXI72

haktug

Member
Mar 29, 2020
15
2
3
Hi,

Sorry for my late replay.

Sorry for the 2.3.7 version. When i tried to force updates nothing came out so I thought it was the last one. I will remove comments on version.

For the Recovery, everything went fin with latest version. However, with 3.4+ TWRP, every time you wipe a partition you must reboot recovery before flashing.

I'll put a comment for those who have problems flashing.

And now I must add the Magisk tuto.
Flashing Rom and Gapps over adb gives an insufficient space error. I first install Rom and then install Gapps.
 

bkokkinos

Member
Feb 9, 2021
5
1
3
after writing the partition layout and formating /data and /cash the only i get whatever i try to do is "Unable to mount storage". SDCard partition is marked as no present and on "Select Storage" button the only i get is "SDCard (0MB)". and that lets me do NOTHING at all. i tryied everithing i cant get over it, dispite my every step in this guide were presice... please somebody help...
 

haktug

Member
Mar 29, 2020
15
2
3
after writing the partition layout and formating /data and /cash the only i get whatever i try to do is "Unable to mount storage". SDCard partition is marked as no present and on "Select Storage" button the only i get is "SDCard (0MB)". and that lets me do NOTHING at all. i tryied everithing i cant get over it, dispite my every step in this guide were presice... please somebody help...
which version of twrp are you using?
 

bkokkinos

Member
Feb 9, 2021
5
1
3
which version of twrp are you using?
the one you provide ... 3.5.0.9.0 i think it is
i made the procedure multiple times and i formated many times both /data and /cashe and i return to my previous layout installed a random rom and tryied this repartition again with the same results....

unable to mount storage
SDCard (0MB)
on advanced wipe >SDCard >change file system > Present:No
 
Last edited:

haktug

Member
Mar 29, 2020
15
2
3
the one you provide ... 3.5.0.9.0 i think it is
i made the procedure multiple times and i formated many times both /data and /cashe and i return to my previous layout installed a random rom and tryied this repartition again with the same results....

unable to mount storage
SDCard (0MB)
on advanced wipe >SDCard >change file system > Present:No
you should use twrp 3.2.3 on this link.

Downloads for : Sony Xperia S | AndroidFileHost.com | Download GApps, Roms, Kernels, Themes, Firmware and more. Free file hosting for all Android developers.
 

bkokkinos

Member
Feb 9, 2021
5
1
3
WWWOOOOOOOOOOOOOOOOOWWWWWWWWWWW!!!!!!!!!!!!!
What did you do......????????!!!!
i just flashed twpr 3.2.3 and everything worked perfectly....!!!! How could just different version make such differance???? OOOUUUFFFFFF i can't believe it... my two days headache is gone... THANK YOU Very Much!!!
 
  • Love
Reactions: haktug

l3mu3l

New member
Oct 10, 2012
1
0
21
Hello,
Good day! I was stuck at step 13) INSTALL ROM AND GOOGLE APPS

It says,
"Updater process ended with ERROR: 7 error installing zip file 'sideload/nAOSProm-81.0-b11-nozomi.zip'
Failed to mount '/system' ".

I used TWRP 3.2.3-0.

Thank you...
 

TXUTXI72

Senior Member
Feb 27, 2016
188
20
38
Hello,
Good day! I was stuck at step 13) INSTALL ROM AND GOOGLE APPS

It says,
"Updater process ended with ERROR: 7 error installing zip file 'sideload/nAOSProm-81.0-b11-nozomi.zip'
Failed to mount '/system' ".

I used TWRP 3.2.3-0.

Thank you...
I don't know if I can really help you, but I would recommend you to use the links provided by the author of the rom himself. For instance, the author of this rom says clearly to use the following link in order to get the proper TWRP version: https://androidfilehost.com/?fid=1322778262904003720
Another important thing is in my opinion that the permanent twrp must be flashed into the fota partition, not in the boot partition. In my case, everytime I flashed it into the boot partition, the device always rebooted into system and not into twrp.
And very important as well is to check if the repartition has been made correctly. Check out that the sd has about 28 gigabytes free after doing the repartition.
 

TXUTXI72

Senior Member
Feb 27, 2016
188
20
38
Hello,
Good day! I was stuck at step 13) INSTALL ROM AND GOOGLE APPS

It says,
"Updater process ended with ERROR: 7 error installing zip file 'sideload/nAOSProm-81.0-b11-nozomi.zip'
Failed to mount '/system' ".

I used TWRP 3.2.3-0.

Thank you...
By the way, I have just read someone who was getting error 7 while trying to install the rom, and he warns: MAKE SURE YOU DON'T CHANGE SYSTEM PARTITION INTO F2FS. Only Data and cache partitions must be changed into f2fs. Just in case it may help you...
 

haktug

Member
Mar 29, 2020
15
2
3
I don't know if I can really help you, but I would recommend you to use the links provided by the author of the rom himself. For instance, the author of this rom says clearly to use the following link in order to get the proper TWRP version: https://androidfilehost.com/?fid=1322778262904003720
Another important thing is in my opinion that the permanent twrp must be flashed into the fota partition, not in the boot partition. In my case, everytime I flashed it into the boot partition, the device always rebooted into system and not into twrp.
And very important as well is to check if the repartition has been made correctly. Check out that the sd has about 28 gigabytes free after doing the repartition.
ı agree. if it doesn't work, you're doing it wrong somewhere. You should do it again