• Introducing XDA Computing: Discussion zones for Hardware, Software, and more!    Check it out!

[TWRP][Z3][UNOFFICIAL] twrp 3.2.1-2 for z3 [2018-03-28]

Search This thread

nailyk

Senior Member
Oct 3, 2015
1,503
2,955
What it is

It is a self twrp build from the official 3.0.2-0 git sources on a omnirom tree with data decryption support. Also some flags are tuned to enable booting for newbootloaders (> 15.4)
This recovery is fully working for my sony xperia z3 (D6603) since september 2015. I give it 'as it is'.​


Disclaimer
Code:
#include <std_disclaimer.h>

/*
 * Your warranty is now void.
 *
 * 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 me for messing up your device, I will laugh at you.
 *
 */


Who can use it
it is only for z3 and unlocked bootloaders. It should work with
- phone where the sony TA update patch is applied​
or
- all AOSP based rom which support FOTAKernel recoveries extraction (extract_elf_ramdisk), ask your rom maintainer.​
Since 2017-03-16 release this recovery use apps_logs partition as a workaround for N based roms, this will break stock roms!

Sony Xperia devices don't have recovery partition. Instead of this in custom kernels is used recovery-in-boot conception with two-stage boot (ramdisk-recovery is packed inside main ramdisk). And there is partition called FOTAKernel that is used for installing official FOTA (firmware-over-the-air) updates. After unlocking your bootloader it partition becomes redundant, because you cannot use OTA function anymore. So it may be used for storing recovery ramdisk. And this very useful future was implemented by a xda member, he developed utility extract_elf_ramdisk https://github.com/Dees-Troy/extract_elf_ramdisk (it is merged to almost all kernels for Sony devices), it extracts recovery ramdisk from FOTA partition instead of using regular one from boot image. So even after updating or changing your kernel or ROM you don't lose your current recovery!
Actually it had been tested with CyanogenMod, and SlimRom as I know.
(tested only on D6603 version but should work on D6602,D6643,D6653) let me know if it work for you :)

The bootloader/reboot pain

From my experience there is 3 versions of the s1 bootloader for D66x3:
s1 D66x3 features:
LA3.0_L_15.4 : provide basic boot functionality, you can only boot in your boot partition.
LA3.0_L_37 : provide normal boot & recovery boot functonality (boot partition & FOTAKernel partition) but doesn't provide reboot to recovery functionality.
LA3.0_L_Hero_17 : (not yet tested): same as l_37 but correct the reboot in recovery bug.​
s1 D66x3 installation:
LA3.0_L_15.4 : is preinstalled. (.200 and above)
LA3.0_L_37 : is installed with M (.575)
LA3.0_L_Hero_17 : is installed with N preview (.?)​
Some roms flash other version of s1 that i never test (i only upgrade my bootloader with emma)
Check the s1 version:
Code:
getprop ro.boot.s1boot


What is working
Everything =)
  • backups
  • backups on encrypted partitions
  • restore
  • restore on encrypted partitions
  • all settings
  • change partitions type (f2fs/ext4)
  • flash zip
  • reboot
  • phone doesn't overheat and battery consumption is reasonable
  • /data decrypt
  • accessing recovery with new bootloader version (S1_Boot_MSM8974AC_LA3.0_L_37)
  • Brightness
  • usb otg
  • f2fs partition decryption

What is not working
  • wipe data buton (workaround by format, change type) --> should be ok since 2016-07-14 release.
  • reboot to recovery. I'm looking for documentation on new bootloader... --> workaround in progress --> should be ok for kernel with extract_elf_ramdisk
  • with old bootloader (< 15.4: check your cmdline) --> in progress --> should be ok for kernel with extract_elf_ramdisk. Let me know

What is not tested
  • f2fs partition decryption --> ok on 2016-07-16
  • what I forget, ask and I test asap

ToDo
  • create a zip to update this recovery --> re self signed zip since 2015-12-26 builds
  • change the 'power profile' in use when in recovery mode --> governor changed to 'ondemand' (2015-12-19)
  • create a VM for weekly builds --> done with jenkins (2016-02-17)
  • create a folder on webserver for weekly build --> Url will come soon (2016-02-17)
  • publish my files on a VCS --> https://github.com/nailyk-fr
  • update my blog to make a full (french) compiling guide -> ENOTIME. Ask here if you need.
  • make recovery functional for the 'full boot' process released by sony --> ok since 2016-01-09 builds

How to build
  • Follow the official twrp compiling guide (I start from omnirom tree),
  • If you are building from omni trees you do not need to change something as device have now official support.
  • breakfast z3
  • mka recoveryimage
  • wait a half hour and it's done
Reading CyanogenMod porting guide was very helpful.
2017-03-17: change manifest
2016-11-05: change manifest
2016-04-14: added the manifest repo url.
2016-03-07: update manifest.xml
2016-02-14: update manifest.xml
2016-02-07: switch to omnirom build tree (except kernel due to f2fs). Manifest is no more up-to-date
2016-01-15: change manifest to include z1&z1c
2016-01-13: add github fork links
2016-01-09: new twrp.fstab
2016-01-07: add patch link for the device/sony/shinano-common
2015-12-26: twrp.fstab & BoardConfigCommon.mk are no more up-to-date. I need to publish it on a public VCS but for now it's q&d. When job is done in a cleaner way a publish all the sources. If you need/want it before ask me and a provide a zip.


How to install
With a first rom installation with extract_elf_ramdisk support:

Ex: Coming from stock rom and installing CyanogenMod:
Follow the cm installation guide, and replace step 4 by:
  • download and check md5/sha1,
  • flash cyanogenmod kernel with:
  • Code:
    fastboot flash boot boot.img
  • flash recovery by using command:
  • Code:
    fastboot flash FOTAKernel <filename>
  • then reboot with
  • Code:
    fastboot reboot
You can now continue the cm installation guide.

Via fastboot:
  • download and check md5/sha1,
  • reboot your phone in fastboot mode,
  • flash recovery by using command:
  • Code:
    fastboot flash FOTAKernel <filename>
    or
  • Code:
    fastboot flash recovery <filename>
