[Sony Xperia S, Acro S, Ion] Gazzamit:
[Guide][XS] Root, unlock bootloader, partitions f2sf, resize 8Gb, flash Rom & Gapps

Roms should support f2fs file system (kernel boot.img) and recovery.img in FOTA space.

Please note that you will loose **ALL** data including sdcard following this guide.

BACKUP YOUR DATA FIRST (nandroid, titanium as required)

This guide modifies the phones partition table

YOUR PHONE COULD BE BRICKED BY INCORRECTLY CHANGING PARTITION TABLE.

==================================================================

I have an Xperia S Lt26i build number 6.2.B.1.96 that had never been rooted etc.

On reading forums (such an amazing resource) this was my procedure:

1. Install SDK and drivers

2. Root

3. Backup TA

4. Unlock bootloader

5. From rom flash recovery.img and boot.img

6. Resize for 8Gb data partition

7. Convert partitions apart from sdcard to f2fs

8. Install rom and gapps

(Xperia) Enabled USB debugging

(PC) Download Android SDK and install android sdk packages (for ADB)

Installed these packages to default location (no os api packages):

Tools > Android SDK Tools, Android SDK Platform-tools, Android SDK Build-tools

Extras > Android support library, Google USB driver

Add sdk platform tools and tools to windows path. In cmd.exe:

set PATH=%PATH%;C:\Users\%USERNAME%\AppData\Local\Andr oid\android-sdk\platform-tools\;C:\Users\%USERNAME%\AppData\Local\Android\a ndroid-sdk\tools\

(PC) Download and install flashtool (for drivers)

Install flashtool-drivers.exe and select:

Flashmode drivers

Fastboot drivers

Xperia X driver for ICS

Xperia S, Xperis NX, Xperia acro HD drivers (for GB)

(PC) Check driver install by connecting Xperia

Xperia should then appear in Windows file manager.

Check device manager for two entries (right click Computer and select manage):

1)Portable devices > Xperia S

2)Sony sa0103 > Sony sa0103 ADB Interface driver

For driver error - shows Lt26i or Xperia S - yellow with !

Right click Lt26i and select update driver

Selct to choose driver and navigate to sony sa0103 ADB Driver

Driver will install and Device manager will show Sony ADB interface driver.

(You may need to do this later in process as well)

(PC) Connect Xperia and Open new cmd.exe and type:

adb devices

This should show the serial of the connected Xperia follow by the word 'device'.

(PC) Root Xperis S (Root_with_Restore_by_Bin4ry_v36. Run and choose option 2 cubeundcube)

(Xperia) (TA backup is for bootloaders that have not been unlocked already. Allows restore to stock)

To Verify if Xperia bootloader can be unlocked

Enter *#*#service#*#* in dialer then select Service info > Configuration > Rooting Status.

Bootloader unlock allowed = Yes - you can unlock bootloader

If No, or if the status is missing, your device cannot be unlocked.

(PC) TA Backup method 1: (for never unlocked bootloader)

Download latest version Backup-TA-9.11

Extract the file to hard drive.

Run Backup-TA.bat

(Xperia) select allow root when prompted

(PC) Select 1 to backup

choose Y to perform extensive search

Backup TA (check for any error messages)

Check backup is on hard drive in ../Backup-TA/tools/backup

(PC) TA backup Method 2: (for never unlocked bootloader)

Open Flashtool and choose switch pro (file menu)

Advanced > Trim Area > backup

Backup Trim area will be stored in C:\Users\%USERNAME%\.flashTool\registeredDevices\x xxxxxxxx\rawta

(Xperia) Optional - Reset phone to Factory Status

(PC) Unlock bootloader

Get unlock code via sony unlock boot loader site

Power off Xperia and hold volume up and plug in USB cable (fastboot mode)

in cmd enter as per sony instructions:

fastboot devices (shows device is connected)

fastboot -i 0x0fce oem unlock 0xUNLOCK-CODE (unlocks bootloader)

Reboot device (press and hold power)

(Xperia) Enable USB debugging again

(PC) Need to flash recovery and kernel before reboot to TWRP

