yashsingh1/xdaforums huggingface dataset:
[Xperia Z3 Android Development] nailyk:
If the 'boot to recovery' and 'reboot to recovery' works, you should be fine.

I don't know where your version came from, but i if you flash a ftf from xda community, maybe someone found another s1 and add it to the rom?

If you check the infographic i link you previously you can see this boot process is really complicated as every rom maker implement a 'start to recovery' function itself.

You can give a try to check what i said:

- turn off your phone,

- start your recovery with power+vol-down combination,

- in the twrp terminal, type uname -a. It should show 3.10.96-nailyk-.......

+ Restart your phone to your rom, and it reboot to recovery,

+ in the twrp terminal, type uname -a. It should show the kernel rom version (3.4.0-cm-.....)

but, the twrp splashscreen is the same (3.0.2-1) because cyanogenmod use a script called 'extract_elf_ramdisk' which launch the ramdisk contained in the FOTAKernel partition. It is not the case for every roms. Some include a recovery, so the recovery started with power on+vol-down in not the same as the recovery started when rebooting the phone. Really confusing.....

Hope i it answer your question.
[Xperia Z3 Android Development] frabe8378910:
I tested your suggested boot scenarios and you're wright, the versions match.

Gesendet von meinem Xperia Z3 mit Tapatalk
[Xperia Z3 Android Development] nailyk:
In this topic i made an diagram, trying to explain this.

Also, as you tested it, when you reboot to recovery, the rom kernel is used. Depending of the rom, the recovery boot process, is fairly different between roms. I suppose you use cm, so your 'path' is '1, kernel with_extract_elf_ramdisk'. If you install another rom on your device, your 'path' may be different, and you will get a multirecovery device (one with the rom, one with the FOTAKernel partition).

I'm sorry my explanation took so long to answer your first question:

For the hero version of the boot loader, afaik, the only advantage is the implementation of the reboot process, meaning with any rom your device boot the recovery in the FOTAKernel partition.

For now, you have a version which can boot the recovery, even if your rom is totally broken. If you plan to use your device only with CyanogenMod, i think it is not necessary to upgrade to the 'hero' version of the bootloader.

Good luck
[Xperia Z3 Android Development] nailyk:
New release

New release of the recovery (2016-07-14).

For now only tested with my D6603 bootloader v15.4 and cm12.1 kernel 3.4.

This version should get back compatibility with kernel >= 3.4 compliant with extract_elf_ramdisk.

Happy flashing.​

P.S.: if you just wanna test: 'fastboot boot recovery.img' ;)

Edit: new release on 2016-07-16 correcting minors errors on fstab.
[Xperia Z3 Android Development] flobin:
Hi everyone. I just tried to flash this recovery image (because I was having some other problems). However, I got the following:

sending 'recovery' (14238 KB)...

OKAY [ 0.449s]

writing 'recovery'...