Via zip:
  • You need a custom recovery (like twrp/cwm) supporting flashing zip files,
  • Download zip to your internal/external sd,
  • Check md5/sha1,
  • Reboot to recovery,
  • flash zip.

Thanks to

Version Information
Created: 2015-12-18
Last Updated: 2018-03-28
Status: Work in progress --> stable (since 2016-07-16 build)
It's a self build version of twrp. I follow the official twrp compiling guide and add files for z3 (D6603 version in this case) and some 'compiling tricks' to add keymaster/keystore support in recovery to finally support encrypted /data partitions.
( From @LeonidasTurk's kernel thread, this build should work with other models but it not tested! Use it at your own risk, unlocked bootloaders only obviously)

official twrp compiling guide: http://forum.xda-developers.com/showthread.php?t=1943625
official CynogenMod z3 (D6603) thread: http://forum.xda-developers.com/z3/development/rom-cyanogenmod-12-nightlies-xperia-z3-t3010201
I'm not affiliated to TeamWin or CyanogenMod.


Report a problem link

Releases

Before flashing, read carefully the 'Who can use it' part and 'How to install'. If you are unsure, feel free to ask.



2018-03-28 single/unified:
FOTAKernel/recovery binary:
md5: 24cb9f0f64b2d62ef7798957932cc918
sha1: dd61d3f145f25a22b9f4eb9a6c0ec7a6eb92af0e
download mirror (fr)

Changelog

  • [*] Old boot process is broken. Will only works with new bootloader (See OP top)
  • Fix Oreo encryption. Need working /system!
    [*] Warning this recovery cannot be used with stock roms as it use /misc for rom/recovery communication.

Old releases:

2017-10-02 Single:
FOTAKernel/recovery binary:
md5: 0b4ffccf31e201006937717a98bc8849
sha1: a755e659b4f96b2106b99c310042b8a29475266c
download
[/INDENT]

Changelog
  • Codename fix
    [*] Warning this recovery cannot be used with stock roms as it use /misc for rom/recovery communication.

2017-09-28 Single:
FOTAKernel/recovery binary:
md5: c8a004a1aa6a8abd8e85f010fce04f44
sha1: 375f3e48fbdf960970a795436e1b404d9d228fc2
download
[/INDENT]

Changelog
  • Lots of improvement (twrp side)
  • Lots of changes on trees
  • adb backups are broken for now, don't use them!
  • Adjusted functionalities for our device
    [*] Warning this recovery cannot be used with stock roms as it use /misc for rom/recovery communication.

2017-07-27 Single:
FOTAKernel/recovery binary:
md5: ad3279f0f4e761c193f2c1296789ac98
download
flashable zip:
md5: 8acf3ea839ecd11f971032e292be7a8a
download

2017-07-27 Dual:
FOTAKernel/recovery binary:
md5: 7dea87dd9ab920931a769632dc054620
download
flashable zip:
md5: e4aa892b4fbd2510eeb4e7f6dba8d7e5
download

Changelog
  • Don't remember :p
    [*] Warning this recovery cannot be used with stock roms as it use /misc for rom/recovery communication.


2017-03-17:
FOTAKernel/recovery binary:
md5: 3f853b388621f60b57d6a56cbf91b8ed
sha1:
download
flashable zip:
md5: f5984afeb6dc1f2b4bed570950b67445
sha1:
download
  • Switch back to 3.4 kernel (LineageOS 14.1)
  • Resolve some apps_logs partition problem
[*] Some functionality are not working (twrp related)
[*] Warning this recovery will break stock roms as it use /misc for rom/recovery communication.

2016-12-23:
FOTAKernel/recovery binary:
md5: b083f6c9594df72497fd647e5cef41c7
sha1: 0d83215e473d89f4586b9bd4ce408cafccf12782
download
flashable zip:
md5: 7c20318900825eb6e7b814bc433d6c1c
sha1: 75d9e650811b4067b2d8beac26b6e11faca8d3ac
download
  • Switch to 3.10 1.3.3 (if you experienced problem use the 2016-10-17 version and report with log please)
  • Add app_log to fstab

2016-10-17:
FOTAKernel/recovery binary:
md5: 5926dcd958da084bb7d67e6f8279bc2c
sha1: x
download
flashable zip:
md5: ba7abccc3a36dd2ad843b671c0935a44
sha1: faf863efd5a2e19c341e76d4e3bb8e26355a4c7a
download
  • Periodical build (some corrections bugs from twrp, init problem correction from cm)
  • still on 3.10 kernel, switch to 3.4 planned.
    [*] Maybe a bug into twrp for android <= 5.1 flashing/restore into empty /system partition. Be careful!

2016-07-16:
FOTAKernel/recovery binary:
md5: 4d4316c266b1c9b737113e1a0166cbc4
sha1: 3ca7798021d4845ddc6814102abfc7c08a3bdee0
download
flashable zip:
md5: abda5283b200eab0c115e8fd0a5e2196
sha1: e02bb10f69e71df10948a9f124c15ab0a627dad8
download
  • Correct fstab errors
    [*] Apparently there is delay in partition opening due to the twrp implementation of adopted storage. I'm currently trying to fix it.
2016-07-14:
FOTAKernel/recovery binary:
md5: 1e76c989b36ff46657e59e3054ccb704
sha1: 9135cbd75ddb5b2611a24a31b372d841e9c6a69d
download
flashable zip:
md5: 1da3efe239917ed8872638d4d07d7b9d
sha1: 23ff50355b70495dbf4a6b0ef72acadc324ee832
download
  • change fstab to make wipes easier
  • lots of improvements/corrections in twrp tree from TeamWin team

2016-04-14:
FOTAKernel/recovery binary:
md5: 70a22897f6b7cace772cd58e7846f224
sha1: ad11321805c1f91fe2500377baaee9b60b53340b
download
flashable zip:
md5: f07e9d242b249d2c39388203e6a9eb70
sha1: 44f8a91b0c10b3c667246bd664e923d6d884dbdb
download
  • Change selinux policies (use xen0n repo)
  • Twrp flags to restore compatibility with old boot process
  • This build is a major' release which should restore compatibility with old bootloader.
  • please report feedback as I can know if I need to continue this way :).
  • create a git repo to push local manifests files
  • for now my Jenkins is off --> added to the todo list

