yashsingh1/xdaforums huggingface dataset:
[Sony Cross-Device General] cartmenicus:
Nonim thinking you take twrp recovery parts not the whole boot.img and extract the twrp recovery files and use them instead of cwm not neccesairly a flash.:)
[Sony Cross-Device General] CosmicDan:
Oh right, same way you root and install CWM on a locked bootloader it goes on system partition. I have no idea how to do that though because you need to edit ramdisk exports for TWRP.

Sent from Xperia Play (R800a) with Tapatalk
[Sony Cross-Device General] cartmenicus:
Yeahh haha nor do I jw if possible lol:) sorry champ for clogging up your thread
[Sony Cross-Device General] partner22:
I can't access http://smartdev.com.pl:8080. It always tell me ERR_TIMED_OUT
[Sony Cross-Device General] championswimmer:
i'll talk with pikpok and get to know what's up with that :p

he hosts the gerrit
[Sony Cross-Device General] partner22:
Thanks !:good:
[Sony Cross-Device General] Dees_Troy:
I pushed up the following changes to the CM repos for the Xperia T (mint) and they have been accepted. Similar changes will be pushed for CM10 as well as for fuji-common and Xperia S (nozomi):

http://review.cyanogenmod.org/#/c/30309/

http://review.cyanogenmod.org/#/c/30311/

The short version is that these changes will allow users to flash whatever recovery they want to the FOTAKernel partition that effectively isn't used for anything on an unlocked device. If you choose to boot recovery then the boot image will extract the ramdisk from the FOTAKernel partition and use that ramdisk for recovery if the ramdisk in the FOTAKernel partition isn't a stock Sony ramdisk. If you don't have a custom recovery flashed to the FOTAKernel partition then the boot image will boot the recovery that's included in the boot image.

Unfortunately this method doesn't provide safety against flashing a bad boot image as you're still using the kernel from the boot image, but this setup does make it easier for users to choose to run an alternative recovery than what a developer might choose to include in his boot image. However, for this method to work, the developer does have to include the ramdisk extraction tools and methods.

Eventually I hope to see Sony move to a normal recovery that can be booted directly with a key combo so that we don't have to depend on things in the boot image. A proper recovery setup provides a measure of safety for users by allowing them to have a fallback for an unbootable device that doesn't require a computer to fix so that you can safely flash on the go.

I hope that all kernel and ROM developers will adopt a method like this so that we can allow users to choose what recovery they would like to run while not expecting devs to produce multiple versions of boot images for each release.
[Sony Cross-Device General] DooMLoRD:
very nice implementation!

i am sure most kernel devs will adopt this approach soon...

the best approach would have been to make the FOTAKernel accessible irrespective of the main kernel...

may be time to look closely at those initial boot partitions of device mmcblk0...

[B][I]lrwxrwxrwx 1 root root 20 Jan 16 17:32 Boot -> /dev/block/mmcblk0p2
lrwxrwxrwx 1 root root 20 Jan 16 17:32 Boot2 -> /dev/block/mmcblk0p3[/I][/B]
lrwxrwxrwx 1 root root 21 Jan 16 17:32 Cache -> /dev/block/mmcblk0p13
lrwxrwxrwx 1 root root 21 Jan 16 17:32 FOTAKernel -> /dev/block/mmcblk0p11
lrwxrwxrwx 1 root root 20 Jan 16 17:32 Kernel -> /dev/block/mmcblk0p4
lrwxrwxrwx 1 root root 21 Jan 16 17:32 SDCard -> /dev/block/mmcblk0p15
lrwxrwxrwx 1 root root 21 Jan 16 17:32 System -> /dev/block/mmcblk0p12
lrwxrwxrwx 1 root root 20 Jan 16 17:32 TA -> /dev/block/mmcblk0p1
lrwxrwxrwx 1 root root 20 Jan 16 17:32 TZ -> /dev/block/mmcblk0p5
lrwxrwxrwx 1 root root 21 Jan 16 17:32 Userdata -> /dev/block/mmcblk0p14
lrwxrwxrwx 1 root root 21 Jan 16 17:32 apps -> /dev/block/mmcblk0p10
lrwxrwxrwx 1 root root 20 Jan 16 17:32 fsg -> /dev/block/mmcblk0p8
lrwxrwxrwx 1 root root 20 Jan 16 17:32 modemst1 -> /dev/block/mmcblk0p6
lrwxrwxrwx 1 root root 20 Jan 16 17:32 modemst2 -> /dev/block/mmcblk0p7
lrwxrwxrwx 1 root root 20 Jan 16 17:32 ramdump -> /dev/block/mmcblk0p9
[Sony Cross-Device General] Dees_Troy:
The only way to fully expose FOTAKernel to be used like a normal recovery would be to modify the bootloader itself. Technically you can boot directly to FOTAKernel by modifying the correct contents of the TA partition in mmcblk0p1. I haven't tried this though as it's moot. There's no key combo to boot to the FOTAKernel partition so there's no way to use it if you end up in an unbootable state (bad kernel/boot image, bootloop, etc) so we're stuck using boot until Sony themselves does something about this. Also, from what I've been told, trying to boot the FOTAKernel partition when you're not supposed to doesn't actually work due to bootloader restrictions.

