[Sony Xperia S, Acro S, Ion] djibe89:
[GUIDE/TUTORIAL/HOWTO] Sony Xperia S stock to Android 8.1 Oreo

[GUIDE/TUTORIAL/HOWTO] Upgrade Sony Xperia S (Model LT26i codename nozomi) from 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

*#*#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

v4. Moved to Bitgapps to solve infinite GApps "searching for updates", TWRP 3.5.2_9-0

v3. Android 7.1 if needed, hints to solve problems (error 7, fdisk -l)

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.2_9-0)

+ ROM nearAOSP 8.1 build 11: https://xdaforums.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

+ BitGApps Package ARM 8.1: https://github.com/BiTGApps/BiTGApps-Release/releases

+ You find Android 8.1 laggy ? Android 7.1.2/nAOSP is suitable https://androidfilehost.com/?fid=890129502657590583

Download according BitGApps.

+ Charge phone to 100%.

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

2) INSTALL USB 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:

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

*#*#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

cd /d thePathToFlashFolder

(ex: E:\root\djibe Sony Xperia S\djibe\flash)

Type:

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:

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 :

fastboot flash boot twrp-3.5.2_9-0-nozomi.img

. Confirm with Enter.

Wait, then once the confirmed success,

type :

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:

adb devices

Command returns: List of devices attached

CB511Z8FWJ recovery

adb shell

fdisk -l /dev/block/mmcblk0

### fdisk -l (this is letter L, not number 1)

Command returns

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

fdisk /dev/block/mmcblk0

Commands returns: Command (m for help):

Enter

p

Commands returns: Command (m for help):

Enter

d

Command returns: Partition number (1-15):

Enter

15

Commands returns Command (m for help):

Enter

d

Command returns: Partition number (1-15):

Enter

14

Commands returns: Command (m for help):

Enter

n

Command returns: First cylinder (769-954240, default 769):

Enter

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

t

Command returns: Partition number (1-14):

Enter

14

Command returns: Hex code (type L to list codes):

Enter

83

Commands returns: Command (m for help):

Enter

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.

### You get ERROR 7, Failed to mount '/system' etc.), try this fix: https://bit.ly/3BvcYvM

### Failed to mount '/system' error: https://bit.ly/3yF2jwX

14) PUSH ROM AND GOOGLE APPS

Go to Mount > make 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 bitgapps*.zip to gapps.zip

Make sure adb is still running with 'adb devices' command.

Now push the ROM to the phone with

adb push nAOSProm-8.1.0-b11-nozomi.zip /sideload

Then

adb push gapps.zip /sideload

15) 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 Reboot > Recovery

Go back to Install > select bitgapps*.zip > 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.

16) 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.25x.

Right below, you may try to switch Force GPU rendering On (default is off but feels slower, isn't it ?)

17) ROOT

nAOSProm has a built-in root.

No extra Root manipulation needed.

### DO NOT TRY MAGISK, you will have problems.

### If you run in troubles with Magisk, see the end of this tutorial.

Configure Android as you like.

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

You may try Greenify app to improve battery.

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:

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:

adb push build.prop /system/

Disconnect phone, go to Reboot > System.

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

### Tried Magisk and it doesn't work ? (we know it doesn't)

You can't access recovery because phone restarts as soon as it reboots.

Let battery drain by bootloop.

When it is exhausted, hold Volume+ and connect phone tu USB, blue light will appear (fastboot mode).

Unzip boot.img from nAOSProm-8.1.0-b11-nozomi.zip to /flash folder (along fastboot.exe).

Make sure fastboot is OK with

fastboot devices

Then

fastboot flash boot boot.img

And restart with

fastboot reboot

Phone is op.

Enjoy