TWRP 3.0.2 for amami update

Turbopuschel

Member
Jun 16, 2016
47
10
0
I need some help with converting my partitions to f2fs, which this recovery supports according to the first post. I can choose to change the file system (I tried data partition first) to f2fs but after that there are immediately error messages saying "failed to mount /data" and "unable to ... (unfortunately forgot what exactly). Anyway, trying to mount manually afterwards or repairing file system do not help.
I use this kernel: http://forum.xda-developers.com/son...kernel-exfat-support-mtkcamera-dirty-t3388396 which according to its name supports f2fs.
 

Yokurt815

Senior Member
Jan 25, 2013
83
14
28
Langenau
I need some help with converting my partitions to f2fs, which this recovery supports according to the first post. I can choose to change the file system (I tried data partition first) to f2fs but after that there are immediately error messages saying "failed to mount /data" and "unable to ... (unfortunately forgot what exactly). Anyway, trying to mount manually afterwards or repairing file system do not help.
I use this kernel: http://forum.xda-developers.com/son...kernel-exfat-support-mtkcamera-dirty-t3388396 which according to its name supports f2fs.
I guess you need to post the logcat with the error messages, they should give a hint what's wrong.
 

Turbopuschel

Member
Jun 16, 2016
47
10
0
I guess you need to post the logcat with the error messages, they should give a hint what's wrong.
Ok, after I (think I) found out what logcat means and how to get it, this should be the relevant part. Here I first tried to format the /data partition as f2fs and after that (and the red error messages from TWRP) I tried to repair the filesystem. In the end (I think I cut off the log at that point, if I understand it correctly...?) I formatted again as ext4 and then restored /data from a nandroid backup.
If there is something relevant missing or I misunderstood something please tell me.

Code:
I:TWFunc::Set_Brightness: Setting brightness control to 255
I:operation_end - status=0
I:Set overlay: ''
I:Set page: 'clear_vars'
I:Set page: 'backup'
I:Set page: 'main'
I:Set page: 'clear_vars'
I:Set page: 'main2'
I:Set page: 'wipe'
I:Set page: 'advancedwipe'
I:checkpartitionlist list '/data;'
I:checkpartitionlist part_path '/data'
I:Set page: 'checkpartitionlist'
I:getpartitiondetails list '/data;'
I:getpartitiondetails part_path '/data'
I:Set page: 'partitionoptions'
I:Set page: 'selectfilesystem'
I:Set page: 'confirm_action'
I:Set page: 'action_page'
I:operation_start: 'Change File System'
I:sending message to remove 65537
mtppipe remove storage 65537
I:Message sent, remove storage ID: 65537
Formatting Data using mkfs.f2fs...

	F2FS-tools: mkfs.f2fs Ver: 1.4.0 (2014-10-18) [modified by Motorola to reserve space]

Info: Debug level = 0
Info: Label = 
Info: Segments per section = 1
Info: Sections per zone = 1
Info: Trim is disabled
Info: sector size = 512
Info: total sectors = 25178079 (12293 MB)
Info: zone aligned segment0 blkaddr: 512
Info: format version with
  "Linux version 3.10.96-gdcd3ca1 ([email protected]) (gcc version 4.8 (GCC) ) #1 SMP PREEMPT Tue Feb 16 21:32:22 UTC 2016"