bootloop workaround kernel:
2016-03-07:
md5: b674a8aa843d9be6d801ada018006141
sha1: 22f7b9ecacb262dd6788fc22ac27e1a7c7265226
download
This is a cyanogenmod kernel where I remove the Dees_Troy 'extract_elf_ramdisk'. This way, if there is a soft reboot to recovery the phone restart cyanogenmod and doesn't go to bootloop. I don't try other rom with with kernel.


2016-03-07:
FOTAKernel/recovery binary:
md5: b5f878a70d7663c4a1d89c7b2668ec56
sha1: 87c278b5317b32c383ad0b2a97452843b37b9b3e
download
flashable zip:
md5: 89de508f23adcede8967c5a61717e7e4
sha1: 6a59626204ef66614e9fa29635749953b7c6052d
download
  • resync with omnirom tree
  • change version number according to twrp.me

2016-02-14:
FOTAKernel/recovery binary:
md5: 69f3852c616472e49c5aaa1120a02a64
sha1: b62bc394849d6c0d918492b4472891a1a2128910
download alternative
flashable zip:
md5: 0aebbbc8e2f881ebef5dc5856060c668
sha1: a6979856c31f0efbf34a8470d7155d5c2a4fbcd5
download alternative
  • A few releases ago (2016-02-07) device was named leo instead of z3 so flashing zip could fail!
  • Improve display enabling hardware acceleration
  • tune some twrp flags
  • cleanup device tree

2016-02-08:
FOTAKernel/recovery binary:
md5: 6326926e5c46acc80fb925cb2838b05d
sha1: 3fb1a375121fef9b7690c6d556d5af934879ff66
download alternative
flashable zip:
md5: 0cdac0861f1a395706616ff75dbe00c7
sha1: e865ec398ed3c3b9a69735f4ccd51c4ea51fb3ba
download alternative
  • On precedent release (2016-02-07) device was named leo instead of z3 so flashing zip could fail!
  • Move device tree to correct the ro.product.device
  • ! As twrp 3.0.0-0 is a new release for me I only test 'basic' things. Feel free to report your experience. (decryption and f2fs always working)
2016-02-07:
FOTAKernel/recovery binary:
md5: b69962aaea113f0e55aa9953d4a1f8c2
sha1: addb93e06824c576d893045e6cb2f65270c426df
download
flashable zip:
md5: 816da3715c82c2f77b3ab5a6aca1612e
sha1: 26f09b99a65ad2100070f29edd8510d4da76a91e
download
  • Device name was 'leo' instead of 'z3'!
  • Switch to omnirom android-6.0 sources
  • twrp 3.0.0-0 release
  • kernel 3.10
  • ! As twrp 3.0.0-0 is a new release for me I only test 'basic' things. Feel free to report your experience. (decryption and f2fs always working)
2016-01-14:
FOTAKernel/recovery binary:
md5: b2f6f7aee3e685b7b2a817dc2d9f9b45
sha1: 0b23e1e368ca57a14100eae069b3a0d7daedfbd4
download
flashable zip:
md5: 52bfd146b0cb69bd0c29ce42b42cf995
sha1: 6f7e7b9ec51f662ef0ccb39a1e63567490485125
download
  • Custom governor to reduce heating
  • Revert board-name-change commit
2016-01-09:
FOTAKernel/recovery binary:
md5: a50f9b48d89db94bc5ffa5f791a7cd56
sha1: 2b9848d6f1b7cbdc04a6bb28590ae95265f5b2d0
download: http://s000.tinyupload.com/?file_id=47292896408680539327
flashable zip:
md5: 2e8766e3a6be34c11470099f4638dd01
sha1: ca1ec7f53d308980e82c09c586882a6a464dbaf5
download: http://s000.tinyupload.com/?file_id=78086454241793216639
  • Minor changes (cmdline) to be bootable from new bootloader
2016-01-09:
FOTAKernel binary:
md5: 2aaf2d85bbaf40e0118fae9173b2fb69
sha1: c6ca54aafebde25a32a080d5d44172289a1c707e
download: http://s000.tinyupload.com/?file_id=08765682926169309050
flashable zip:
md5: d56266b1df54d2731fd0f0a2e1b1eee6
sha1: 243e1f78c9409b638f68616a01c2f28d34cc4981
download: http://s000.tinyupload.com/?file_id=33880692705595869190
  • Updated build from sources
2015-12-26:
FOTAKernel binary:
md5: 0cf55faa541f861652e73fa62dbfb80a
sha1: 64a5672198b9a0031ecd663cc62cf2b05cd8a482
download: http://s000.tinyupload.com/?file_id=77779745124843827613
flashable zip:
md5: 7bf41589eda189c4646ca979e93da047
sha1: 9a109fe526b1eb616acfed1f85f6438a8b0eb278
download: http://s000.tinyupload.com/?file_id=16394970444867985651
  • add keystore support in a cleaner way
  • add /system symlinks so mounting /system is no more needed to decrypt /data
  • make a 'updater-script' to automate flashing-zip generation
2015-12-24:
md5: 8993fdb30ce00e431a59068f9f014e41
sha1: 5a8dfe7b4cba0b79ba1beea70656e2318dbdc9a2
download: http://s000.tinyupload.com/?file_id=10791233217780154379
  • Add qcom msm8974 keymaster blobs
  • uncrypt data now working with workaround
2015-12-19:
md5: c6e3859eae39597f984852c41a183620
sha1: b42aa840637640c3934684b3cb1fa992ea5b383a
download: http://www.datafilehost.com/d/e46f08c4
  • Add qcom msm8974 hardware crypto support
  • Try to add uncrypt capabilities (failed)
  • add governor_scaling to 'ondemand'