We don't have source for the bootloader and messing around with the bootloader is dangerous. If you break the bootloader the device will be a brick that only something like a jtag can fix.
[Sony Cross-Device General] championswimmer:
Re: [RECOVERY] TWRP 2.3 for all your Xperias. (downloads + DIY howto)

Sony has always been a great helper of the community of late. And i wish the provide updated bootloaders in future firmwares and all future phones that have physical combination for recovery

But we still need to understand, xperia's already have 2 boot modes other than the normal one. That makes it cagey to implement on devices like my Xperia V where there are only vol up and down keys other than power key.
[Sony Cross-Device General] Dees_Troy:
I believe that the plan was to use volume up without the USB cable being plugged in to get to recovery.
[Sony Cross-Device General] Wechy77:
Re: [RECOVERY] TWRP 2.3 for all your Xperias. (downloads + DIY howto)

@leo_nidas

http://xdaforums.com/showthread.php?p=36575186

With text editor edit the /sdcard/TWRP/.twrps Changing "tw_backup_boot 1" to "tw_backup_boot 0" fixes the "Unable to locate boot partition" error...

(edit with notepad++ on pc or build in text editor on phone)
[Sony Cross-Device General] leo_nidas:
Changed and Working :D thanks
[Sony Cross-Device General] CaG00:
Hi,

I have a problem. When i compiled kernel with patche's from M66B (including TWRP) i can't enter to the TWRP (volume - and nothing). But when i uncomment KXP_INCLUDE_TWRP := true kernel does't boot, no display first splash screen (with out patch for TWRP from M66B). Anybody can help?
[Sony Cross-Device General] puppet13th:
TWRP working on satsuma Active stock kernel 587(patched bootloader)

i have manage to port TWRP to work on stock kernel by the instruction from OP

- compiled kernel from sony source (ics build 587)

- decompiled twrp2.3-boot-satsuma.img

- replaced zImage (compiled from sony source)

- replaced ramdisk.cpio (original ramdisk from stock kernel)

it's look like all feature are working correctly

backup --> ok

restore --> ok

attached recovery.log

i'm planing to port TWRP to stock rom with locked bootloader.

i have test it on Acro S using chargemon and recovery.tar

TWRP boot correctly :

current issue --> /system was mounted RO --> cannot unmount --> error message : resource busy

i will get some log later.

currently i have 3 device at hand --> Xperia Active,Xperia Sola and Xperia Acro S

hopefully someone can help me port TWRP to stock rom wih locked bootloader. cheers . . . :o
[Sony Cross-Device General] cartmenicus:
Re: [RECOVERY] TWRP 2.3 for all your Xperias. (downloads + DIY howto)

Ill helpbyou test on lb pm me:) I have the T!:)
[Sony Cross-Device General] Tha TechnoCrat:
Re: [RECOVERY] TWRP 2.3 for all your Xperias. (downloads + DIY howto)

Can I port it to X10 mini? E10i
[Sony Cross-Device General] puppet13th:
Re: [RECOVERY] TWRP 2.3 for all your Xperias. (downloads + DIY howto)