FAILED (remote: partition table doesn't exist)

Anyone know what I can do about this? Thanks!
[Xperia Z3 Android Development] nailyk:
Hi,

iirc with the first version of the bootloader, the partition name was FOTAKernel (check how to install on the op for the exact partition name, case sensitive). Also your bootloader need to be unlocked to flash this recovery.

Good luck.

P.S.: i came back too late on #cyanogenmod. Highlight me if you are still in trouble.
[Xperia Z3 Android Development] flobin:
I did (do) have an unlocked bootloader, so that's good. In the meantime, I was able to flash this stock firmware, which luckily does boot. I was able to flash the boot image via fastboot this time, but unable to actually enter recovery mode either through adb or by pressing the volume keys during boot.

Now that I'm re-reading the OP it appears I won't be able to flash this at all, since you have to have the TA update which you can only get with Sony's flashtool, but that only works on Windows. Sadly I don't have a Windows machine and don't really know anyone close by who does.
[Xperia Z3 Android Development] nailyk:
Yes, it was a pain to upgrade bootloader with emma. In my case i install a virtualbox windows7 vm to get emma working.

Some rom publisher integrate s1/ta upgrades. (s1 is our xperia bootloader).

You can check this to get your bootloader version, and here for an explanation.

Also you can check here.

You cannot enter recovery mode with your 'Marshmallow 6.0.1 build 23.5.A.0.575 Customized MEA' rom (on the first line, they mention the rom didn't include root or recovery) because, i guess, they doesn't include any 'boot to recovery' process.

I need to insert something about this crappy bootloader into the op. I will do asap :o
[Xperia Z3 Android Development] flobin:
I really should have read the OP more carefully.

Thanks for the advice, by the way, I've managed to get CM working.

If anyone else has the same problem as me: in fastboot, flash the CM recovery boot.img, don't reboot, then flash the TWRP recovery on top of that.
[Xperia Z3 Android Development] nailyk:
Glad it work now!

What part did you miss? Maybe i can change the organisation of the op or change some parts?
[Xperia Z3 Android Development] flobin:
Actually the OP is fine, I just chose to try and flash it anyway, because I wasn't really getting anywhere with any other methods. But I suppose you can add my fix for those who don't have the TA update from Sony.
[Xperia Z3 Android Development] nailyk:
I add it and change a few thinks.

I will also add something about the bootloader part.

Btw, now you should be able to check your bootloader version. Which one it is?

getprop ro.boot.s1boot
[Xperia Z3 Android Development] nailyk:
testers wanted

As this recovery seem to work, i ask for an official port. Before we can get it i need to rework the build tree.

To validate the new build process, i made this test build with the reworked tree. Here it is md5: aafa52268c1e06da72e7d2e5d2da5276).

There is one know issue: updating partition take a while.

Let me know if it work.

P.S.: with new bootloader you can only boot it with `fastboot boot recovery-z3-20160807_rework.img`
[Xperia Z3 Android Development] Ultramanoid:
Thank you for keeping up with this recovery.

Working for me quite well until now, will check this new build right away. By "a while" do you mean a few minutes, or even longer ?

Edit : Seems to work fine. I can't see any delay updating partition... !
[Xperia Z3 Android Development] nailyk:
No worries and thank you for your feedback.

This delay first appear when twrp release support for adopted storage. I don't have this functionality, for now i'm stuck at cm12.1. 'Updating partition detail' take around one minute on my device.

Is your device encrypted?
[Xperia Z3 Android Development] Ultramanoid:
I see, yes, I'm on 5.1.1 as well, unlocked bootloader, not encrypted right now. On 6.0.1 I wouldn't use any card as adopted storage anyway, only as portable.

Will test some more, thanks again !
[Xperia Z3 Android Development] Ultramanoid:
I've been testing and I see what you mean by taking a while, after wiping cache and dalvik it does take a couple of minutes to update the partition details for me too.

I see a bigger problem though; backing up works with data and system but not with recovery and boot, it creates corrupt files. I've tried several times and it's always recovery.emmc.win and boot.emmc.win that have errors.

Also, no md5 files are created.

Going back to your previous 3.0.2-1, everything is working fine.
[Xperia Z3 Android Development] nailyk:
Thanks a lot for your feedback. I will make some experiments asap. Any chance you keep the recovery.log when the backup and/or restore failed?
[Xperia Z3 Android Development] nailyk:
I'm experimenting on this for 3 hours now. On my first 3 tries, the boot partition won't restore. Then something happens and restore works every time. My guess is i change a setting in twrp which override the old configuration file and solve the problem. I try with old version, then the new one but can't reproduce anymore the restore binary partition problem :silly:
[Xperia Z3 Android Development] Ultramanoid:
I didn't before, sorry. Just flashed the recovery again and tried a few times, same thing, errors with boot and recovery backups, but now I have a log, hope it helps !
[Xperia Z3 Android Development] nailyk:
It helps for the md5 bug. Thanks!

Here is the patch made by the twrp team.

About the backup/recovery problem i can't reproduce, i check every files on my sdcard and they are all ok. So it may be related to the md5 bug and doesn't affect backup integrity.

For the 'updating partition detail', i also ask and it seems to also be a bug with f2fs filesystem when almost full. I will test further.

So tests for new tree seems convincing.

Perhaps i will produce a new test build before asking for official support but it's going fine :)
[Xperia Z3 Android Development] nailyk:
New pre-prod release :)

Should correct a lot of things. Sorry for late.

Wrong file uploaded!
[Xperia Z3 Android Development] Narvi Inveshaeitor:
Everytime I flash this one in TWRP then reboot, my phone just stuck on the black screen. It just can't seem to boot.

And it's the 3rd times already, damn. Also used the "New pre-prod release" but just not working for me.
[Xperia Z3 Android Development] nailyk:
Can you tell me which rom you are using?

Also i need to know if your bootloader is upgraded, can you check with this command?

How do you start the recovery? Key combination/multiples push on volume rocker/soft reboot?
[Xperia Z3 Android Development] Asif187:
is this working with paranoid android on xperia z3?
[Xperia Z3 Android Development] nailyk:
Seems there is a recent issue on paranoid with the old boot process.

If your bootloader is upgraded (see OP), will work in every case except for reboot to recovery functions.
[Xperia Z3 Android Development] benzo:
I feel stupid :eek:, reading the thread's title i can see "[new BL only]" (Locked Bootloader i presume), but I find no mentions in the description/instructions posts. Can someone clarify?

Thanks a lot
[Xperia Z3 Android Development] nailyk:
This twrp recovery is for unlocked bootloader. Every FOTAKernel recoveries are for unlocked bootloader.

And this build is for upgraded bootloader (new BL = new bootloader). The pre-prod release (a few post earlier) should work on first version of the bootloader, but not tested.

Hope it helps.
[Xperia Z3 Android Development] benzo:
Thank you, it's all clear now (:
[Xperia Z3 Android Development] Sergen Setup:
Hi nailyk, hi everyone,

my xperia Z3 is dual sim (D6683), I assume flashing TWRP should work but i have not read any comment concerning this device, what do you think ? Did any one try ?

My z3dual is flashed with cyanogenmod 12 and a custom boot.img that does not support backups at the moment.

thanks ahead !
[Xperia Z3 Android Development] nailyk:
This recovery shouldn't hurt your device. Basically z3 and z3 dual difference is only modem.* files into /system/vendor/etc/firmware.

But to prevent any problem for your device, i highly recommend you the recovery upgrade. If you keep cm12.1 and something goes wrong, empty your recovery partition and you will find again the cyanogenrecovery.

Please keep me informed as i can make needed changes if needed.

P.S.: maybe try asking into your rom post which recovery other users install?
[Xperia Z3 Android Development] Sergen Setup:
Thanks for your reply.

I tried flashing using Cyanogen recovery's "Apply update" option, from external storage and had the following errors:

E: footer is wrong
E: signature verification failed
Installation aborted

I figured this method would only work if TWRP is already installed...

So I tried flashing with fastboot, but z3 was looping on the XPERIA SONY boot screen.

I also tried flashing the files from this thread but the same errors resulted.

I had to re-flash CM12.1 recovery image so I could reboot system normally.

On the other thread, Muhammad gives a third method which I haven't tried yet :

dd if=/sdcard/recovery-twrp-302-z3dual.img of=/dev/block/platform/msm_sdcc.1/by-name/FOTAKernel

I'm not sure if I should try "fastboot flash FOTAKernel" as I've never used this before. What do you think ?

What's the difference between "flash recovery" and "flash FOTAKernel" anyways ?
[Xperia Z3 Android Development] nailyk:
All the flashing method you tried are equivalent: they bit-to-bit copy the downloaded .img into the partition. The internal name of the partition is FOTAKernel and since older version of the bootloader a 'recovery symlink' had been added for fastboot so 'fastboot flash recovery foo.img' flash foo.img into FOTAKernel partition.

The bootloop at sony logo is more a '/init' problem. Init had been upgraded a lot between april and august and with the 'old boot process' the recovery and rom should remain compatible. So if you flash a recovery < april and a rom > august init compatibility is broken and you couldn't boot into recovery with the old boot process. (Here is a version which should remain compatible even for this recent issue)

What is your rom release date? Is your cyanogenmod official? What is your bootloader version? (can be checked with: "getprop ro.boot.s1boot" into cyanogenmod: more info into the OP).

(btw thanks for reminder, there is no official twrp release for z3dual, i should request at the same time)
[Xperia Z3 Android Development] Sergen Setup:
My rom is a nightly official, as of this morning it was cm-12.1-20161002-NIGHTLY-z3dual.zip, and I just updated to the lastest version: cm-12.1-20161602-NIGHTLY.

I choosed "Update Cyanogen recovery with system updates" in developer options, so I assume my recovery might have updated as well.

From "getprop ro.boot.s1boot" output, bootloader version is 1286-7314_S1_Boot_MSM8974AC_LA3.0_L_15.

I just tried flashing recovery_z3-20160414_1404.img, from your link above, but it is still Cyanogen recovery after rebooting.

Also, the md5 is different and seems to be wrong FYI.

Tinyupload.com file description:

recovery_z3_preprod_20160827.img md5: 68e13ab58eeb8cfcacfee13a48fa3041 sha1: 81ba75ff5eccbfcba804e102657d17edf5bf6eba

Local md5 check:

MD5 (recovery_z3-20160414_1404.img) = 70a22897f6b7cace772cd58e7846f224

Should I wipe some stuff before flashing?

Many thanks for your help!
[Xperia Z3 Android Development] nailyk:
No worries, when i choose to maintain twrp, assistance was included :)

I guess you flash 20161016 but between your both version it should be ok.

Btw thanks for information about md5, it mean i upload the wrong file!