2015-12-18:
md5: 13b1d5de4e69e4bb49621fbe87b8ae9b
sha1: 9ed93f895897c885d139d723180d50a33ec0a719
download: http://www.datafilehost.com/d/abe4ced7
  • Initial release
 
Last edited:

nailyk

Senior Member
Oct 3, 2015
1,503
2,955
At home my computer are only on linux distros and today I post my release from work. Then I realize that datafilehost download malware on windows computer. I'm really sorry and hope no computer where infected.
For this 'working crypto' release tinyUpload was used but if anyone know a good solution I take-it. Thanks and sorry for inconvenience .
 

frabe8378910

Senior Member
Dec 15, 2011
146
72
Peine
I am running CM12.1 on my Z3 with encryption and dm-0 is type ext4 mounted on /data. I did not changed things manualy. I checked the Z3 of my wife and it's ext4 too.

Gesendet von meinem Xperia Z3 mit Tapatalk
 
  • Like
Reactions: nailyk

nailyk

Senior Member
Oct 3, 2015
1,503
2,955
dm-0 ext4

I am running CM12.1 on my Z3 with encryption and dm-0 is type ext4 mounted on /data. [...] I checked the Z3 of my wife and it's ext4 too.

Thank you for this information! Is this build of twrp working for you with encryption? If not I rebuild it with the ext4 flag.

I did not changed things manualy.
I switch my /data & /data/media to f2fs before encrypting my CM12.1, maybe that is it :D

Thanks for your feedback.
 

frabe8378910

Senior Member
Dec 15, 2011
146
72
Peine
Thank you for this information! Is this build of twrp working for you with encryption? If not I rebuild it with the ext4 flag.


I switch my /data & /data/media to f2fs before encrypting my CM12.1, maybe that is it :D

Thanks for your feedback.
I did not tested it, because I thought it was build only for f2fs.
As our SDcard is also ext4 (I need files size up to 25GB) I had never played with f2fs.
And being honest: Both Z3 are "productive" Smartphones, so currently I'd install only "low risc" options. :)

Gesendet von meinem Xperia Z3 mit Tapatalk
 

nailyk

Senior Member
Oct 3, 2015
1,503
2,955
I did not tested it, because I thought it was build only for f2fs.
As our SDcard is also ext4 (I need files size up to 25GB) I had never played with f2fs.
I switch to f2fs for performance but my last dmesg sounds like the dmcrypt is ext4. Anyway my computer is currently building with the ext4 flag for testing purpose.

And being honest: Both Z3 are "productive" Smartphones, so currently I'd install only "low risc" options. :)
Totally understand! My z3 is also everyday use and my only phone but it is mine. If i brake yours I go crazy :fingers-crossed:
I'm actually working with the twrp team to port my work, maybe you could try later :)
Have you find other recovery with working encryption?
 

frabe8378910

Senior Member
Dec 15, 2011
146
72
Peine
I switch to f2fs for performance but my last dmesg sounds like the dmcrypt is ext4. Anyway my computer is currently building with the ext4 flag for testing purpose.


Totally understand! My z3 is also everyday use and my only phone but it is mine. If i brake yours I go crazy :fingers-crossed:
I'm actually working with the twrp team to port my work, maybe you could try later :)
Have you find other recovery with working encryption?

No, I'm using twrp from LeonidasTurk on both Z3, which works fine except decryption of /data. So if your's would fix this issue, that would be perfect.
 

nailyk

Senior Member
Oct 3, 2015
1,503
2,955
I did not tested it, because I thought it was build only for f2fs.
my computer is currently building with the ext4 flag for testing purpose.
Confirmed, the
Code:
TW_CRYPTO_FS_TYPE
flag is deprecated.
(https://github.com/omnirom/android_bootable_recovery/blob/android-5.1/crypto/lollipop/cryptfs.c#L71)

and my dmcrypt is ext4 ;)
HTML:
/dev/block/dm-0 on /data type ext4 (rw,relatime,data=ordered)
/dev/block/dm-0 on /sdcard type ext4 (rw,relatime,data=ordered)
/dev/block/mmcblk1p1 on /external_sd type f2fs (rw,relatime,background_gc=on,user_xattr,acl,inline_data,extent_cache)

so the filesystem doesn't matters. I edit the post consequently. Thanks a lot @frabe8378910
 
  • Like
Reactions: frabe8378910

nailyk

Senior Member
Oct 3, 2015
1,503
2,955
No, I'm using twrp from LeonidasTurk on both Z3, which works fine except decryption of /data. So if your's would fix this issue, that would be perfect.
For me it is working fine for a couple of month now. And we have successfully ported twrp with encryption to z1, z1c & z3.
So if you are ok to try it please leave a comment to share the result of your tests (phone heat, encryption, speed, etc...) :)
Thank for your time!
 
  • Like
Reactions: optimumpro

frabe8378910

Senior Member
Dec 15, 2011
146
72
Peine
For me it is working fine for a couple of month now. And we have successfully ported twrp with encryption to z1, z1c & z3.
So if you are ok to try it please leave a comment to share the result of your tests (phone heat, encryption, speed, etc...) :)
Thank for your time!
I'll check it the coming weekend.
Thanks for your work.

Gesendet von meinem Xperia Z3 mit Tapatalk
 

frabe8378910

Senior Member
Dec 15, 2011
146
72
Peine
I'll check it the coming weekend.
Thanks for your work.

Gesendet von meinem Xperia Z3 mit Tapatalk
I already did it and it works like a charm!
Perfect, now I can use internal sdcard from recovery too!!
Decryption just takes some seconds.
Tomorrow I'll update the Z3 of my wife too.

Thanks a lot for your work!

Gesendet von meinem Xperia Z3 mit Tapatalk
 
Last edited:
  • Like
Reactions: nailyk

nailyk

Senior Member
Oct 3, 2015
1,503
2,955

frabe8378910

