[Xperia Z2 Tablet General] djibe89:
[GUIDE/TUTORIAL/HOWTO] Sony Xperia Z2 Tablet Stock to Android 11

[GUIDE/TUTORIAL/HOWTO] Sony Xperia Z2 Tablet (LTE/castor or Wi-Fi/castor_windy) Stock to Android 11 R / LineageOS 18.1

This detailed step-by-step guide helps you transform your Sony Xperia Tablet Z2 to a powerful one with Android 11.

Netflix, Disney+ and my bank app work as 2021/10/31, gestures navigation too.

BEFORE GOING FURTHER

- Make sure you are with a Xperia Tablet Z2

Go to Menu > Settings > About tablet > Model number is: SGP511 (16 GB), SGP512 (32 GB) or SGP521 (LTE, 16 GB).

- Make sure bootloader is unlockable

With LTE device, you can dial *#*#7378423#*#* > Service info > Configuration > Rooting Status

With Tablet Z2 Wi-Fi:

Open Contacts app > Menu button (3 dots vertical icon in top right corner) > Settings.

View attachment 5496745

Screen shows Accounts & Sync item.

Long press screen (10 seconds) right above the Home icon of bottom navigation bar and release to reveal Enter service code button.

View attachment 5496747

Tap on it and dial *#*#7378423#*#* to reveal Service menu > Service info > Configuration

Look at the Rooting status item: Bootloader unlock allowed: Yes

If No, you can cry, you cannot get further.

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

CHANGELOG

v3. Images to describe "Bootloader unlock allowed", fix flash:raw command and flash TWRP command

v2. Improve TWRP flash and boot, FTF stock ROM and backup

v1. Initial release

1) DOWNLOAD FILES

- djibe Xperia Tablet Z2 pack: https://bit.ly/djibe-xperia-tabletz2

(contains Tablet Z2 USB drivers + adb + fastboot + TWRP TWRP-3.4.0-sc-1 by SpiritCroc + Android 10 boot.img)

+ ROM LineageOS Unofficial 18.1 https://xdaforums.com/t/rom-unofficial-lineageos-18-1-for-castor-castor_windy.4261491/

Download latest build for LTE (castor) or Wi-Fi (SGP511 or SGP512/castor_windy): https://androidfilehost.com/?w=files&flid=321424&sort_by=date&sort_dir=DESC

See here if you prefer Official LOS 17.1: https://download.lineageos.org/castor

+ BitGApps Package ARM 11 (R44+): https://xdaforums.com/t/custom-gapps-bitgapps-for-android.4012165/post-81060605

Download latest build: https://github.com/BiTGApps/BiTGApps-Release/releases

+ a microSD card. Copy ROM (*_windy.zip for WiFi-only version), BitGApps, Magisk (optional) on microSD card and insert it in tab.

+ Charge tablet to 100%.

2) INSTALL DRIVERS

Right click on Windows Start menu > Device manager.

Right click on Computer's name (top of devices list) > Add legacy hardware.

Set folder's path of my Xperia_Z2_Tablet_driver_R2/ folder.

Click Next to install.

Reboot Windows.

3) IMEI NUMBER

On tablet, go to Menu > Settings > About tablet > Status > IMEI Information

Note the IMEI. Store it.

### With Wi-Fi variant, note the IDID

4) FIRMWARE NUMBER AND USB DEBUGGING

On tablet, go to Menu > Settings > About tablet > Build number

Make sure it is 23.5.A.1.291 and tap 7 times on it to unlock Developer options.

If not 23.5.A.1.291, go to Menu > Settings > About tablet > Software update > System updates tab

### Don't go further if you are not with 23.5.A.1.291 firmware.

Go to Menu > Settings > Developer options > USB debugging, switch it ON and confirm it in next Dialog.

5) 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: Select Xperia Z2 Tablet (for LTE) or Xperia Z2 Tablet WiFi

Enter your IMEI or IDID (see Chapter 3) + check both checkboxes after this.

Copy the unlock code.

### Some could advise you to backup TA, but who cares of Xperia features in 2021 (and long-gone warranty) ?

https://xdaforums.com/t/easy-guide-to-root-your-tablet-and-keep-your-warranty.2792056/

6) FASTBOOT MODE

Connect tab to USB.

Open the flash/ folder from my pack.

In Windows address bar, type "cmd" and hit Enter. A Windows Command window will open.

Now type

adb devices

Command returns: List of devices attached

YT91190206 unauthorized

