[Upgrading, Modifying and Unlocking] steadfasterX:
TWRP Recovery for the LG F3Q

(codenames: fx3q, d520)

Background story (who ever wants to know):

As I'm currently testing around with flashing etc I hated it to re-flash the stock ROM again and again. It is sooo time consuming..

In that kind of ROM compiling learning process I also was able to build a working TWRP recovery for the LG F3Q so that was such a good feeling :D But as said the caveat was that because of the locked bootloader we can reach TWRP (or CWM) only when executing "adb reboot recovery" from the running system. That was not really satisfying me though..

Some day I've done a factory reset and well I saw that this is starting my TWRP recovery when executing it! Well it isn't such a surprise as TWRP sits on the recovery partition and will be triggered by the factory reset script but... well do you think what I think? When it would be possible to start TWRP fully and not that factory reset part of TWRP than we would have a workaround to reach the recovery mode without booting the system (which is in fact not possible anymore when flashing of system.img/boot.img fails)

That said.. I was in touch with the TWRP developers bigbiff and Dees_Troy and many thanks for the hint they gave me! I have build a new TWRP version based on that information I got and well the idea of that is:

Vol Down + Power -> LG Factory Reset screen appears

Confirming with power 2 times as asked

Voila: No factory reset anymore but TWRP is here!

Well that will

have a caveat

- READ CAREFULLY:

As you may think of the factory reset in the boot-up process and within the ROM will not working anymore until you flash another recovery!

But if you know that it is not such a caveat because you can choose the wipe options within TWRP to do a "manual" factory reset.

v2.8.1.0 build 5

USE THAT ON YOUR OWN RISK! BACKUP BEFORE!

Working (quickly tested):

Install (to flash a custom Kernel)

Mounting partitions

Reboot Recovery | System

adb shell (also see known issues)

Backup (compressed | uncompressed | encrypted (!) | unencrypted)

Restore (unencrypted | encypted (!) | compressed | uncompressed)

Internal storage /data/media

MTP which mounts the external storage!

File Manager

Terminal Command

Power charging while in TWRP

Displaying CPU temp

Totally untested:

WIPE (should work)

decrypting /data (but should work as it do so for encrypted backups already)

Every option which is not stated as "Known issue" or "Working"

Known issues (with workarounds):

ADB works only when screen "timed out" (manual locking does not help it must time out) therefore ADB can take up to 1 minute after boot until it becomes available (because screen need to be timed out first)

Workaround: set the time limit in the screen menu to e.g. 10 sec (that is the default value for now)

Timezone is not set correctly (that seems to be a well known bug in several devices using TWRP.... )

Workaround: set a timezone which displays the most accurate timezone

Known issues (without workarounds):

When you use the "Power Off" option in the "Reboot" menu the device will reboot instead of powering off

Wiping /data not possible after "factory reset buttons" used. You need to choose "wipe" and then "format data" manually (or use mke2fs on CLI).

Vibration is not working (I will not fix that atm because I like it that way)

Hardware keys at bottom doesn't work

If you use the factory reset button /data partition will be inaccessible and need to be re-flashed (means you will LOOSE your app and system configs when you use factore reset)

Download:

Attached you will find the TWRP v2.8.1.0 version ready to use even with locked bootloader:

BACKUP EVERYTHING BEFORE USING THIS. USE AT YOUR OWN RISK!

DD Image file:

twrp_v2.8.1.0_build5_fx3q_FR-OFF.img.zip

= FactoryReset is disabled / TWRP will be loaded instead (also see known issues)

Read the Installation & Usage instructions in this thread on how to install that file.

Installation & Usage instructions

Pre-Requirements

Read the FAQ

YOU NEED ROOT! (check FAQ)

YOU SHOULD

do a NANDroid BACKUP!

(check FAQ)

You need to boot up, enable USB debugging and then connect USB cable.(check FAQ get ROOT - the link contains a guide on that)

You better doing a NANDroid backup right? (I mentioned that before - but DO it! NOW!)

For the best usage experience install the sediKERNEL or use joel's debloated stock ROM which includes it already

Bulletproof Method 1: "the average user"

Use this guide if you simply want to install & use TWRP like it should be. If you're unsure use this guide!

Install:

Download the TWRP recovery file and unzip it

copy it to your device (e.g. adb push or simply copy & paste by your file browser)