Senior Member
Dec 15, 2011
146
72
Peine
Have you upgraded your bootloader or are you using the older?
The new one offer real recovery possibilities: if a rom upgrade fail recovery will still be accessible. That is not possible with the older bootloader. The point is, to upgrade, you need to reflash your entire phone to stock.... (all your datas will be lost) Dedicated xda-thread?
No, I did not change the bootloader, 'cause I don't like to reflash stock.
I've not read much about it, but doesn't mean reroot it afterwards? I'd just stay tuned that someone provide a better way... :)

Gesendet von meinem Xperia Z3 mit Tapatalk
 

nailyk

Senior Member
Oct 3, 2015
1,503
2,955

optimumpro

Senior Member
Jan 18, 2013
6,500
13,992
@nailyk

Welcome to XDA. By the way, you only need to encrypt your phone once. After that you can install any other rom while keeping the same encryption. You just do wiping in TWRP with rm -rf instead of formatting. I tested and was able to successfully install a different rom.

Also, it is important to encrypt your phone (once only) via adb, because otherwise, your data partition is encrypted with the following password: 'default_password', literally. That's no security at all. Adb allows you to have an unlimited length boot password and a separate short pin for screen lock.

Also, once you remove this commit https://gerrit.omnirom.org/#/c/14353/ , and you would want to remove encryption, you can do that by pressing 'cancel' when asked for password and then format system, then data and then /system/data/cache/...
 
Last edited:

nailyk

Senior Member
Oct 3, 2015
1,503
2,955
AOSP encryption password

@nailyk
Welcome to XDA. By the way, you only need to encrypt your phone once. After that you can install any other rom while keeping the same encryption. You just do wiping in TWRP with rm -rf instead of formatting. I tested and was able to successfully install a different rom.
Thank you!
It is good new as I want to have ability to switch between CM and stock rom.

Also, it is important to encrypt your phone (once only) via adb, because otherwise, your data partition is encrypted with the following password: 'default_password', literally. That's no security at all. Adb allows you to have an unlimited length boot password and a separate short pin for screen lock.
I didn't change my bootpassword yet but it is planned ;)
Also I have some questions:
What I have understood from official AOSP documentation and twrp source code is the dmcrypt password is 'default_password' even if encrypted with your adb way. I suppose 'vdc cryptfs changepw' if the command used by the GUI: if I change my boot password with 'foobar' with 'vdc cryptfs changepw 666f6f626172', then change my screen-unlock password with '0000', I suppose the bootpassword will be erased by '0000'. Is it true?

Also, once you remove this commit https://gerrit.omnirom.org/#/c/14353/ , and you would want to remove encryption, you can do that by pressing 'cancel' when asked for password and then format system, then data and then /system/data/cache/...
As I can remember and according to this part of code, wiping device by clicking the different 'format' buttons wipe encryption.
So did you say once the phone boot password is changed with your 'adb command' the only way to wipe encryption is to recompile a twrp without this commit? I also planned some tests: wiping encryption, restoring backups on encrypted partitions, etc...

P.S.: I update my build tree to include z1/z1c/z3 with a new recovery/Android.mk. Now mka recoveryimage should work.
 

shoey63