If no Allow USB debugging? screen shows up on tab, disconnect and reconnect tablet.

Check ON always allow from this computer and tap on OK.

Enter command:

adb reboot bootloader

Tablet restarts and a blue light appears in top right corner.

Go back to Windows Device Manager.

Z2 tablet has a yellow triangle in Mobile devices and is called S1Boot Fastboot.

Right click on it > Update driver > Browse my computer for drivers > Choose from a list > Force Sony sa0111 ADB Interface Driver (at the bottom of the list).

(https://www.sony.co.uk/electronics/support/articles/SX278901)

Now you can enter command:

fastboot devices

Command returns: YT91190206 fastboot

7) UNLOCK BOOTLOADER

### All data will be lost

Fill the command with your Unlock Code:

fastboot oem unlock 0xYOURUNLOCKKEY

confirm with Enter. After 10 seconds, it is displayed OKAY.

Bootloader is unlocked !

8) FLASH TWRP RECOVERY 3.4

Still in fastboot, type in console:

fastboot flash:raw boot boot-windy.img

. Confirm with Enter (boot.img is LOS 17.1)

### For LTE/4G variant, replace with: boot.img

### If error FAILED (remote: Command not allowed): re-enter command

fastboot oem unlock 0xYOURUNLOCKKEY

and continue

Then type in console:

fastboot flash recovery TWRP-3.4.0-sc-1_castor_windy_20200606_1419.img

. Confirm with Enter.

### For LTE/4G variant, replace with: TWRP-3.4.0-sc-1_castor_20200606_1419.img

Power off tablet: disconnect from USB OR hold Volume+ + power until it vibrates 3 times.

Power on tablet: press only power button.

Wait until the LED goes purple, then press Volume+ once.

TWRP shows up.

Thanks to @therealraser.

9) BACKUP CURRENT ROM

You are now in TWRP recovery, Swipe to Allow Modifications.

Go to Backup, select Boot, EFS, System partitions.

Tap on Select Storage and select MicroSD Card.

Swipe to Backup.

Go to TWRP Home screen.

Go to Wipe > Format Data, type yes and tap on bottom right check icon.

Go to Wipe > Advanced Wipe > Select Dalvik, Cache, Data, Internal Storage, System and swipe to confirm erasing.

10) INSTALL ROM AND GAPPS

Back to TWRP home menu.

Go to Install > Select Storage > Micro SD card > OK

Select lineage*.zip.

### If you get an error and flash fails, go to Reboot > Recovery and wait for TWRP to reboot.

Add more zip > BitGapps*.zip file,

Swipe to confirm flash.

Wait while Install Zips are flashed.

At the end, tap on Wipe Cache/Dalvik, then Reboot System.

Wait during boot.

(Google search app will probably crash during Setup).

11) TWEAKS

Go to Settings > About tablet > Tap 7 times on Build number.

Go to Settings > System > Advanced > Developer options.

Advanced restart switched ON (Hold power > Restart > Restart to recovery to access TWRP easily later)

Android debugging switched ON

Windows animation scale to Animation scale .5x

Same for Transition animation scale and Animator duration scale to improve reactivity

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

Your tablet is a rocket, enjoy ;-)

Thanks: LineageOS team, TWRP team, BitGApps team, @qsnc, @SpiritCroc, TopJohnWu

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

### Sony Xperia Z2 Tablet boot to recovery:

Everyone is telling nonsense about how to boot to recovery.

Shutdown tab.

Stock boot image: Power it on, when LED is green, hold Volume- until LED becomes blue, then release and tab will restart to TWRP recovery.

LineageOS boot: Power it on, when LED is purple, press Volume+

Many thanks to @jaset_uk

### Force shutdown

Bootloop ? Hold Power + Volume+ until tablet vibrates 3 times and release buttons.

### ROM and TWRP backups

Bricked tablet like I did ?

I saved usefull files there: https://www.androidfilehost.com/?w=files&flid=329886

### Sony Xperia Z2 Tablet Stock ROM Android 6.0.1

Download FTF stock ROM: https://www.androidfilehost.com/?fid=7161016148664843282

Download Sony Mobile Flasher: https://www.androidfilehost.com/?fid=7161016148664843280

Follow tutorial: https://stockromfiles.com/sony-xperia-z2-tablet-sgp512-stock-rom/

Or with Sony Falshtool: https://developer.sony.com/develop/open-devices/get-started/flash-tool

Many thanks to Boopathy Sundaramoorthy