[LG G5 ROMs, Kernels, Recoveries, & Other Developme] svetloslav:
A Complete guide to H840 newest European variant (unlock bootloader, update with latest kdz, TWRP, root)

I spent a whole day reading around and trying on my G5 SE. Let me tell you at moments I thought I had bricked it. The procedure was performed on Windows 10 64bit. I received a lot of information from Autoprime's All-in-One G5 Thread and downloaded many things at codefire, to those and to the others I am greatly thankful. Below the essence of all my efforts.

1.	Unlocking the bootloader.

1.1	Get the latest drivers: ( http://tool.lime.gdms.lge.com/dn/downloader.dev?fileKey=UW00120120425 )

1.2	Get ADB fastboot. If you hate installing huge files for just a few commands, you have 3 options:

-	MINIMAL ADB and fastboot: (https://xdaforums.com/showthread.php?t=2317790 )

-	15 seconds ADB Installer v1.4.3: (https://xdaforums.com/showthread.php?t=2588979 )

-	SDK Platform-Tools coming directly from google: (https://developer.android.com/studio/releases/platform-tools.html )

I personally went with the “15 seconds ADB Installer v1.4.3”, because it installs also a Google driver, which might, or might have not helped out in the process to follow.

1.3	Follow the instructions at the official LG unlocking page ( https://developer.lge.com/resource/mobile/RetrieveBootloader.dev ), just keep in mind that after step 1.2 you have adb ready to go @ your main drive C:\adb. You go to that folder shift + right click and open a command prompt at that location, the rest is trivial.

2.	Updating to the latest official stock android.

2.1	Get the latest kdz from: (https://lg-firmwares.com/lg-h840-firmwares/ ). As far as I know you can go for any of those firmwares, but it is advisable to use one from your region (Europe, South America, Middle East). As mentioned above my LG G5 H840 is the newest European model, totally unbranded. So I took the 20c for Spain. This is as high as you can get at present moment.

2.2	Flash with LGUP 1.14 and UPPERCUT 1.0.0, both available at: (http://downloads.codefi.re/autoprime/LG/LG_G5 )

2.3	Reboot and do a quick setup. I recommend to have your sim card, SD card out at this moment, do not connect to wireless networks, all of this you will have plenty of time to do later, besides whatever you set at this point will be lost in the next step.

3.	Get TWRP and root

3.1	TWRP. As a courtesy of synescu, we have 2 versions: a regular one and such with encryption support. It took me long to realize that only the one with encryption would work on a latest H840 installed with v20c. So I guess if you have an old phone and possibly firmware 10a/b/c/d, than you can try “twrp3.1.1-0-h840.img”, otherwise go straight to “twrp_encryption-h840.img”. If you use the one without encryption support you will find no way to root the phone, because it can not see the SD card, or any USB flash attached and also if you connect the phone to a PC with MTP mode, or any other mode you won’t be able to browse both (internal and external) memories on that phone.

3.1.1	Put on a SD card following files: 1) latest stable SuperSU 2.79 2) no-verity-opt-encrypt.zip from here (https://build.nethunter.com/android-tools/no-verity-opt-encrypt/no-verity-opt-encrypt-5.1.zip ) and just in case although not mandatory “twrp_encryption-h840.img”.

3.1.2	Put in the C:\adb folder the “twrp_encryption-h840.img” and the stock recovery from here (https://xdaforums.com/attachment.php?attachmentid=4149809&d=1494791791 ). The stock recovery is necessary in case you make a mistake and have to do a factory reset.

3.1.3	Turn off the phone.

3.1.4	Boot into stock recovery (holding volume down + power, at LG logo releasing power shortly and than pushing power again).

As a side note here, after I unlocked the bootloader I’ve got that annoying message on start-up that the phone is untrusted. With G4 H815 it was a small message in the upper corner, this time around it is a huge message in the middle of the screen. LG, for the love of god! After all the playing, I have now also a message screen, which I call “Options Menu”, it shows right after the nagging untrusted message. Although esthetically ugly, I have an easy way to go to recovery and fastboot in each and every regular power on, or restart. As said the Options Menu is showing up for 5 sec after the untrusted nagger. If you click the volume up, or down you get to the options (Power off, Restart, Recovery, Fastboot ), otherwise after 5 sec the phone would boot normally. I don’t know if this is the expected behavior of the phone, or did I trigger it somehow, but now I don’t have to use the combo buttons for anything.

Back from the side note. The new stock recovery is a white screen with 2 options for No and Yes. Go for YES and than YES again, after both YES the phone will be factory reset and will reboot. Do not allow it to boot though, because the userdata will be encrypted at this point and you will have to repeat the reset again. Use the combo buttons for recovery, which will bring you to the “Options Menu”, or Volume up and plug in the phone into the PC. Yet again there is hardly any time so maybe plugin in won’t be fast enough, so just keep pressed the combo buttons, also change with volume up and power, or remove the battery and start again. In any event do not let it boot until it brings you to the “Options Menu”

3.1.5	In the Options Menu pick fastboot and plug the phone to the PC

3.1.6	Open command prompt in adb and flash TWRP ( fastboot flash recovery twrp_encryption-h840.img ) you might be ok also to do factory reset from adb with this command (fastboot –w ), but unfortunately I forgot already if I did it, when it finally worked for me

3.1.7	Disconnect from the PC and pull the battery out, or just keep the buttons combo pressed. It is possible that you see the old stock recovery (white screen YES/NO), which might have stayed somehow in memory. Do not perform further resets, just keep pressing the button combo and it will reboot eventually to the Options Menu.

3.1.8	There you go 3 times volume down and power to pick recovery. Follows a reboot of the bootloader, nagging screens, but eventually it loads TWRP.

3.2	Root.

3.2.1	For some reason even after the factory reset, the data partition keeps an encrypted flag. So you can not write to it. Stock recovery should have reset it to non-encrypted, but it does not do it correctly, I guess. Therefore you go to Wipe, pick only the Data check box and go to change format in the bottom. Change the format to FAT and than back to EXT4

3.2.2	Go to the SD card and flash no-verity-opt-encrypt.zip and SuperSu. Yes I know, that SuperSu is supposed to install also no-verity, but I like to flash both just in case.

3.2.3	Do NOT wipe anything in TWRP at this point. Reboot only!!!!! Once the phone has booted in v20c you can go back to TWRP, Wipe and make all the backups you like.