Ported TWRP to stock rom + stock kernel + locked bootloader

Using hijacked chargemon and recovery.tar

Issue : /system partition was mounted read only

So we cant work on /system partition

This case was also encountered at nAa CWM 5.0.2.7r1 for 2011 Xperia and the problem was fixed on 5.0.2.7r2

The recovery binary was recompiled with fixes for /system partition.

Hopefuly op can recompile TWRP binary with that fixes.

Recovery log and dmesg : http://db.tt/BGAdW1qn
[Sony Cross-Device General] CosmicDan:
Most ramdisks mount /system as read-only for security means. The init process remounts ro at the on-fs stage, before that it's rw. In other words, this is not a bug. If you want system rw then change your init.rc to not remount as ro.

If you mean Recovery can only mount read-only, check filesystem for errors. Because mount command will mount rw by default unless it encounters filesystem error.
[Sony Cross-Device General] DooMLoRD:
Re: [RECOVERY] TWRP 2.3 for all your Xperias. (downloads + DIY howto)

There are files probably open from /system device... Try force unmount, loose unmount or something similar...
[Sony Cross-Device General] puppet13th:
Re: [RECOVERY] TWRP 2.3 for all your Xperias. (downloads + DIY howto)

When we booted to Recovery like CWM or TWRP,we could mount/remount/umount partition at will.any other partition can be mount/umount except /system partition.

This caused by hijacked chargemon script to start recovery mode.

In that script,system partition was unmounted with command :

umount -l /system

If OP can recompiled the recovery binary with that fixes,i'm sure it will works.
[Sony Cross-Device General] CosmicDan:
Can't you just unmount /system before starting /sbin/recovery yourself in the init script?
[Sony Cross-Device General] puppet13th:
Re: [RECOVERY] TWRP 2.3 for all your Xperias. (downloads + DIY howto)

We're talking about porting TWRP to stock kernel with locked bootloader.

The only known method to enter recovery mode was using hijacked chargemon and recovery.tar

The chargemon it self was reside at

/system/bin/chargemon
[Sony Cross-Device General] CosmicDan:
So how does it execute the recovery binary? Is chargemon an sh script that unpacks the recovery.tar and then executes /sbin/recovery?
[Sony Cross-Device General] DooMLoRD:
Re: [RECOVERY] TWRP 2.3 for all your Xperias. (downloads + DIY howto)

Yes..
[Sony Cross-Device General] puppet13th:
This was fixes for CWM pinpointed by pvyParts as he have compiled CWM 5.5.0.4 for Xperia 2011 locked bootloader and encoutered same problem (/system partition mounts).He asked nobodyAtall how to fix the problem in [RECOVERY][14/11/11] 5.0.2.7-nAa-r2 ClockworkMod for Stock Xperia Mini/Pro/Active/Arc

/system mounts fixed at nobodyAtall github : https://github.com/MiniCM/android_bootable_recovery/commit/3fbddce6dce90a865356e33e933284b8fa84a6d0

hopefully this can help to port TWRP for stock kernel with locked bootloader

files used in TWRP/CWM Recovery for locked bootloader

/system/bin/chargemon --> script

/system/bin/recovery.tar --> recovery ramdisk

/system/xbin/sh --> busybox shell

attached chargemon script
[Sony Cross-Device General] CosmicDan:
Well in the chargemon script I see this:

# Umount /system
#umount -l /dev/block/mmcblk0p12

So if you uncomment that or replace it with:

umount -l /system

Wouldn't that be what you want to achieve?

As for the TWRP Format /system not working and needing to be replaced with rm, I don't think that code is needed it could be replaced with this device flag (or this flag can be updated for locked Xperia devices):

EDIT: Wait, that extendedcommands.c patch is only for update-binary isn't it? Or for scripts from ROM Manager/OTA updates? So that's not essential.

EDIT2: OK I see, so you may still need to recompile TWRP to specifically mount /system as rw. That would be in partitions.c, similar to the change I made for working with ext#.img files on loopback mounts.
[Sony Cross-Device General] puppet13th:
Re: [RECOVERY] TWRP 2.3 for all your Xperias. (downloads + DIY howto)