Recognized Contributor
Jun 5, 2012
4,011
3,995
Somewhere in Oz...
@nailyk
Can't seem to reboot recovery from within TWRP on stock .264 (UB). It boots straight to system. Booting to recovery with power button plus volume down combo when device is off works. Any ideas?
 
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 36
    What it is

    It is a self twrp build from the official 3.0.2-0 git sources on a omnirom tree with data decryption support. Also some flags are tuned to enable booting for newbootloaders (> 15.4)
    This recovery is fully working for my sony xperia z3 (D6603) since september 2015. I give it 'as it is'.​


    Disclaimer
    Code:
    #include <std_disclaimer.h>
    
    /*
     * Your warranty is now void.
     *
     * 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 me for messing up your device, I will laugh at you.
     *
     */


    Who can use it
    it is only for z3 and unlocked bootloaders. It should work with
    - phone where the sony TA update patch is applied​
    or
    - all AOSP based rom which support FOTAKernel recoveries extraction (extract_elf_ramdisk), ask your rom maintainer.​
    Since 2017-03-16 release this recovery use apps_logs partition as a workaround for N based roms, this will break stock roms!

    Sony Xperia devices don't have recovery partition. Instead of this in custom kernels is used recovery-in-boot conception with two-stage boot (ramdisk-recovery is packed inside main ramdisk). And there is partition called FOTAKernel that is used for installing official FOTA (firmware-over-the-air) updates. After unlocking your bootloader it partition becomes redundant, because you cannot use OTA function anymore. So it may be used for storing recovery ramdisk. And this very useful future was implemented by a xda member, he developed utility extract_elf_ramdisk https://github.com/Dees-Troy/extract_elf_ramdisk (it is merged to almost all kernels for Sony devices), it extracts recovery ramdisk from FOTA partition instead of using regular one from boot image. So even after updating or changing your kernel or ROM you don't lose your current recovery!
    Actually it had been tested with CyanogenMod, and SlimRom as I know.
    (tested only on D6603 version but should work on D6602,D6643,D6653) let me know if it work for you :)

    The bootloader/reboot pain

    From my experience there is 3 versions of the s1 bootloader for D66x3:
    s1 D66x3 features:
    LA3.0_L_15.4 : provide basic boot functionality, you can only boot in your boot partition.
    LA3.0_L_37 : provide normal boot & recovery boot functonality (boot partition & FOTAKernel partition) but doesn't provide reboot to recovery functionality.
    LA3.0_L_Hero_17 : (not yet tested): same as l_37 but correct the reboot in recovery bug.​
    s1 D66x3 installation:
    LA3.0_L_15.4 : is preinstalled. (.200 and above)
    LA3.0_L_37 : is installed with M (.575)
    LA3.0_L_Hero_17 : is installed with N preview (.?)​
    Some roms flash other version of s1 that i never test (i only upgrade my bootloader with emma)
    Check the s1 version:
    Code:
    getprop ro.boot.s1boot


    What is working
    Everything =)
    • backups
    • backups on encrypted partitions
    • restore
    • restore on encrypted partitions
    • all settings
    • change partitions type (f2fs/ext4)
    • flash zip
    • reboot
    • phone doesn't overheat and battery consumption is reasonable
    • /data decrypt
    • accessing recovery with new bootloader version (S1_Boot_MSM8974AC_LA3.0_L_37)
    • Brightness
    • usb otg
    • f2fs partition decryption

    What is not working
    • wipe data buton (workaround by format, change type) --> should be ok since 2016-07-14 release.
    • reboot to recovery. I'm looking for documentation on new bootloader... --> workaround in progress --> should be ok for kernel with extract_elf_ramdisk
    • with old bootloader (< 15.4: check your cmdline) --> in progress --> should be ok for kernel with extract_elf_ramdisk. Let me know

    What is not tested
    • f2fs partition decryption --> ok on 2016-07-16
    • what I forget, ask and I test asap

    ToDo
    • create a zip to update this recovery --> re self signed zip since 2015-12-26 builds
    • change the 'power profile' in use when in recovery mode --> governor changed to 'ondemand' (2015-12-19)
    • create a VM for weekly builds --> done with jenkins (2016-02-17)
    • create a folder on webserver for weekly build --> Url will come soon (2016-02-17)
    • publish my files on a VCS --> https://github.com/nailyk-fr
    • update my blog to make a full (french) compiling guide -> ENOTIME. Ask here if you need.
    • make recovery functional for the 'full boot' process released by sony --> ok since 2016-01-09 builds

    How to build
    • Follow the official twrp compiling guide (I start from omnirom tree),
    • If you are building from omni trees you do not need to change something as device have now official support.
    • breakfast z3
    • mka recoveryimage
    • wait a half hour and it's done
    Reading CyanogenMod porting guide was very helpful.
    2017-03-17: change manifest
    2016-11-05: change manifest
    2016-04-14: added the manifest repo url.
    2016-03-07: update manifest.xml
    2016-02-14: update manifest.xml
    2016-02-07: switch to omnirom build tree (except kernel due to f2fs). Manifest is no more up-to-date
    2016-01-15: change manifest to include z1&z1c
    2016-01-13: add github fork links
    2016-01-09: new twrp.fstab
    2016-01-07: add patch link for the device/sony/shinano-common
    2015-12-26: twrp.fstab & BoardConfigCommon.mk are no more up-to-date. I need to publish it on a public VCS but for now it's q&d. When job is done in a cleaner way a publish all the sources. If you need/want it before ask me and a provide a zip.


    How to install
    With a first rom installation with extract_elf_ramdisk support:

    Ex: Coming from stock rom and installing CyanogenMod:
    Follow the cm installation guide, and replace step 4 by:
    • download and check md5/sha1,
    • flash cyanogenmod kernel with:
    • Code:
      fastboot flash boot boot.img
    • flash recovery by using command:
    • Code:
      fastboot flash FOTAKernel <filename>
    • then reboot with
    • Code:
      fastboot reboot
    You can now continue the cm installation guide.

    Via fastboot:
    • download and check md5/sha1,
    • reboot your phone in fastboot mode,
    • flash recovery by using command:
    • Code:
      fastboot flash FOTAKernel <filename>
      or
    • Code:
      fastboot flash recovery <filename>
    Via zip:
    • You need a custom recovery (like twrp/cwm) supporting flashing zip files,
    • Download zip to your internal/external sd,
    • Check md5/sha1,
    • Reboot to recovery,
    • flash zip.

    Thanks to

    Version Information
    Created: 2015-12-18
    Last Updated: 2018-03-28
    Status: Work in progress --> stable (since 2016-07-16 build)
    It's a self build version of twrp. I follow the official twrp compiling guide and add files for z3 (D6603 version in this case) and some 'compiling tricks' to add keymaster/keystore support in recovery to finally support encrypted /data partitions.
    ( From @LeonidasTurk's kernel thread, this build should work with other models but it not tested! Use it at your own risk, unlocked bootloaders only obviously)

    official twrp compiling guide: http://forum.xda-developers.com/showthread.php?t=1943625
    official CynogenMod z3 (D6603) thread: http://forum.xda-developers.com/z3/development/rom-cyanogenmod-12-nightlies-xperia-z3-t3010201
    I'm not affiliated to TeamWin or CyanogenMod.


    Report a problem link

    Releases

    Before flashing, read carefully the 'Who can use it' part and 'How to install'. If you are unsure, feel free to ask.



    2018-03-28 single/unified:
    FOTAKernel/recovery binary:
    md5: 24cb9f0f64b2d62ef7798957932cc918
    sha1: dd61d3f145f25a22b9f4eb9a6c0ec7a6eb92af0e
    download mirror (fr)

    Changelog

    • [*] Old boot process is broken. Will only works with new bootloader (See OP top)
    • Fix Oreo encryption. Need working /system!
      [*] Warning this recovery cannot be used with stock roms as it use /misc for rom/recovery communication.

    Old releases:

    2017-10-02 Single:
    FOTAKernel/recovery binary:
    md5: 0b4ffccf31e201006937717a98bc8849
    sha1: a755e659b4f96b2106b99c310042b8a29475266c
    download
    [/INDENT]

    Changelog
    • Codename fix
      [*] Warning this recovery cannot be used with stock roms as it use /misc for rom/recovery communication.

    2017-09-28 Single:
    FOTAKernel/recovery binary:
    md5: c8a004a1aa6a8abd8e85f010fce04f44
    sha1: 375f3e48fbdf960970a795436e1b404d9d228fc2
    download
    [/INDENT]

    Changelog
    • Lots of improvement (twrp side)
    • Lots of changes on trees
    • adb backups are broken for now, don't use them!
    • Adjusted functionalities for our device
      [*] Warning this recovery cannot be used with stock roms as it use /misc for rom/recovery communication.

    2017-07-27 Single:
    FOTAKernel/recovery binary:
    md5: ad3279f0f4e761c193f2c1296789ac98
    download
    flashable zip:
    md5: 8acf3ea839ecd11f971032e292be7a8a
    download

    2017-07-27 Dual:
    FOTAKernel/recovery binary:
    md5: 7dea87dd9ab920931a769632dc054620
    download
    flashable zip:
    md5: e4aa892b4fbd2510eeb4e7f6dba8d7e5
    download

    Changelog
    • Don't remember :p
      [*] Warning this recovery cannot be used with stock roms as it use /misc for rom/recovery communication.


    2017-03-17:
    FOTAKernel/recovery binary:
    md5: 3f853b388621f60b57d6a56cbf91b8ed
    sha1:
    download
    flashable zip:
    md5: f5984afeb6dc1f2b4bed570950b67445
    sha1:
    download
    • Switch back to 3.4 kernel (LineageOS 14.1)
    • Resolve some apps_logs partition problem
    [*] Some functionality are not working (twrp related)
    [*] Warning this recovery will break stock roms as it use /misc for rom/recovery communication.

    2016-12-23:
    FOTAKernel/recovery binary:
    md5: b083f6c9594df72497fd647e5cef41c7
    sha1: 0d83215e473d89f4586b9bd4ce408cafccf12782
    download
    flashable zip:
    md5: 7c20318900825eb6e7b814bc433d6c1c
    sha1: 75d9e650811b4067b2d8beac26b6e11faca8d3ac
    download
    • Switch to 3.10 1.3.3 (if you experienced problem use the 2016-10-17 version and report with log please)
    • Add app_log to fstab

    2016-10-17:
    FOTAKernel/recovery binary:
    md5: 5926dcd958da084bb7d67e6f8279bc2c
    sha1: x
    download
    flashable zip:
    md5: ba7abccc3a36dd2ad843b671c0935a44
    sha1: faf863efd5a2e19c341e76d4e3bb8e26355a4c7a
    download
    • Periodical build (some corrections bugs from twrp, init problem correction from cm)
    • still on 3.10 kernel, switch to 3.4 planned.
      [*] Maybe a bug into twrp for android <= 5.1 flashing/restore into empty /system partition. Be careful!

    2016-07-16:
    FOTAKernel/recovery binary:
    md5: 4d4316c266b1c9b737113e1a0166cbc4
    sha1: 3ca7798021d4845ddc6814102abfc7c08a3bdee0
    download
    flashable zip:
    md5: abda5283b200eab0c115e8fd0a5e2196
    sha1: e02bb10f69e71df10948a9f124c15ab0a627dad8
    download
    • Correct fstab errors
      [*] Apparently there is delay in partition opening due to the twrp implementation of adopted storage. I'm currently trying to fix it.
    2016-07-14:
    FOTAKernel/recovery binary:
    md5: 1e76c989b36ff46657e59e3054ccb704
    sha1: 9135cbd75ddb5b2611a24a31b372d841e9c6a69d
    download
    flashable zip:
    md5: 1da3efe239917ed8872638d4d07d7b9d
    sha1: 23ff50355b70495dbf4a6b0ef72acadc324ee832
    download
    • change fstab to make wipes easier
    • lots of improvements/corrections in twrp tree from TeamWin team

    2016-04-14:
    FOTAKernel/recovery binary:
    md5: 70a22897f6b7cace772cd58e7846f224
    sha1: ad11321805c1f91fe2500377baaee9b60b53340b
    download
    flashable zip:
    md5: f07e9d242b249d2c39388203e6a9eb70
    sha1: 44f8a91b0c10b3c667246bd664e923d6d884dbdb
    download
    • Change selinux policies (use xen0n repo)
    • Twrp flags to restore compatibility with old boot process
    • This build is a major' release which should restore compatibility with old bootloader.
    • please report feedback as I can know if I need to continue this way :).
    • create a git repo to push local manifests files
    • for now my Jenkins is off --> added to the todo list

    bootloop workaround kernel:
    2016-03-07:
    md5: b674a8aa843d9be6d801ada018006141
    sha1: 22f7b9ecacb262dd6788fc22ac27e1a7c7265226
    download
    This is a cyanogenmod kernel where I remove the Dees_Troy 'extract_elf_ramdisk'. This way, if there is a soft reboot to recovery the phone restart cyanogenmod and doesn't go to bootloop. I don't try other rom with with kernel.


    2016-03-07:
    FOTAKernel/recovery binary:
    md5: b5f878a70d7663c4a1d89c7b2668ec56
    sha1: 87c278b5317b32c383ad0b2a97452843b37b9b3e
    download
    flashable zip:
    md5: 89de508f23adcede8967c5a61717e7e4
    sha1: 6a59626204ef66614e9fa29635749953b7c6052d
    download
    • resync with omnirom tree
    • change version number according to twrp.me

    2016-02-14:
    FOTAKernel/recovery binary:
    md5: 69f3852c616472e49c5aaa1120a02a64
    sha1: b62bc394849d6c0d918492b4472891a1a2128910
    download alternative
    flashable zip:
    md5: 0aebbbc8e2f881ebef5dc5856060c668
    sha1: a6979856c31f0efbf34a8470d7155d5c2a4fbcd5
    download alternative
    • A few releases ago (2016-02-07) device was named leo instead of z3 so flashing zip could fail!
    • Improve display enabling hardware acceleration
    • tune some twrp flags
    • cleanup device tree

    2016-02-08:
    FOTAKernel/recovery binary:
    md5: 6326926e5c46acc80fb925cb2838b05d
    sha1: 3fb1a375121fef9b7690c6d556d5af934879ff66
    download alternative
    flashable zip:
    md5: 0cdac0861f1a395706616ff75dbe00c7
    sha1: e865ec398ed3c3b9a69735f4ccd51c4ea51fb3ba
    download alternative
    • On precedent release (2016-02-07) device was named leo instead of z3 so flashing zip could fail!
    • Move device tree to correct the ro.product.device
    • ! As twrp 3.0.0-0 is a new release for me I only test 'basic' things. Feel free to report your experience. (decryption and f2fs always working)
    2016-02-07:
    FOTAKernel/recovery binary:
    md5: b69962aaea113f0e55aa9953d4a1f8c2
    sha1: addb93e06824c576d893045e6cb2f65270c426df
    download
    flashable zip:
    md5: 816da3715c82c2f77b3ab5a6aca1612e
    sha1: 26f09b99a65ad2100070f29edd8510d4da76a91e
    download
    • Device name was 'leo' instead of 'z3'!
    • Switch to omnirom android-6.0 sources
    • twrp 3.0.0-0 release
    • kernel 3.10
    • ! As twrp 3.0.0-0 is a new release for me I only test 'basic' things. Feel free to report your experience. (decryption and f2fs always working)
    2016-01-14:
    FOTAKernel/recovery binary:
    md5: b2f6f7aee3e685b7b2a817dc2d9f9b45
    sha1: 0b23e1e368ca57a14100eae069b3a0d7daedfbd4
    download
    flashable zip:
    md5: 52bfd146b0cb69bd0c29ce42b42cf995
    sha1: 6f7e7b9ec51f662ef0ccb39a1e63567490485125
    download
    • Custom governor to reduce heating
    • Revert board-name-change commit
    2016-01-09:
    FOTAKernel/recovery binary:
    md5: a50f9b48d89db94bc5ffa5f791a7cd56
    sha1: 2b9848d6f1b7cbdc04a6bb28590ae95265f5b2d0
    download: http://s000.tinyupload.com/?file_id=47292896408680539327
    flashable zip:
    md5: 2e8766e3a6be34c11470099f4638dd01
    sha1: ca1ec7f53d308980e82c09c586882a6a464dbaf5
    download: http://s000.tinyupload.com/?file_id=78086454241793216639
    • Minor changes (cmdline) to be bootable from new bootloader
    2016-01-09:
    FOTAKernel binary:
    md5: 2aaf2d85bbaf40e0118fae9173b2fb69
    sha1: c6ca54aafebde25a32a080d5d44172289a1c707e
    download: http://s000.tinyupload.com/?file_id=08765682926169309050
    flashable zip:
    md5: d56266b1df54d2731fd0f0a2e1b1eee6
    sha1: 243e1f78c9409b638f68616a01c2f28d34cc4981
    download: http://s000.tinyupload.com/?file_id=33880692705595869190
    • Updated build from sources
    2015-12-26:
    FOTAKernel binary:
    md5: 0cf55faa541f861652e73fa62dbfb80a
    sha1: 64a5672198b9a0031ecd663cc62cf2b05cd8a482
    download: http://s000.tinyupload.com/?file_id=77779745124843827613
    flashable zip:
    md5: 7bf41589eda189c4646ca979e93da047
    sha1: 9a109fe526b1eb616acfed1f85f6438a8b0eb278
    download: http://s000.tinyupload.com/?file_id=16394970444867985651
    • add keystore support in a cleaner way
    • add /system symlinks so mounting /system is no more needed to decrypt /data
    • make a 'updater-script' to automate flashing-zip generation
    2015-12-24:
    md5: 8993fdb30ce00e431a59068f9f014e41
    sha1: 5a8dfe7b4cba0b79ba1beea70656e2318dbdc9a2
    download: http://s000.tinyupload.com/?file_id=10791233217780154379
    • Add qcom msm8974 keymaster blobs
    • uncrypt data now working with workaround
    2015-12-19:
    md5: c6e3859eae39597f984852c41a183620
    sha1: b42aa840637640c3934684b3cb1fa992ea5b383a
    download: http://www.datafilehost.com/d/e46f08c4
    • Add qcom msm8974 hardware crypto support
    • Try to add uncrypt capabilities (failed)
    • add governor_scaling to 'ondemand'
    2015-12-18:
    md5: 13b1d5de4e69e4bb49621fbe87b8ae9b
    sha1: 9ed93f895897c885d139d723180d50a33ec0a719
    download: http://www.datafilehost.com/d/abe4ced7
    • Initial release
    9
    *Release 2017-09-28*

    New release, lots of changes!
    This is built from omni trees (autonomous volunteer still needed for omni debugging ;)) and there is problems with device codename: expect 'error 7' while flashing some zips.
    If that happens tell your rom maintainer to add 'leo' on the OTA_PACKAGE device list (should be ok for lineage).
    This is a totally reworked twrp, encryption support still here.
    Some pending fix on twrp are included.
    Do not use adb backups, they are broken!

    New sources are not hidden but not on temporary gerrits/gits. Pm if you need them before official releases.

    Upgrade is not needed if the old one is working successfully for you.
    4
    At home my computer are only on linux distros and today I post my release from work. Then I realize that datafilehost download malware on windows computer. I'm really sorry and hope no computer where infected.
    For this 'working crypto' release tinyUpload was used but if anyone know a good solution I take-it. Thanks and sorry for inconvenience .
    3
    ext4/f2fs

    New release.
    Apparently this f2fs build is not compatible with ext4 over encryption (Seems only cyanogenmod use f2fs, you can check your encrypted filesystem with mount | grep "dm-0" )
    If you need a decrypt for ext4 ask and I build it asap.
    3
    So for a Z3 dual, I can use this recovery but I will not be able to flash any zip ? I always need a PC and fastboot ?
    For apps_log wipe, it's only included up to 3.0.2 but not in 3.1.x ? So for example, the 2016-07-16 is ok ?
    You could flash this recovery from existing recovery because a zip is provided. Flash it as any other zip.
    I dont remember exactly which version but yes, not all allow you apps_log wiping.
    However, for the new version (3.1.1) I plan to release two versions. One will allow rom updating through this apps_logs partition (not compatible with stock roms), the other wont allow custom rom upgrades but will be compatible with stock roms.

    Not that I'm in a hurry, good friend Nailyk, but 4 Leo TWRP 3.1.1 I'll give you my bank account or a valuable share. ;) :laugh:
    Send me a PM with your bank information number (I need to order some sh*ts on internet like a new d66x3) and you will get the twrp back.

    I didnot release it because encryption get broken. Seems to be a bug on twrp side.

    I am running now Android 7.1.2 (Your Lineago OS ROM) For xperia z3. But the recovery is 3.0 can i just flash this in twrp and then reboot whitout any problems?
    Yes sure, this is the recommended flash into 14.1 OP ;)