I will made some tests this evening (~9 hours from now) and post you a new version.

It also mean in recent (official) version of cyanogen one of the volume key doesn't load the FOTAKernel recovery anymore. I will edit the post when i found more about this.

edit: no format needed for recoveries.
[Xperia Z3 Android Development] nailyk:
z3dual release

[MENTION=7799803]Sergen Setup[/MENTION]

Here is the experimental release for dual. zip (sha1: 6750bcd4eb989083ac0ce1f549c9d3e0822f4270 ) img (sha1: 9b4fde375d8868d421b772992a5ccf0c2eeb89c7 )

I have a weird issue, i can't boot the cm on my dev device anymore but the twrp works fine (old and new boot method), with the 20161018, 20161002 and my 20161012 releases.

I will stay ~1h on IRC if you need.
[Xperia Z3 Android Development] Sergen Setup:
Hey [MENTION=6979267]nailyk[/MENTION], thank you for your support.

I did not have time to open my laptop tonight so i will try flashing tomorrow morning and let you know.

I am not yet on IRC xda.
[Xperia Z3 Android Development] Sergen Setup:
And it's a success !

Now TWRP is ON (I love the new interface btw, flat, slick!), and CM12 is starting as usual.

Thanks again for your prompt replies [MENTION=6979267]nailyk[/MENTION]. Keep up the good work.

Next step for me is to learn how to build CM myself so I could taste the Nougat asap, and maybe learn more about TWRP because it's awesome !

edit: I see you're using leo and I just found out about paosp.co yesterday. I would love to try it but this would mean full backup, reset caches and all, so I need more time... what are the benefits compared to CM ?
[Xperia Z3 Android Development] nailyk:
off-topic: z3 dev status

Glad it works now, i will switch it to release into the OP asap.

Yes paranoid will require a wipe (/data without /data/media, /system) & reflash.

For cm 13.0 development you can take a look here, for N here and here is the status of the camera dev.
[Xperia Z3 Android Development] jacobs0n:
Hey [MENTION=6979267]nailyk[/MENTION], you directed me here from github. Thanks, I'll check this out, although my bootloader is not yet unlocked.
[Xperia Z3 Android Development] nailyk:
twrp z3c

Yes, the official twrp installation require bootloader to be unlocked. As unlocking wipes data, maybe you can take advantage of upgrading bootloader ;).

I have not uploaded the z3c twrp test for now :s I will upload it as soon as i go home.
[Xperia Z3 Android Development] nailyk:
New release

2016-10-17 release

release added into the OP.

[MENTION=7422664]jacobs0n[/MENTION] : here is the z3c test twrp (sha1: 079908ca94163ef37362d867911921b6ab9bfd3c). This one is 3.4 based so, for now, please watch the cpu heating on intensives tasks (backups especially).

On both releases, i had problems while restoring/flashing cm-12.1 (android <=5.1) on formatted /system partitions. It could be a selinux bug, we need to investigate.
[Xperia Z3 Android Development] jacobs0n:
Thanks, I will check this out!
[Xperia Z3 Android Development] yecomixer:
Concept rom works?
[Xperia Z3 Android Development] nailyk:
Sorry, I have never tested this rom. If they support the "extract-elf-ramdisk" boot method it will work. Anyway, If your bootloader is unlocked, it couldn't break your device.
[Xperia Z3 Android Development] shoey63:
The concept rom procedure is to fastboot the image to recovery, then use volume rocker buttons in the concept bootloader menu to reboot to recovery (now TWRP). Similar to Nexus devices. Obviously the bootloader has to be unlocked.
[Xperia Z3 Android Development] Draiden:
Does this recovery works with LA3.0_L_Hero_17 bootloader ? Can't mount system partition in twrp sadly.
[Xperia Z3 Android Development] nailyk:
Never be able to get Hero on my device but it is reported as working.

Is the recovery starting? If yes can you provide me the recovery.log and a dmesg and a link for the rom you are using please?
[Xperia Z3 Android Development] Draiden:
Rom was the N Preview 4. Installed your CM 13 boot img and then your recovery. Recovery was running fine only system partition was unable to mount. Currently intalling .200 Firmware to Test LA3.0_L_15.4 bootloader. Will report back :D.
[Xperia Z3 Android Development] Snowblond:
Hello. :)

I'm only able to boot to recovery when I turn off my device and start it again while pressing the volume down button. Is there any way to reboot to recovery regularly?
[Xperia Z3 Android Development] nailyk:
Using both on my test device and I'm playing a lot with /system partition ;) so something should be different, recovery logs will be the only way to debug.