That chargemon sample was from Xperia 2012 CWM

Even if i uncomment that line, /system partition was unmounted.l,then we will not be able to mount /system partition (error : resource busy )

Btw i'm not good with programing. :D
[Sony Cross-Device General] CosmicDan:
Strange. So is mmcblk0p12 still the system partition for your device? If so, try to replace command with this:

mount -o remount,rw /dev/block/mmcblk0p12 /system >> /cache/tmp.log

And check contents of /cache/tmp.log after you boot into recovery; if it's blank then it means it remounted rw without errors. So check mounts in "mount" command manually to verify that /system still is rw. If it isn't, or if TWRP can unmount it but not re-mount it, then I guess TWRP needs a code change that I don't know about.
[Sony Cross-Device General] puppet13th:
mounts :

mount system rw :

umount system :

umount -l system :

it's look like this trick can slove the problem without modifying the source code :

init.rc from recovery ramdisk need tobe modified :

:)
[Sony Cross-Device General] DooMLoRD:
no need to modify recovery ramdisk... just modify chargemon script
[Sony Cross-Device General] CosmicDan:
Re: [RECOVERY] TWRP 2.3 for all your Xperias. (downloads + DIY howto)

Ah OK, makes more sense now. System cannot be unmounted because its running chargemon still to return from init. To possibly eliminate the need for lazy unmount, make it execute charger only on else instead of outside/after if. Then make it execute ramdisk init without waiting to exit with ampersand. That should close all open handles to /system.

Example:

# Umount /system
umount -l /dev/block/mmcblk0p12

# chroot
chroot / /init&

else
# Continue booting
/system/bin/charger
fi

Sent from Xperia Play (R800a) with Tapatalk
[Sony Cross-Device General] puppet13th:
modified chargemon scrip

# Umount /system
# umount fix
mount -o remount rw /system
umount -l /system

problem sloved now. :laugh:

current test :

backup --> ok

restore --> ok

it's look like it's time to start porting TWRP for locked bootloader.
[Sony Cross-Device General] CosmicDan:
Re: [RECOVERY] TWRP 2.3 for all your Xperias. (downloads + DIY howto)

Heh that's odd. Glad its solved though.

Sent from Xperia Play (R800a) with Tapatalk
[Sony Cross-Device General] championswimmer:
-thanks for the donations-
[Sony Cross-Device General] CosmicDan:
I donated a few dollars :)
[Sony Cross-Device General] leon22heart:
Same here .Will TWRP be updated to the 2.4 version ?
[Sony Cross-Device General] championswimmer:
yes will be updated to 2.4 and the kernel backup bug on 2011 shall also be fixed

had been busy with life for the past few days

also Przemek mentioned to me that more than 20PLN has been already received out of the needed 50PLN, so thanks guys :)
[Sony Cross-Device General] championswimmer:
Re: [RECOVERY] TWRP 2.3 for all your Xperias. (downloads + DIY howto)

2.4 is available on the mirror link
[Sony Cross-Device General] CosmicDan:
THat was quick :). I read a release article for 2.4 changes, but it didn't seem to be too detailed. What are the major new changes in 2.4?
[Sony Cross-Device General] championswimmer:
official changes are pretty much summed up here

http://teamw.in/project/twrp2

as far as my release is concered, they are all merged up with the latest changes, AND, i have patched up the /boot partition checking bug (as per our commit).

so basicially, though i dont have any 2011 devices, it should work flawlessly on them too.

bug reports are more than welcome
[Sony Cross-Device General] CosmicDan:
Ah OK so it's nothing major on GUI, mainly just internal stuff.

Nice work on the boot patch, I will use that since I discovered my first one didn't work :P
[Sony Cross-Device General] adulfo:
Can't turn on WIFI... I even flash wifi modules of LUPUs V4.. I have Ray..
[Sony Cross-Device General] championswimmer:
please download the wifi modules as mentioned in OP
[Sony Cross-Device General] championswimmer:
that's because you didn't set it as a C flag (it was only a makefile flag, but C code reads only C flags ;) )
[Sony Cross-Device General] scanno:
Re: [RECOVERY] TWRP 2.4 for all your Xperias. (downloads + DIY howto)

