Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save maricn/2af6f3f77223b61ff19c370a91f77be6 to your computer and use it in GitHub Desktop.
Save maricn/2af6f3f77223b61ff19c370a91f77be6 to your computer and use it in GitHub Desktop.
My reminder for how to install LineageOS 17.1 on Sony XZ2C Dual.. Big shouts to SODP, XDA team and @MartinX3..

Sony Xperia XZ2 Compact Dual SIM (H8324) liberation

This instruction list grow from XDA member @Raphos instructions here and their, @MartinX3 and others' posts throughout that thread as well as documentation found at ix5.org

Flashing

Use one of the flash modes

  • flashmode (VOL_DOWN) #green - is used by flashtool to flash the Sony Software - press volume down and insert the USB cable (green light will come)
  • fastboot (VOL_UP) #blue - is used by fastboot to flash the AOSP images - press volume up and insert the USB cable (blue light will come)

Backup TA

Unlock bootloader

Install Lineage 17.1 (tested on MartinX3 SODP LOS releases between 2020-04 - 2020-06)

Prepare the computer

  • Install / Update android SDK tools (tools/sdkmanager --update)
  • Make sure all the tools are in your $PATH - adb and fastboot most importantly
  • Check if phone appears in adb devices

Prepare the LineageOS (LOS) image

sudo apt-get install python3-dev && \
git clone https://github.com/vm03/payload_dumper && cd payload_dumper && \
virtualenv --python=python3 venv3 && source venv3/bin/activate && pip install -r requirements.txt && \
python payload_dumper.py payload.bin && deactivate

Prepare the phone

  • Use flashTool to download latest stock ROM (try older ~/Tools/F8331/FlashTool-0.9.26.0/FlashTool/FlashTool if the newest fails)
  • Flash the latest ROM to phone and boot the phone (so that security updates get applied, perhaps something else)
  • Skip setup quickly and just go and activate developer options!
  • Reboot into bootloader with adb reboot bootloader or by starting the phone with VOL_UP

Wipe the phone in fastboot mode (VOL_UP / blue)

  • you might need to reconnect the phone and retry if one of these fails until it goes through (it might be that you don't have cache partition though)
  • or try fastboot reboot bootloader
fastboot erase boot && \
fastboot erase cache && \
fastboot erase system && \
fastboot erase userdata

Flash LOS .img in fastboot mode

  • Download OEM binaries from sony.com
  • Does fastboot getvar all says "active slot b" ?
  • Apparently it's good to alternate between using A and B partition (system_a/system_b, oem_a/oem_b, etc..)
  • you might need to reconnect the phone and retry if one of these fails
  • you might need to change USB port if you get Requested download size is more than max allowed
  • Enter the payload dumper output folder and execute:
fastboot flash boot boot.img && \
fastboot flash dtbo dtbo.img && \
fastboot flash system system.img && sleep 2 && \
fastboot flash vbmeta vbmeta.img && \
fastboot flash vendor vendor.img

# then flash latest SW binaries (you can double check in the XDA thread that latest build works with them)
fastboot flash oem_a SW_binaries_for_Xperia_Android_10.0.7.1_r1_v5a_tama.img
fastboot reboot bootloader

Flash dualsim patch (otherwise no stable boot)

  • Install TWRP from 2020-04-13_20-20-57_twrp_sodp_xz2c.tar.gz or later (find newest here) in fastboot mode
  • Booting into fastboot mode using hardware VOL_UP button will not help for TWRP
  • You have to try rebooting into bootloader mode with fastboot
  • Or to install twrp image to boot partition, run the dualsim patch and then flash the LOS boot image before restarting
  • Extract TWRP archive, and navigate to the folder
  • fastboot --disable-verity --disable-verification flash vbmeta vbmeta.img
  • fastboot boot twrp-*.img # enter into TWRP
  • flash sony-dualsim-patcher-v4.zip
    • you should be flash dualsim patcher by either:
      • copy the dualsim-patcher/zips/sony-dualsim-patcher-v4.zip zip file on the phone and run the installer inside TWRP.. OR
      • enter "Advanced" in TWRP, and choose "ADB sideload", enter into ADB sideload and then on your computer run adb sideload dualsim-patcher/zips/sony-dualsim-patcher-v4.zip
  • reboot system
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment