[RECOVERY][Android 10/11][Stock/SODP][XZ2/C/P/3] TWRP 3.4.0-0 [UNofficial]

Should I continue this project?

  • Yes, for the XZ2.

    Votes: 174 35.2%
  • Yes, for the XZ2C.

    Votes: 163 32.9%
  • Yes, for the XZ2P.

    Votes: 41 8.3%
  • Yes, for the XZ3.

    Votes: 117 23.6%
  • No.

    Votes: 0 0.0%

  • Total voters
    495
Search This thread

MartinX3

Recognized Contributor
Sep 14, 2014
6,121
3,130
Mars
martinx3.github.io
Xperia XZ2
@MartinX3 hi i wanted to install lineage os so i upgrade to .672 with newflasher. after that i reboot to bootloader with hardware key but in bootloader i execute "sudo reboot bootloader" for the bootloader bug and after i flash vbmeta and twrp.img but the phone didn't enter in twrp and android system starts... why? ii have xz2c h8314 and i use the last twrp

Please follow the instructions exactly.

And currently there is no working .672 TWRP since I need the new kernelsources from sony.
 

MartinX3

Recognized Contributor
Sep 14, 2014
6,121
3,130
Mars
martinx3.github.io
Xperia XZ2
ok but after that i can install the last twrp right?

Not for stock, but for SODP.

It's a stock-only problem.
I don't know what's different with each new kernel source release, which makes decryption working again.
I set the security patch level in the bootimage header and in the props correctly, so it's just the new kernel source, which I miss.
 
  • Like
Reactions: nikkdib

nikkdib

Senior Member
Oct 6, 2014
102
16
Not for stock, but for SODP.

It's a stock-only problem.
I don't know what's different with each new kernel source release, which makes decryption working again.
I set the security patch level in the bootimage header and in the props correctly, so it's just the new kernel source, which I miss.

ok thanks i use payload dumper
 
  • Like
Reactions: MartinX3

AnxQ

Member
Dec 31, 2016
7
3
Hi there and thanks for the recovery. I have some problems when flashing on the H8296 on 52.1.a.0.532. The log is here (maybe keymaster decryption failed). How can I fix it? (It seems this firmware is the latest for my device).
Code:
01-03 14:05:59.431     0     0 E IDTP    : idtp9221_handle_halt_proc: Disable WLC_EN
01-03 14:05:59.431     0     0 I PMI     : smblib_set_icl_current: set ICL to 25000uA
01-03 14:05:59.431     0     0 I PMI     : smblib_set_icl_current: set ICL to 475000uA
01-03 14:05:59.431     0     0 I PMI     : smblib_handle_apsd_done: IRQ: apsd-done rising; USB_SDP_CHARGER detected
01-03 14:05:59.431     0     0 I PMI     : smblib_handle_hvdcp_check_timeout: IRQ: smblib_handle_hvdcp_check_timeout falling
01-03 14:05:59.431     0     0 I PMI     : smblib_handle_sdp_enumeration_done: IRQ: sdp-enumeration-done rising
01-03 14:05:59.431     0     0 I PMI     : smblib_handle_slow_plugin_timeout: IRQ: slow-plugin-timeout falling
01-03 14:05:59.431     0     0 I PMI     : smblib_handle_debug: IRQ: usbin-collapse
01-03 14:05:59.431     0     0 I PMI     : smblib_handle_aicl_done: IRQ: aicl-done
01-03 14:05:59.431     0     0 I PMI     : smblib_handle_aicl_done: ICL_IMIN is detected, suspending usbin
01-03 14:05:59.431     0     0 I PMI     : smblib_handle_debug: IRQ: usbin-collapse
01-03 14:05:59.431     0     0 I PMI     : smblib_handle_debug: IRQ: aicl-fail
01-03 14:05:59.431     0     0 I PMI     : smblib_set_icl_current: set ICL to 0uA
01-03 14:06:00.987     0     0 I init    : starting service 'keymaster-3.0-qti'...
01-03 14:05:59.310   549   549 I chatty  : uid=0(root) /sbin/recovery identical 3 lines
01-03 14:06:00.310   549   549 W ServiceManagement: Waited one second for android.hardware.keymaster@3.0::IKeymasterDevice/default. Waiting another...
01-03 14:06:01.004   871   871 E cutils-trace: Error opening trace file: No such file or directory (2)
01-03 14:06:01.005   871   871 D vndksupport: Loading /vendor/lib64/hw/android.hardware.keymaster@3.0-impl-qti.so from current namespace instead of sphal namespace.
01-03 14:06:01.007   871   871 D QSEECOMAPI: QSEECom_get_handle sb_length = 0xa000
01-03 14:06:01.008   871   871 D QSEECOMAPI: App is already loaded QSEE and app id = 1
01-03 14:06:01.011   871   871 E KeymasterUtils: TA API Major Version: 3
01-03 14:06:01.011   871   871 E KeymasterUtils: TA API Minor Version: 0
01-03 14:06:01.011   871   871 E KeymasterUtils: TA Major Version: 3
01-03 14:06:01.011   871   871 E KeymasterUtils: TA Minor Version: 132
01-03 14:06:01.015   871   871 E KeyMasterHalDevice: configure
01-03 14:06:01.015   871   871 E KeyMasterHalDevice: ret: 0
01-03 14:06:01.015   871   871 E KeyMasterHalDevice: resp->status: -38
01-03 14:06:01.015   871   871 F android.hardware.keymaster@3.0-impl: Configure failed
01-03 14:06:01.015   871   871 F libc    : Fatal signal 6 (SIGABRT), code -6 (SI_TKILL) in tid 871 (android.hardwar), pid 871 (android.hardwar)
01-03 14:06:01.016   873   873 F libc    : exec failed: No such file or directory
01-03 14:06:01.016   871   871 F libc    : crash_dump helper failed to exec
01-03 14:06:01.017     0     0 I init    : Service 'keymaster-3.0-qti' (pid 871) received signal 6
01-03 14:06:01.017     0     0 I init    : Sending signal 9 to service 'keymaster-3.0-qti' (pid 871) process group...
01-03 14:06:01.017     0     0 I libprocessgroup: Successfully killed process cgroup uid 0 pid 871 in 0ms
01-03 14:06:01.018     0     0 I init    : Untracked pid 873 exited with status 1
01-03 14:06:01.311   549   549 W ServiceManagement: Waited one second for android.hardware.keymaster@3.0::IKeymasterDevice/default. Waiting another...
 
Last edited:

MartinX3

Recognized Contributor
Sep 14, 2014
6,121
3,130
Mars
martinx3.github.io
Xperia XZ2
Hi there and thanks for the recovery. I have some problems when flashing on the H8296 on 52.1.a.0.532. The log is here (maybe keymaster decryption failed). How can I fix it? (It seems this firmware is the latest for my device).
Code:
01-03 14:05:59.431     0     0 E IDTP    : idtp9221_handle_halt_proc: Disable WLC_EN
01-03 14:05:59.431     0     0 I PMI     : smblib_set_icl_current: set ICL to 25000uA
01-03 14:05:59.431     0     0 I PMI     : smblib_set_icl_current: set ICL to 475000uA
01-03 14:05:59.431     0     0 I PMI     : smblib_handle_apsd_done: IRQ: apsd-done rising; USB_SDP_CHARGER detected
01-03 14:05:59.431     0     0 I PMI     : smblib_handle_hvdcp_check_timeout: IRQ: smblib_handle_hvdcp_check_timeout falling
01-03 14:05:59.431     0     0 I PMI     : smblib_handle_sdp_enumeration_done: IRQ: sdp-enumeration-done rising
01-03 14:05:59.431     0     0 I PMI     : smblib_handle_slow_plugin_timeout: IRQ: slow-plugin-timeout falling
01-03 14:05:59.431     0     0 I PMI     : smblib_handle_debug: IRQ: usbin-collapse
01-03 14:05:59.431     0     0 I PMI     : smblib_handle_aicl_done: IRQ: aicl-done
01-03 14:05:59.431     0     0 I PMI     : smblib_handle_aicl_done: ICL_IMIN is detected, suspending usbin
01-03 14:05:59.431     0     0 I PMI     : smblib_handle_debug: IRQ: usbin-collapse
01-03 14:05:59.431     0     0 I PMI     : smblib_handle_debug: IRQ: aicl-fail
01-03 14:05:59.431     0     0 I PMI     : smblib_set_icl_current: set ICL to 0uA
01-03 14:06:00.987     0     0 I init    : starting service 'keymaster-3.0-qti'...
01-03 14:05:59.310   549   549 I chatty  : uid=0(root) /sbin/recovery identical 3 lines
01-03 14:06:00.310   549   549 W ServiceManagement: Waited one second for android.hardware.keymaster@3.0::IKeymasterDevice/default. Waiting another...
01-03 14:06:01.004   871   871 E cutils-trace: Error opening trace file: No such file or directory (2)
01-03 14:06:01.005   871   871 D vndksupport: Loading /vendor/lib64/hw/android.hardware.keymaster@3.0-impl-qti.so from current namespace instead of sphal namespace.
01-03 14:06:01.007   871   871 D QSEECOMAPI: QSEECom_get_handle sb_length = 0xa000
01-03 14:06:01.008   871   871 D QSEECOMAPI: App is already loaded QSEE and app id = 1
01-03 14:06:01.011   871   871 E KeymasterUtils: TA API Major Version: 3
01-03 14:06:01.011   871   871 E KeymasterUtils: TA API Minor Version: 0
01-03 14:06:01.011   871   871 E KeymasterUtils: TA Major Version: 3
01-03 14:06:01.011   871   871 E KeymasterUtils: TA Minor Version: 132
01-03 14:06:01.015   871   871 E KeyMasterHalDevice: configure
01-03 14:06:01.015   871   871 E KeyMasterHalDevice: ret: 0
01-03 14:06:01.015   871   871 E KeyMasterHalDevice: resp->status: -38
01-03 14:06:01.015   871   871 F android.hardware.keymaster@3.0-impl: Configure failed
01-03 14:06:01.015   871   871 F libc    : Fatal signal 6 (SIGABRT), code -6 (SI_TKILL) in tid 871 (android.hardwar), pid 871 (android.hardwar)
01-03 14:06:01.016   873   873 F libc    : exec failed: No such file or directory
01-03 14:06:01.016   871   871 F libc    : crash_dump helper failed to exec
01-03 14:06:01.017     0     0 I init    : Service 'keymaster-3.0-qti' (pid 871) received signal 6
01-03 14:06:01.017     0     0 I init    : Sending signal 9 to service 'keymaster-3.0-qti' (pid 871) process group...
01-03 14:06:01.017     0     0 I libprocessgroup: Successfully killed process cgroup uid 0 pid 871 in 0ms
01-03 14:06:01.018     0     0 I init    : Untracked pid 873 exited with status 1
01-03 14:06:01.311   549   549 W ServiceManagement: Waited one second for android.hardware.keymaster@3.0::IKeymasterDevice/default. Waiting another...