Download the loki_tool (https://github.com/djrbliss/loki/raw/master/bin/loki_tool)

copy loki_tool to your device (e.g. adb push or simply copy & paste by your file browser)

execute:

adb shell

su (you may need to grant permission)

mount -oremount,rw /system

cp /PATH-WHERE-YOU-COPIED/loki_tool /system/bin/ && chmod 755 /system/bin/loki_tool

loki_tool flash recovery /PATH-WHERE-YOU-COPIED/twrp_X.X.X.X_recovery_FRoff/off.img

reboot recovery --> you should see the TWRP screen

Usage (sediKERNEL v2.0 or higher installed):

Power on the device

when you see the LG logo the first time do

NOTHING

!!

When the screen goes black THEN press Volume UP + Volume DOWN. Both

the same time and hold them

pressed.

Release the buttons

when the screen goes black again

Wait. You will see the LG logo a third time and then you will see the recovery screen!

If you see a kernel crash then you have pressed the magic keys too early! Read and follow the above steps carefully and you should be fine.

Usage (without sediKERNEL v2.0 or higher):

boot into your ROM

execute "adb reboot recovery" from your PC or open a Terminal on your device and execute "su" then "reboot recovery"

Bulletproof Method 2: "developers only"

This is

the developers preferred way of installing TWRP

. It ensures that even when your ROM or Kernel gets damaged that you still be able to boot into recovery. This is to the developers or heavy testers who are knowing what they do ONLY!

But even when you think this is for you: Read the important hint at the end before deciding if you want to choose this method.

Install:

flash recovery image to your RECOVERY partition:

adb shell su -c dd if=/storage/external_SD/twrp_vXXXXX_fx3q_FR-OFF.img of=/dev/block/platform/msm_sdcc.1/by-name/recovery

adb reboot recovery

A user reports the the by-name does not worked for him but this one:

adb shell su -c dd if=/storage/external_SD/twrp_vXXXXX_fx3q_FR-OFF.img of=/dev/block/mmcblk0p17

-> If you can see TWRP now everything is fine - Otherwise DO NOT continue!

BACKUP YOUR WHOLE DEVICE NOW! I highly recommend to backup everything except /data from within TWRP because it is easy and works (from TWRP v2.8build5 or higher)

BACKUP /data is recommended to be done NOW and this way:

adb shell su -c dd if=/dev/block/platform/msm_sdcc.1/by-name/userdata of=/external_sd/userdata_backup_stock.img

--> This can take a long while but it contains also the backup for the internal storage not only /data and that internal part is not backupable over TWRP

while in TWRP flash the same recovery image to your BOOT partition now (do not think that this is dangerous. The boot partition is not a magic thing or so it is only the partition which will be started from the bootloader thats all about it. So yes you can install a recovery image on the boot partition without any harm.):

adb shell su -c dd if=/external_sd/twrp_vXXXXX_fx3q_FR-OFF.img.loki of=/dev/block/platform/msm_sdcc.1/by-name/boot

watch carefully that the process ended without errors and that the size is exactly the same as it should be (about 1,3GB)

adb shell sync

power off the device by taken out the battery (do not use reboot or something we want to be sure that the next step is absolutely really the normal boot up)

Boot up normally --> you should see TWRP !! You're NOT in recovery mode you're booting the normal boot mode!

Go on with flashing the sediKERNEL into your RECOVERY partition:

Download the sediKERNEL from here (the stock one could work, too but never tested ...)

push it to your device with adb or MTP (since v2.8build5) ;)

Flash the sediKERNEL to your RECOVERY partition:

adb shell su -c dd if=/external_sd/sediKERNEL_JB-vXXXX.img of=/dev/block/platform/msm_sdcc.1/by-name/recovery

Reboot into Recovery by using TWRP GUI or by executing "adb reboot recovery"

Your ROM will boot.

Usage:

From now on every time your device booting up you will see the TWRP screen and need to choose Reboot-->Recovery to boot your

ROM

.

This is the absolute best way to use TWRP if you want to be sure that you will reach the recovery even when your ROM gets damaged and is confirmed to work very well (as always guarantees are not available ;) )

Important hint:

Be sure that you keep in mind that from now on your recovery and boot partition are not the same anymore (you can always revert back to the normal behaviour, of course!).

So if you want to flash a kernel image you need to ensure that it goes to the RECOVERY partition instead of the normal BOOT partition

(because on boot partition is TWRP now).

If I got my ROM working I will definitively add an option to the installer where this will be ensured and I asked [MENTION=5720423]joel.maxuel[/MENTION] for his stock ROM to add that, too. As for now we are the only ones who are developing for the F3Q so you should be save enough atm but you will need to keep that always in mind when you want to replace the kernel and/or ROM.

What would happen if you forget about that? Well nothing really bad because when you install a kernel or ROM the boot image partition simply gets overwritten and that means only that your TWRP is not there anymore but the system will boot (if the new kernel/ROM is not buggy or damaged). You then could install TWRP by method 1 or using method 2 by using the boot image/Kernel you want to install.

Damage your device - booting (NOT RECOMMENDED will loose /data ):

You probably NEVER want to use this method. It is here for reference only.

I highly recommend to choose one of the above bulletproof versions instead of this one because it WILL damage /data and you need to restore that whole partition afterwards.

All my tests has shown that this comes not from TWRP (in one of my tests I disabled everything in the sourcecode of TWRP which wipes /data) but coming from LG itself. The factory reset button/option do something with the /data partition sturucture and afterwards you cannot use that anymore. I also tried to restore the partition info by trying all backup superblocks but that doesn't worked. No backup superblock is accessible.

Restoring them by mke2fs and e2fsck does not work unfortunately.. (mke2fs -S /dev/block/platform/msm_sdcc.1/by-name/userdata && e2fsck -yf /dev/block/platform/msm_sdcc.1/by-name/userdata)

So if you have loosed your /data and/or internal storage you need to have a DD imaged backup near.

Install:

same as for "Bulletproof Method 1" above

Usage:

When you choosen FR-OFF then TWRP will be able to start without booting up the whole system (also see known issues):

Power Off the device (remove battery)

Vol Down + Power --> Then put the battery back --> LG Factory Reset screen appears

Confirming with power button 2 times as asked - if you downloaded and flashed the FRoff version of TWRP it will NOT open the normal reset procedure but /data and the internal storage are not accessible afterwards (read above about the details). That means your app configs and systems configs get lost that way. You have been warned!

Voila: No (full) factory reset anymore but TWRP is here when you have damaged your ROM or for some dev approach

If you want the factory reset back simply choose the file twrp_2.7.1.0_recovery_FRon.img.lok and follow the above instructions. Afterwards you will have TWRP but it will be reachable only when you execute "adb reboot recovery" from the running system.

XDA:DevDB Information

sediTWRP for LG Optimus F3Q, Tool/Utility for the General Discussion

Contributors

xdajog

Source Code: https://github.com/xdajog/bootable_recovery_twrp_fx3q

Version Information

Status: Stable

Current Stable Version: v2.8.1.0 build 5

Stable Release Date: 2014-11-18

Created 2015-05-19

Last Updated 2015-07-20