I have a tablet that does not have a key combo to get into recovery, but it does have a recovery partition. The only way to get into recovery is to change the misc partition. I guess that is the TA partition on the T?

There is a c program that writes the correct data in the misc partition and when the device is rebooted, the recovery image is loaded from the recovery partition.

Perhaps this can be done here too? The FOTA partition can be the recovery partition.

Verstuurd van mijn TF300T met Tapatalk
[Sony Cross-Device General] CosmicDan:
Ah I remember now lol. Only just had my linux PC repaired and now I see.

You don't seem to have bootable_recovery on github, so I assume you have not forked TWRP at all, correct?
[Sony Cross-Device General] Wechy77:
i made some of themes for twrp. (Xperia Ray, 2011 line) (downloaded and edited theme surce from twrp site)

I wanted to add battery % text into my themes, but if i use "official" source it doesn't show

<object type="text" color="%text_color%">
<font resource="filelist" />
<placement x="240" y="70" />
<conditions>
<condition var1="tw_no_battery_percent" var2="0" />
<condition var1="tw_battery" op=">" var2="0" />
<condition var1="tw_battery" op="<" var2="101" />
</conditions>
<text>Battery: %tw_battery%</text>
</object>

If i use it without conditions it shows Battery: -1%

My question is, why TWRP can't read battery info, any idea?
[Sony Cross-Device General] championswimmer:
no i didn't fork

i made a patch on their gerrit

see it here

http://review.teamw.in/#/c/466/
[Sony Cross-Device General] vdsirotkin:
hi champion) i've got a problem. i've ported your recovery to stock JB kernel for Xperia V, but when i enter recovery - it's black screen, though adb find my device and says that it's in recovery mode. any ideas? thanks in advance
[Sony Cross-Device General] spida_singh:
@vdsirotkin

The issue and details for a fix is outlined in this thread, it's a 3.4 kernel change.

I'm looking to try and get a V kernel running, but having issues.

Let us know if you have any luck.
[Sony Cross-Device General] Dees_Troy:
Do you have a link to the source code for this program? I would love to take a look.
[Sony Cross-Device General] jerdog:
Maybe, you know, tell us a little bit more about this device? Like brand, model, etc.?
[Sony Cross-Device General] CosmicDan:
That sounds awful. Couldn't a touch /cache/recovery/boot situation (e.g. app from ROM or adb shell) provide that?

If your tablet has *any* hardkey, I'm sure it still has a valid event# to cat from.
[Sony Cross-Device General] scanno:
Re: [RECOVERY] TWRP 2.4 for all your Xperias. (downloads + DIY howto)

The bootloader does not support a key combo to boot to recovery.

My device config for the tablet.

https://github.com/scanno/android_device_nvidia_shuttle

Search for setrecovery directory

You can also have a look at the tf300t from Asus. It uses the same principle.

Verstuurd van mijn Xperia T met Tapatalk
[Sony Cross-Device General] Dees_Troy:
This is the "AOSP way" of telling a device what to boot. The Xperia T's TA partition setup is very different. Booting FOTAKernel at this point is still just theoretical. It may not be possible depending on limitations.
[Sony Cross-Device General] CosmicDan:
Re: [RECOVERY] TWRP 2.4 for all your Xperias. (downloads + DIY howto)

Neither does Xperia 2011 bootloader. Its all done in kernel ramdisk scripts.

Sent from Xperia Play (R800a) with Tapatalk
[Sony Cross-Device General] Tha TechnoCrat:
Re: [RECOVERY] TWRP 2.4 for all your Xperias. (downloads + DIY howto)

@dees_troy Can the recovery be ported to the Xperia X10 mini?

Sent from my Droid DNA powered by Senseless DNA
[Sony Cross-Device General] CosmicDan:
Re: [RECOVERY] TWRP 2.4 for all your Xperias. (downloads + DIY howto)

It can be ported to anything as long as it has working AOSP tree.

Sent from Xperia Play (R800a) with Tapatalk
[Sony Cross-Device General] someone755:
Hello!

Even though you did a great job and I love TWRP, this annoys me...

For some reason, I cannot mount /system...