Info: Overprovision ratio = 2%
Info: Overprovision segments = 227 (GC reserved = 108)
Info: format successful
I:mkfs.f2fs -t 0 /dev/block/mmcblk0p25 process ended with RC=0
Done.
Failed to mount '/data' (No such device)
I:Actual block device: '/dev/block/mmcblk0p25', current file system: 'f2fs'
Unable to recreate /data/media folder.
I:Unable to mount '/data'
I:Actual block device: '/dev/block/mmcblk0p25', current file system: 'f2fs'
Updating partition details...
Failed to mount '/data' (No such device)
I:Actual block device: '/dev/block/mmcblk0p25', current file system: 'f2fs'
I:Unable to mount '/usb-otg'
I:Actual block device: '', current file system: 'vfat'
...done
I:Set page: 'action_complete'
I:operation_end - status=0
I:Set page: 'clear_vars'
I:Set page: 'refreshfilesystem'
I:getpartitiondetails list '/data;'
I:getpartitiondetails part_path '/data'
I:Set page: 'selectfilesystem'
Truncating string cache entries.
I:Set page: 'partitionoptions'
I:Set page: 'advancedwipe'
I:Set page: 'wipe'
I:Set page: 'main'
I:Set page: 'clear_vars'
I:Set page: 'main2'
I:Set page: 'mount'
Failed to mount '/data' (No such device)
I:Actual block device: '/dev/block/mmcblk0p25', current file system: 'f2fs'
Failed to mount '/data' (No such device)
I:Actual block device: '/dev/block/mmcblk0p25', current file system: 'f2fs'
Failed to mount '/data' (No such device)
I:Actual block device: '/dev/block/mmcblk0p25', current file system: 'f2fs'
Failed to mount '/data' (No such device)
I:Actual block device: '/dev/block/mmcblk0p25', current file system: 'f2fs'
Failed to mount '/data' (No such device)
I:Actual block device: '/dev/block/mmcblk0p25', current file system: 'f2fs'
I:Set page: 'main'
I:Set page: 'clear_vars'
I:Set page: 'main2'
I:Set page: 'wipe'
I:Set page: 'advancedwipe'
I:checkpartitionlist list '/data;'
I:checkpartitionlist part_path '/data'
I:Set page: 'checkpartitionlist'
I:getpartitiondetails list '/data;'
I:getpartitiondetails part_path '/data'
I:Set page: 'partitionoptions'
I:Set page: 'confirm_action'
I:Set page: 'action_page'
I:operation_start: 'Repair Partition'
Repairing data using fsck.f2fs...
I:Repair command: /sbin/fsck.f2fs /dev/block/mmcblk0p25
Info: sector size = 512
Info: total sectors = 25178079 (12293 MB)
Info: MKFS version
  "Linux version 3.10.96-gdcd3ca1 ([email protected]) (gcc version 4.8 (GCC) ) #1 SMP PREEMPT Tue Feb 16 21:32:22 UTC 2016"
Info: FSCK version
  from "Linux version 3.10.96-gdcd3ca1 ([email protected]) (gcc version 4.8 (GCC) ) #1 SMP PREEMPT Tue Feb 16 21:32:22 UTC 2016"
    to "Linux version 3.10.96-gdcd3ca1 ([email protected]) (gcc version 4.8 (GCC) ) #1 SMP PREEMPT Tue Feb 16 21:32:22 UTC 2016"
Info: superblock features = 0 : 
Info: superblock encrypt level = 0, salt = 00000000000000000000000000000000
Info: total FS sectors = 25178072 (12293 MB)
Info: CKPT version = 1
Info: checkpoint state = 5 :  compacted_summary unmount

[FSCK] Unreachable nat entries                        [Ok..] [0x0]
[FSCK] SIT valid block bitmap checking                [Ok..]
[FSCK] Hard link checking for regular file            [Ok..] [0x0]
[FSCK] valid_block_count matching with CP             [Ok..] [0x2]
[FSCK] valid_node_count matcing with CP (de lookup)   [Ok..] [0x1]
[FSCK] valid_node_count matcing with CP (nat lookup)  [Ok..] [0x1]
[FSCK] valid_inode_count matched with CP              [Ok..] [0x1]
[FSCK] free segment_count matched with CP             [Ok..] [0x17cf]
[FSCK] next block offset is free                      [Ok..]
[FSCK] fixing SIT types
[FSCK] other corrupted bugs                           [Ok..]