Please put the code in a [CODE..][../CODE] tag.
Did it now in my reply to you.

And yes, please use the TWRP matching your installed firmware.
 

MartinX3

Recognized Contributor
Sep 14, 2014
6,121
3,130
Mars
martinx3.github.io
Xperia XZ2
Thanks :eek:, but where to find my version's TWRP?

Sadly you need to update to .618
I always keeping only the last 2 versions and deleted the older one after pushing the .672 TWRP. (My bad, the TWRP didn't work, because I need to wait for the next sony open source kernel release).

But I'm planning to release a TWRP without userdata decryption which should always work, regardless of the firmware version. :)
 

Bork Bork

Senior Member
Sep 5, 2019
70
19
Sadly I need to root to access /sys/fs/pstore/ and I have no way of patching/finding a boot.img for .672.

I tried extracting the one from the .sin file but no go whatsoever.

Update: Hol up! I found UnSIN and will report soon.
Update2: Sadly no files are being generated and adb obviously doesn't work either.
 
Last edited:
  • Like
Reactions: MartinX3

thanasis12.

Senior Member
Jun 24, 2018
489
36
I using unsin, and .. boot.img, and.... With magisk manager , .. magisk_puthed.img,.
The pnone is root, without twrp, firmware 672.
 
  • Like
Reactions: AnxQ

AnxQ

Member
Dec 31, 2016
7
3
ADB should work and logcat should show then something
At least of you flash instead of boot it
But just booting should work too

Installation:
  1. Update to newest stock firmware before unlocking!!!
  2. Unzip the *.gz files.
  3. fastboot --disable-verity --disable-verification flash vbmeta vbmeta.img
  4. fastboot boot twrp.img
  5. Advanced menu -> "Install recovery ramdisk" -> Choose twrp.img -> Broken until TWRP 10.0 is ready (This is a TWRP 9.0 hack)
  6. Reboot into installed TWRP -> Broken until TWRP 10.0 is ready (This is a TWRP 9.0 hack)
  7. Want Root? -> Magisk
  8. (Optional; Security degradation; Only if you know what you're doing) Switch SELinux to permissive (with my permissive.zip)
I followed the instruction here. This time i got some log here. (My bad, I have entered the logcat too early)
https://drive.google.com/file/d/1A2KT7q-UAIARkyHcSonCHY5HxUv7gR2N/view?usp=sharing
 
Last edited:

serajr

Recognized Developer / Recognized Themer
Apr 21, 2011
5,071
18,700
São Paulo - SP
Thank you very much :)
I will look into further into it next time I have time :)
Martin, pushing the missing lib(s) to the /sbin folder fixed the booting stuck issue. Got a working twrp (touch issue also fixed with chmod lines) - Post #71.
Even with encrypted /data, we can have a functional .672 stock recovery. @AnxQ :good:
 
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 3
    @MartinX3: will you provide TWRP for SODP 14?
    Luckily I got a XZ2 donated which will make it easier to create a TWRP for it while doing my thesis.
  • 24
    The Sony Open Devices Project is always happy about volunteers (coding, testing, etc) :)
    Also mainlining your favorite snapdragon powered xperia device into the mainline kernel is possible and we will be glad to help you!


    Code:
    #include <std_disclaimer.h>
    /*
     *
     * We are not responsible for bricked devices, dead SD cards,
     * thermonuclear war, or you getting fired because the alarm app failed. Please
     * do some research if you have any concerns about features included in this ROM
     * before flashing it! YOU are choosing to make these modifications, and if
     * you point the finger at us for messing up your device, we will laugh at you.
     *
     */

    Team Win Recovery Project 3.x, or twrp3 for short, is a custom recovery built with ease of use and customization in mind. Its a fully touch driven user interface no more volume rocker or power buttons to mash. The GUI is also fully XML driven and completely theme-able. You can change just about every aspect of the look and feel.

    FAQ:
    • Just wiping your phone in TWRP lead into an encrypted & not readable userdata in the stock system.
      You need to open advanced wiping and check the entries data and internal storage.
      Of course clear the dalvik, too.
    • If you backed up system and/or vendor partitions and you want to restore them, make sure that TWRP setting "Use rm -rf instead of formatting" is set!.
    • If after the usage of NewFlasher or the OTA Updater or something else, which installs stock firmware parts you get stuck into the TWRP or SONY Logo, you need again to disable the verification with the vbmeta.img file and its parameters in fastboot.
    • fastboot & adb
    • Weird problems not easily to reproduce by other users require that you make sure, that you
      • Use the newest platform tools (adb & fastboot)
      • Downloaded the newest firmware via Xperifirm from XDA and installed the newest firmware via Newflasher from XDA
    • Newflasher from XDA
    • Xperifirm from XDA
    • Removing the stock bloat apps via titanium backup may result in a boot loop. Use a file explorer to remove them, disable them or try to use my unfinished bloat removal script at github.
    • Your phone reboots into recovery, instead of system? Maybe it crashed too often due to a wrong installation or whatever?
      In TWRP:
      • Code:
        cat /dev/block/bootdevice/by-name/misc
        shows you the reason.
      • TWRP -> [WIPE] -> [Advanced Wipe] -> Tick only the misc -> [Swipe to Wipe]

    Known Bugs:
    • The "fastboot boot twrp.img" doesn't work, if you use the hardware buttons to open the blue fastboot bootloader mode. Only use adb, twrp or the android system to reboot into blue fastboot bootloader mode or flash the twrp.img, boot the device, reboot into bootloader and flash the original boot.img back, before booting into twrp.
      You can also "fastboot reboot bootloader" in the blue fastboot mode.
      This is a bootloader bug, maybe it gets fixed with the stock Q bootloader.
    • If "fastboot boot twrp.img" results into a blackscreen and reboot of the phone, take a look if you modified the DTBO partition.
      It requires a special TWRP for every modified kernel/dtbo until I find some way to unify the twrp kernel with the DTBO (if the bootloader supports it).

    Bugtracker:

    Bugreport:
    • A bugreport needs your device name, dmesg, the /tmp/recovery.log and a way to reproduce the issue.
      If possible use
      Code:
      logcat -b all
      instead of just a dmesg.
      • If ADB is not working to provide logs
        • VOLUP+POWER for 1 Seconds -> Forced crash to create a pstore
        • Boot the normal system.
        • Give me the files in
          Code:
          /sys/fs/pstore/
    • If the TWRP is stuck at the TWRP logo, the chances are high, that the decryption didn't succeed.
    • To rescue a not responding phone:
      • VOLUP+POWER for 3 Seconds -> RESTART with one Vibration.
      • VOLUP+POWER for 20 Seconds -> SHUTDOWN with 3 Vibrations.
      • VOLUP+POWER+CAMERA for 30 Seconds -> HARDWARE SHUTDOWN by discharging a capacitor.

    Thank you very much for your help, code contribution & testing! (Random order):
    • @Dees_Troy and his team of volunteers for the TWRP code
    • @dhacke thank your for providing a download server
    • Shame on me if I forgot someone after searching through the thread and my PM's!
    • And many thanks to the few donators! :)

    A telegram group for technical SODP stuff:

    XDA:DevDB Information
    TWRP, ROM for the Xperia XZ2

    Contributors
    MartinX3, Sony
    Source Code: https://github.com/MartinX3-AndroidDevelopment

    ROM OS Version: Android 10
    ROM Kernel: Linux 4.x
    ROM Firmware Required: Newest recommended
    Based On: AOSP

    Version Information
    Status:
    Stable
    Current Stable Version: 3.4.0-0
    Stable Release Date: 2020-06-13

    Created 2020-03-29
    Last Updated 2020-06-20
    14
    Download & Installation

    Download:

    Installation:
    1. Update to newest stock firmware before unlocking!!!
    2. Unzip the *.gz files with https://7-zip.org/ or Linux.
    3. Enter fastboot via software, not hardware buttons. See "Known Bugs".
    4. fastboot --disable-verity --disable-verification flash vbmeta vbmeta.img
    5. fastboot boot twrp.img
    6. Advanced menu -> "Install recovery ramdisk" -> Choose twrp.img
    7. Reboot into installed TWRP
    8. Want Root? -> Magisk
    9. (Only if your phone doesn't boot to system anymore) Advanced menu -> "Fix recovery bootloop"
    10. (Optional; Security degradation; Only if you know what you're doing) Switch SELinux to permissive (with my permissive.zip)
    10
    This means TWRP for 52.1.A.2.1?
    Yes
    I'm working on it this week plus a refactoring of the twrp device tree
    8
    The refactoring for the SODP twrp is now completed.
    It'll work without a flashed ROM (vendor/system/oem partition)
    Here runs now a nice 3.4.0 TWRP (new version since today)

    Now what's left
    - the STOCK TWRP touch driver refactoring, since the touch drivers aren't in the stock kernel, but external kernel modules which get started by bash scripts in stock.....
    - stock twrp without decryption to always work
    - sodp twrp without decryption to always work
    7
    News

    02.03.2021

    Reuploaded the SODP TWRP with a workaround for Android 11 compatibility.

    15.06.2020
    reuploaded the stock twrp for the xz2 premium with a completely fixed touch.

    14.06.2020
    reuploaded the stock twrp with a later touch kernel modules initialization.
    Hopefully fixing the randomly happening not working touch.

    13.06.2020
    thanks to the fixes in 3.4.0 we got now a twrp with the following enhancements for stock and sodp:

    - this twrp will work with future 10.0 roms, you don't need a new build matching the security patch level of your rom.
    - you can install this twrp again with the buildin ramdisk patcher. Please follow the installation instructions.

    11.06.2020
    switch to twrp 3.4.0
    sodp twrp 2020-06 security patch level
    stock twrp 2020-05 security patch level for firmware 52.1.a.2.1

    now both twrp should work without a rom being installed (empty system/vendor/oem partitions) and still be able to decrypt your userdata.
    Also the stock twrp touch should now always work instead of playing russian roulette.

    11.05.2020
    reuploaded sodp twrp for 2020-05 security patch level.
    It didn't boot with the newest aosp.

    07.05.2020
    sodp twrp for 2020-05 security patch level.

    14.04.2020
    removed stock twrp for firmware 52.1.a.0.672 until sony releases the kernel sources of the new security patch level.
    Otherwise the keymaster won't decrypt the userdata for twrp and twrp gets stuck on the twrp logo.

    13.04.2020
    stock twrp for firmware 52.1.a.0.672
    sodp twrp for 2020-04 security patch level

    hopefully fixed the touch problems of the stock twrp

    fixed the forced read only partition mountings of system, vendor, odm

    31.03.2020
    stock twrp for firmware 52.1.a.0.618

    30.03.2020
    sodp twrp for 2020-03 security patch level
    installing in ramdisk (to make it persistent) is impossible at the moment, because it is a 9.0 twrp which makes its ramdisk incompatible to the rom.

    Of course monthly twrp releases in sync with the current patch level need to be released or i would need to remove the userdata decryption completely.


    The stock twrp will follow, after it became ready.