1) Flash recovery:

Download rom (must support f2fs and recovery in FOTA kernel space)

Extract recovery.img (tested with TWRP)

Connnect Xperia and copy recovery.img to sdcard

To flash recovery.img into FOTA kernel space:

In cmd.exe

adb shell

(Xperia) grant root access when prompted

su

dd if=/sdcard/recovery.img of=/dev/block/mmcblk0p11

Close cmd.exe

(DO NOT REBOOT DEVICE)

2. Flash kernel:

Extract boot.img kernel (from rom zip)

Open New cmd.exe and enter:

adb reboot-bootloader

fastboot flash boot C:\path to file\boot.img

fastboot reboot

**QUICKLY On Reboot click up to enter TWRP recovery

Swipe right to Allow Modifications in TWRP

(PC) Resize partitions for 8Gb Data partition rather than 2Gb

(PC) [Again, check device manager for ADB driver. If not update driver to sony sa0103 ADB driver - Browse, let me pick, sony sa0103]

(PC) open cmd.exe

(PC) adb devices [shows serial plus word 'recovery']

(PC) adb shell [starts shell on Xperia]

(TWRP) Unmount everything [mount, deselect all partitions]

(ADB SHELL) fdisk /dev/block/mmcblk0

(ADB SHELL/fdisk) p [prints partition table *]

(ADB SHELL/fdisk) d [delete...]

(ADB SHELL/fdisk) 15 [...sdcard partition]

(ADB SHELL/fdisk) d [delete...]

(ADB SHELL/fdisk) 14 [...data partition

(ADB SHELL/fdisk) n [new data partition]

(First cylinder) -> [enter partition 14 start cylinder - reference print of partition table]

(Last cylinder) -> +8192M [creates a 8gB partition]

(ADB SHELL/fdisk) p [print new table]

(ADB SHELL/fdisk) n [new sdcard partition]

(First cylinder) -> [enter start of sdcard partition. This is the end of partition 14 (just created) + 1. prob 292945+1=292946]

(Last cylinder) -> [press enter - auto selects last cylinder]

(ADB SHELL/fdisk) w [write changes - check for success]

(TWRP) disable MTP mode [mount, disable MPT]

(TWRP) Set sdcard partition to storage type vfat [wipe, advanced, select internal sdcard, Repair or change file system, Change file system, FAT, swipe right]

(TWRP) Wipe data and sdcard [Wipe, advanced, sdcard, Data, Swipe right- formats new partitions - check for no error messages]

(PC) Download gapps (arc, 5.1, nano)

(TWRP) Migrate all partitions on phone except sdcard to f2fs (faster operation):

(TWRP) Wipe, Advanced, System, Repair, Change File System, F2FS, Swipe Right.

(TWRP) Wipe, Advanced, Cache, Repair, Change File System, F2FS, Swipe Right.

(TWRP) Wipe, Advanced, Data, Repair, Change File System, F2FS, Swipe Right.

(TWRP) Enable mtp [mount, enable MTP]

(PC) Copy rom zip and gapps zip to sdcard

(TWRP) Install > choose rom zip from sdcard

(TWRP) add zip > choose gapps .zip from sdcard and Swipe right

(TWRP) wipe dalvik and cache

(TWRP) reboot to system and wait for first boot

Resources (huge thanks):

Root: http://xdaforums.com/show....php?t=1886460

Flashtool: http://www.flashtool.net/downloads.php

Unlock bootloader http://developer.sonymobile.com/unlo...urboot-loader/

Gapps: http://opengapps.org/

Rom AOSProm-5.1-b27.zip: http://xdaforums.com/xper...ria-s-t2958516

Backup-TA-9.11: https://github.com/DevShaft/Backup-TA/tags

Info gleaned from (huge thanks):

Increase partition sizze: http://xdaforums.com/xper...ition-t2821058

Migrate to f2fs: http://xdaforums.com/xper...-ext4-t3004755

Install rom guide: http://xdaforums.com/show...postcount=1002

NB: I tried using Rashr app - it said my device is not supported...