Done.
I:/sbin/fsck.f2fs /dev/block/mmcblk0p25 process ended with RC=0
Done.
I:Set page: 'action_complete'
I:operation_end - status=0
I:Set page: 'clear_vars'
I:Set page: 'partitionoptions'
I:Set page: 'advancedwipe'
I:Set page: 'wipe'
I:Set page: 'main'
I:Set page: 'clear_vars'
I:Set page: 'main2'
I:Set page: 'mount'
Failed to mount '/data' (No such device)
I:Actual block device: '/dev/block/mmcblk0p25', current file system: 'f2fs'
I:Set page: 'main'
I:Set page: 'clear_vars'
I:Set page: 'main2'
I:Set page: 'wipe'
I:Set page: 'advancedwipe'
I:checkpartitionlist list '/data;'
I:checkpartitionlist part_path '/data'
I:Set page: 'checkpartitionlist'
I:getpartitiondetails list '/data;'
I:getpartitiondetails part_path '/data'
I:Set page: 'partitionoptions'
I:Set page: 'selectfilesystem'
I:Set page: 'confirm_action'
I:Set page: 'action_page'
I:operation_start: 'Change File System'
Formatting data using make_ext4fs...
 

derf elot

Senior Member
May 7, 2011
817
1,706
0
Hi,

are you using the TWRP from the OP or one of my builds with enabled decryption? The reason I'm asking is because i made some changes to the fstab file. If anything though, my changes should improve f2fs mounting and not break it.
 

Turbopuschel

Member
Jun 16, 2016
47
10
0
Hi,

are you using the TWRP from the OP or one of my builds with enabled decryption? The reason I'm asking is because i made some changes to the fstab file. If anything though, my changes should improve f2fs mounting and not break it.
I'm using OP's TWRP. Also if that matters anyhow, I'm using real recovery.
 
Last edited:

mkdmc

Senior Member
Apr 14, 2015
345
2,126
0
I flashed Dirty Unicorns MM rom.
Now how should I flash twrp?
I should use
fastboot flash FOTAKernel Z1C-twrp-3.0.2.img
or
fastboot flash recovery Z1C-twrp-3.0.2.img
?
 

Turbopuschel

Member
Jun 16, 2016
47
10
0
I flashed Dirty Unicorns MM rom.
Now how should I flash twrp?
I should use
fastboot flash FOTAKernel Z1C-twrp-3.0.2.img
or
fastboot flash recovery Z1C-twrp-3.0.2.img
?
As it says in the OP that depends on if you have the new bootloader with real recovery partition. And I think that depends on if you flashed the newest stock rom (I think version 14.6.A.1.236) from Sony via their flash tool EMMA in the past.
 
  • Like
Reactions: Talkrabb and mkdmc

EpicLPer

Senior Member
Aug 29, 2012
677
379
93
25
Scheibbs
epiclper.com
As it says in the OP that depends on if you have the new bootloader with real recovery partition. And I think that depends on if you flashed the newest stock rom (I think version 14.6.A.1.236) from Sony via their flash tool EMMA in the past.
How would I go back to stock to get the bootloader? Besides, is there any other way of checking what version I already have?
 

Turbopuschel

Member
Jun 16, 2016
47
10
0
How would I go back to stock to get the bootloader? Besides, is there any other way of checking what version I already have?
For question one download EMMA from http://software.sonymobile.com/emma/emma_setup. Unfortunately you also need the put the file "customization.ini" from this zip file: http://dl-developer.sonymobile.com/tools/Flash_tool_for_Xperia_7.zip into the installation directory prior to starting EMMA or else you need to register for using it. Then use EMMA to flash the newest stock rom. That will also get you the new bootloader.

For question two I unfortunately don't know a way.
 
Last edited:

optimumpro

Senior Member
Jan 18, 2013
6,267
13,596
253
I am not sure that this build can do any data decryption, as you need several flags in a device tree to build encryption support... You have to have at least the following:

TW_INCLUDE_L_CRYPTO := true
TARGET_HW_DISK_ENCRYPTION := true
TARGET_HW_KEYSTORE := true
TW_CRYPTO_KEY_LOC := "footer"