And when I say I can't I mean 'never'. I just keep getting the E:Unable to mount /system...

I CAN wipe it (that's weird, right? can't mount but can wipe), but I can't install any ROM... (I'm on CM 10 and want to install either PA or PAC...)...

I also tried with the official TWRP release (found on the TWRP site, it's basically just the stock kernel)(I've already wiped everything, so compatibility shouldn't be an issue... right?), but the same happens...

System is unmountable, yet wipe-able, but I can't flash any ROM...

I only want to ask if you have any idea what the problem might be and how to fix it (and I'm using TWRP till the end :P )

[Sony Xperia S]

EDIT:

Nevermind, it decided to fix itself...

My phone is weird... -.-
[Sony Cross-Device General] Djocker:
TWRP For Xperia J.

I need TWRP for my Xperia J, cant you help me..... PLEASE................:crying::crying::crying::crying::crying::crying::crying:
[Sony Cross-Device General] puppet13th:
Bugs on TWRP 2.4.1.0

i found bugs on TWRP 2.4.1.0

- Permission,uid and gid was not stored properly

backup using compression

Restore from backup (created using TWRP 2.4.1.0) --> some files or folder got root UID and GID

Restore from backup (created using TWRP 2.3.3.0) --> OK

attached recovery.log when creating backup
[Sony Cross-Device General] Djocker:
Re: [RECOVERY] TWRP 2.4 for all your Xperias. (downloads + DIY howto)

This is work on xperia J?
[Sony Cross-Device General] championswimmer:
not yet

wait for it
[Sony Cross-Device General] c1ph4:
I really like this.

No issues so far, except: Reboot into recovery isn't working.

Using this feature sometimes in AOKP. The phone just reboots normally, so it could also be ROM related.

Anyway, thanks for this release!

BTW: Some more governors would be appreciated. :p
[Sony Cross-Device General] bigbiff:
Thanks for the report. We have debug on in restore. Can you post your restore recovery.log as well?
[Sony Cross-Device General] neerajrk37:
first of all thanks of this kernal man.

i m already using twrp 2.3 for my xperia neo v with jb pac man 19.3.0. i wanted to ask if i should format and wipe all the dat before flashing. or because this is an update for my kernel should i just update with the flashtool.

thank you.

and wat do u mean by fastboot in terminal command(is it using terminal emmulator).

pls reply asap
[Sony Cross-Device General] championswimmer:
using flashtool is cool

wiping not needed
[Sony Cross-Device General] M66B:
Is gerrit at http://smartdev.com.pl:8080/ not available anymore?
[Sony Cross-Device General] championswimmer:
the VPS has taken a hit (DDOS) and hence the VPS provider has stalled it for sometime

we expect it to be up in a day or so
[Sony Cross-Device General] M66B:
That's bad. Happened one time to me too. There is not much you can do.

Your VPS provider should have DDOS protection, it is worth to pay a few dollars extra for that (or switch provider).

Is there any other way to get the patches for building from source for Xperia 2011 devices?
[Sony Cross-Device General] championswimmer:
https://github.com/KangXperiaProject/android_device_semc_mango/commits/jb

the commit "device config for TWRP" should do it for you

other things to keep in mind

use CM10's build folder (i have not checked on anything else)

you should have the recovery ramdisk split patch already enabled. (if you are using the older combined ramdisk this wont work)

********

YOU"LL NEED THIS PATCH TOO

https://github.com/KangXperiaProjec...mmit/f769dc26f6dc867fbb8fd236ccf4a654a53e79c4

(and if not using latest TWRP source then this patch should be present http://review.teamw.in/#/c/466/)

it is already merged in latest TWRP by dees_troy though
[Sony Cross-Device General] M66B:
Unfortunately this is not enough to build a working TWRP for FXP releases. I had to patch a lot more for 2.3, for example all system calls, pthread_cancel, miniadb and reboot to recovery. I was hoping this was already fixed in 2.4, but it appears not to be. I don't want to reinvent the wheel, so I was looking if I could find an already patched 2.4.

See here for the my 2.3 patches.

Edit: just discovered 2.4 is on a new branch ...

Edit #2: TW_FLASH_FROM_STORAGE := true is default now