I heard about a re-partition when 'hero' come. Also, with the Hero loader, is the same result when booting from Hero and from rom kernel?

Depend of your rom. In stock rom there is almost no ways with this recovery. Customs like cm, omnirom and paranoid should be fine.

If you are using customs roms, please try the vol+ button (only) while the led comes up at boot time.
[Xperia Z3 Android Development] Draiden:
Sorry nailyk already flashed .200 firmware with emma. It gaves me bootloader version LA3.0_L_37 and not the LA3.0_L_15.4. Nevertheless TWRP is mounting system partition again and i could flash. If you are still interrested, i can flash the hero bootloader at weekend and test again because i need my phone now.
[Xperia Z3 Android Development] nailyk:
Sure, I totally understand you need your device ;) I will add a log part into this thread too.

It could be interesting but, instead, I really appreciate to have it on a dev phone (specially for this thread) how do you install and downgrade it?

Also if you haven't formatted your internal storage yet maybe you still have recovery.log under your twrp/<serial>/<backup name>/ . Can you take a look please?

P.S.: for everyone who need quick answers I'm available on freenode#twrp , just introduce you came from an unofficial thread for the @ and +, then highlight me with your question.
[Xperia Z3 Android Development] Draiden:
Followed exactly your guide to upgrade (in this case downgrade) bootloader with Emma. Sadly Emma has wiped my internal storage so no recovery log sorry nailyk.
[Xperia Z3 Android Development] toc100:
noob question

Hello I'm going to receive my Z3 soon and i am planning to flash it with custom ROMs

but the recovery installation seems a little bit different from the devices i previously owned,

will highly appreciate if someone can confirm my steps are correct or not before i actually flash my phone

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

1. Extract boot.img from CM zip, place in platform tools

2. Enter fastboot mode (hold Volume Up & connect the USB cable)

3. Command window:

fastboot flash boot boot.img

fastboot flash FOTAKernel <filename>

fastboot reboot

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

There are several things not really clear to me,

regarding the file name, do we type in twrp_z3_20161017 or twrp_z3_20161017.img?

So basically the only files needed to download are twrp_z3_20161017 & CM rom (or whatever i wanna use)?

wonder if i missed anything here and does this method work on any versions of stock ROM? many thanks!
[Xperia Z3 Android Development] nailyk:
Hi,

Boot process is a little different on Sony's device as the bootloader is ... . You can read this confusing guide.

As you will get a new device, if you can upgrade your bootloader. It will provide you a real recovery access.

Anyway your step are the good ones.

For fastboot, every filename should be fully qualified, so for this twrp it will become 'fastboot flash FOTAKernel twrp_z3_20161017.img'.

Give a look at the boot guide, it explain there is two way to boot recovery. One with 'extract_elf_ramdisk', one directly.

Fell free to ask again on one of the both threads or on IRC.

Good luck!
[Xperia Z3 Android Development] toc100:
another noob question

Thanks for the reply,

does this method only apply on specific version of firmwares (Kitkat, LP..)?

since the title says "new BL only" so not really sure what other steps should be taken before flashing recovery, thank you.
[Xperia Z3 Android Development] nailyk:
I never tried installing unofficial firmware.

Yes upgrading boot-loader is done by installing 6.0 (aka .575) from official emma/flashtool Sony apps. Afaik some custom FTF flash customized bootloader (that is why I never flashed them).

To resume, there is two way to enter into recover for Sony Xperia serie, one independent from each other:

- Kernel with extract_elf_ramdisk support (only rom sources/builder can inform you)

- New bootloader.

Eg: One of my device doesn't have bootloader upgraded so when I flash stock, this recovery doesn't work.

The other one, with upgraded bootloader, can boot into this recovery, even when I format the rom.

One solution could be:

2. Extract boot.img from CM zip, place in platform tools & download twrp in the same folder

3. Check md5

4. Enter fastboot mode (hold Volume Up & connect the USB cable)

5. fastboot oem unlock <foo-bar>

6. Unplug USB

1moved. Upgrade your bootloader with emma,

7. Enter fastboot

8. fastboot oem unlock <foo-bar> (should answer you are already ROOTED)

9. fastboot flash FOTAKernel twrp.img

10. Unplug usb

11. Power on with vol+ & power

12. Enter recovery and install your custom rom.
[Xperia Z3 Android Development] Draiden:
Hey [MENTION=6979267]nailyk[/MENTION] i totally messed up my recovery i think. None Partition can be mounted and MTP Connection is also not working. I copied recovery log file from temp ordner over micro sd to my pc.