And you also need to provide for offset in data partition in twrp.fstab:

length=-16384
 

derf elot

Senior Member
May 7, 2011
817
1,706
0
Indeed, one in OP doesn't decrypt. But feel free to try my build :)

Thanks a lot for posting your sources.

Since I recently encrypted my phone, I was in the need of a recovery with working decryption. I spend a bit of time and tried to include it in here thanks to a lot of trial and error. Unfortunately, it not as easy as setting a flag during compilation. Instead, you also need to include necessary blobs, modify fstab, create symlinks to make blobs accessible without mounting the system, build keystore, etc. Finally, it appears to be working. You can download the build here (built within CM12.1 sources):

https://www.androidfilehost.com/?fid=24499762636001730

Here are the links to the repositories that I've changed:

https://github.com/derfelot/twrp_android_device_sony_amami
https://github.com/derfelot/twrp_android_device_sony_rhine-common

Cheers
Actually, the latest build is this one: https://www.androidfilehost.com/?fid=24533103863142425
 
Last edited:

ConradB

Senior Member
May 31, 2008
295
78
58
(SOLVED)

I want to flash TWRP 3.0.2 on my Z1c (D5503) Device.
I saved the TA Partition and unlocked the bootloader

How to flash TWRP?
What is the right way, 1 or 2?

1.) fastboot flash FOTAKernel Z1C-twrp-3.0.2.img
OR
If you have new bootloader for open devices(with real recovery partition)
2.) fastboot flash recovery Z1C-twrp-3.0.2.img

Actually is 14.4.A.0.157 installed.
I want to flash as next the AICP ROM.
Where can i see if the Device has the NEW or OLD Bootloader?

EDIT: I flashed with Emma the actually .236 and installed TWRP 3.0.2 with fastboot flash recovery.
When the device starts there ist no purple light to enter the Recovery. Is that correct?
I can enter the Recovery with Power Button and Volume- when it starts.

EDIT: ALL PROBLEMS are solved. I can hit recovery after purple light and AICP is running.
Thx for this wonderfull Recovery :D
 
Last edited:

optimumpro

Senior Member
Jan 18, 2013
6,267
13,596
253
Great. Does it support decrypting?

Sent from my Xperia Z1 Compact using XDA-Developers mobile app
Twrp 3 does not support data decryption. The OP confuses encrypted backup with data encryption where your phone is actually encrypted. Twrp 3 will never have support for decrypting data on lollipop, because the crypto module it has is based on MM and yet it can't even decrypt most MM devices. It doesn't even know your phone is encrypted. Moreover, if you ever do factory reset on TWRP 3, you will not be able to encrypt your device, because your data partition will not only be formatted, but also resized leaving no space for cryptofooter, at least for rhine devices. You will have to manually shrink your data via adb.
 
Last edited:

-Vinne2-

Senior Member
Jan 13, 2012
111
18
0
big THANKS for the TWRP! Finally flashed it :D Thank you!
P.S. But hey, why did I have to read whole topic, all post until the last one, just to extract the simple information on how to enter the TWRP? :/ This should be written in the first post… :(
 

Nash123

Senior Member
Sep 21, 2010
384
54
0
I did some reading in XDA-threads and came to the following results regarding recoveries for Z1 compact (or most xperias) in general and specific to TWRP.

As I understand there are THREE methods for implementing recoveries with Sony Z1 compact.

- Oldest is some ramdisk within bootpartition (or something like that). Therefore we had to "flash boot" instead of "flash recovery"
- Then there was the use of the FOTAKernel partition which became obsolete, as with custom roms there was no need for OTA updates from Sony. Needs to be flashed with "flash FOTAKernel"
- Last but not least Sony decided in 2015 to allow real recovery. This one needs to be "activated" with Emma, the Sony flashing tool. First there was a single modified TA-partition update in Emma. Later the open recovery was implemented within the official firmwares by Sony. BUT as I saw yesterday, firmware 270 did not allow flashing of real recovery, whereas version 236 does. So beware! Flashing of the recovery works with "flash recovery" in fastboot.

Now regarding TWRP.

I needed a version, which allows decryption of data-partition. Sidenote: My (new) ROM is AICP 11 for amami.

TWRP 3.0.2 by derfelot works with decryption in real recovery (press & hold volume button, power on), whereas it does not work within the alternate recovery (pressing power on while not pressing volume buttons, then press volume when notification LED lights up). No idea, why. (TWRP 3.0.2-1 does not work for me with decryption, btw. With no recovery-method. But depends on the ROM I guess)

So in conclusion I am happy to have working decryption within real recovery. Seems the various TWRPs need to be customized to work with the various methods and probably with the used ROM also.

The only thing I don't understand if it is possible to flash different recoveries or if the real recovery (but with less capabilities) is used even when gaining access by pressing volume when notification LED lights up.

Tried flashing different recoveries to FOTAKernel partition. But no success. Boot images with specific recoveries only work with the corresponding ROMs.

So far my understanding. Please feel free to correct me :)

Edit: BTW. With "decryption" I mean gaining access to data partition on the fly in TWRP, not decrypting the partition so it will be decrypted forever.
 
Last edited:
  • Like
Reactions: speed&vodka

SpiritCroc

Senior Member
Feb 17, 2015
597
1,204
93
I needed a version, which allows decryption of data-partition. Sidenote: My (new) ROM is AICP 11 for amami.

TWRP 3.0.2 by derfelot works with decryption in real recovery (press & hold volume button, power on), whereas it does not work within the alternate recovery (pressing power on while not pressing volume buttons, then press volume when notification LED lights up). No idea, why. (TWRP 3.0.2-1 does not work for me with decryption, btw. With no recovery-method. But depends on the ROM I guess)
When you're pressing the volume button after pressing the power button, the ROM decides what will boot. In AICP for amami, there's a built in TWRP which will boot, and because I don't have added the encryption stuff to the device tree, decryption won't work.
If you want to use encryption in recovery with AICP, real recovery is required at the moment. I don't know whether I will try to add encryption capabilities to inbuilt recovery of AICP, because it's not a priority for me.

Boot partition is part of the ROM you flash btw.
 
  • Like
Reactions: Nash123

alaaawi

Member
Dec 22, 2014
21
5
0
25
Doha
I want to flash TWRP 3.0.2 on my Z1c (D5503) Device.
I saved the TA Partition and unlocked the bootloader

How to flash TWRP?
What is the right way, 1 or 2?

1.) fastboot flash FOTAKernel Z1C-twrp-3.0.2.img
OR
If you have new bootloader for open devices(with real recovery partition)
2.) fastboot flash recovery Z1C-twrp-3.0.2.img

Actually is 14.4.A.0.157 installed.
I want to flash as next the AICP ROM.
Where can i see if the Device has the NEW or OLD Bootloader?

EDIT: I flashed with Emma the actually .236 and installed TWRP 3.0.2 with fastboot flash recovery.
When the device starts there ist no purple light to enter the Recovery. Is that correct?
I can enter the Recovery with Power Button and Volume- when it starts.

EDIT: ALL PROBLEMS are solved. I can hit recovery after purple light and AICP is running.
Thx for this wonderfull Recovery :D
hi mate how r u ?
can u please help me with the steps , i need to get the new Bootloader with the real recovery and then i want to flash the AICP android 7
 

ConradB

Senior Member
May 31, 2008
295
78
58
hi mate how r u ?
can u please help me with the steps , i need to get the new Bootloader with the real recovery and then i want to flash the AICP android 7
I flashed with Emma the actually .236 (new Bootloader is included) and installed TWRP 3.0.2 with fastboot flash recovery.
You can enter the Recovery with Power Button and Volume- when it starts.