[G4 General] blake_spector:
G4 ** H815EUR **

Bootloader Unlock-/Relock Guide

* DISCLAIMER

Read carefully before proceeding !

Doing this will void your warranty and can permanently damage your device !

You take full responsibility if you brick your phone !

Only proceed at your own risk !

* REQUIREMENTS

All the things you need . . .

A H815EUR device with locked bootloader!

unlock.bin generated via official unlock method (http://developer.lge.com/resource/mobile/RetrieveBootloader.dev)

Enable OEM unlock and USB debugging activated (Settings > Developer options)

Android SDK (adb.exe, AdbWinApi.dll, fastboot.exe) installed

LGUP (https://xdaforums.com/g4/help/lgup-install-kdz-mm-lp-t3249803)

A KDZ for H815

LGROOT (send_command.exe) (http://downloads.codefi.re/thecubed/lg_g4/lef/LG_Root.zip)

LG Mobile Drivers (http://www.lg.com/us/support/software-firmware-drivers)

* STEP 0

Get the Device-ID for generating unlock.bin file !

Reboot the phone into fastboot mode - in cmd.exe type

adb reboot bootloader

Show the Device-ID for unlock.bin request !

fastboot oem device-id

Show current bootloader state !

fastboot getvar unlocked
> unlocked: no

Reboot the phone . . .

fastboot reboot

* STEP 1

Enable send_command.exe to backup the partition data !

Start LGUP to enable send_command.exe - NOTE - make sure to select ** UPGRADE **

Start flashing and prepare to pull the USB cable to disconnect the phone . . .

Disconnect the phone as soon as COM appears on the display !

Close LGUP and reconnect the phone . . .

* STEP 2

Backup the drm, misc and persistent partitions !

In cmd.exe navigate to send_command.exe and enter

send_command.exe \\.\[COLOR="Green"]COM[your port number here][/COLOR]

Dump the partitions to the internal storage of the phone . . .

dd if=/dev/block/mmcblk0 of=/data/media/0/drm.img bs=512 skip=655360 count=16384
dd if=/dev/block/mmcblk0 of=/data/media/0/misc.img bs=512 skip=262144 count=32768
dd if=/dev/block/mmcblk0 of=/data/media/0/persistent.img bs=512 skip=380928 count=4096

For safety, make a full dump of all partitions !

dd if=/dev/block/mmcblk0 of=/data/media/0/full_dump.img bs=4096 count=1552384

Set the permissions and owner for the files !

chown -R media_rw:media_rw /data/media/0
chmod -R 0666 /data/media/0

Partition dump complete ! To finish enter

LEAVE

Remove the battery and restart the phone . . .

* STEP 3

Copy the drm, misc and persistent partition images to your computer and/or SD card !

Check the file size of the partition images !

[B][COLOR="Magenta"]drm.img[/COLOR][/B] = [B]8.00 MB[/B] (8.388.608 Bytes)
[B][COLOR="Magenta"]misc.img[/COLOR][/B] = [B]16.00 MB[/B] (16.777.216 Bytes)
[B][COLOR="magenta"]persistent.img[/COLOR][/B] = [B]2.00 MB[/B] (2.097.152 Bytes)

Copy all files (including full_dump.img) to your computer and/or SD card !

- NOTE - the next step (bootloader unlock) ** WILL ERASE ALL USERDATA ** so make sure to backup your data before proceeding !

* STEP 4a

Unlock the bootloader with official method and the generated unlock.bin from LG . . .

Reboot the phone into fastboot mode - in cmd.exe type

adb reboot bootloader

Navigate to unlock.bin and unlock your bootloader !

fastboot flash unlock unlock.bin

Reboot the phone . . .

fastboot reboot

* STEP 4b (optional)

Show/confirm the unlocked bootloader state . . .

- NOTE - the unlocked bootloader is indicated by Bootloader state : Bootloader unlocked ! ! in the upper left corner when booting the device !

Reboot the phone into fastboot mode - in cmd.exe type

adb reboot bootloader

Show current bootloader state !

fastboot getvar unlocked
> unlocked: yes

Reboot the phone . . .

fastboot reboot

* STEP 5a

Flash the backup partitions drm, misc and persistent to relock the bootloader !

Copy the partition files drm.img, misc.img and persistent.img from your computer or SD card to the internal storage of the phone !

Repeat * STEP 1 . . .

In cmd.exe navigate to send_command.exe and enter

send_command.exe \\.\[COLOR="Green"]COM[your port number here][/COLOR]

Again, set the permissions and owner for the files !

chown -R media_rw:media_rw /data/media/0
chmod -R 0666 /data/media/0

Flash the partitions from the internal storage of the phone . . .

dd if=/data/media/0/drm.img of=/dev/block/mmcblk0 bs=512 seek=655360 count=16384
dd if=/data/media/0/misc.img of=/dev/block/mmcblk0 bs=512 seek=262144 count=32768
dd if=/data/media/0/persistent.img of=/dev/block/mmcblk0 bs=512 seek=380928 count=4096

Bootloader relock complete ! To finish enter

LEAVE

Remove the battery and restart the phone . . .

* STEP 5b (optional)

Show/confirm the relocked bootloader state . . .

- NOTE - The indication Bootloader state : Bootloader unlocked ! ! in the upper left corner should no longer appear !

Reboot the phone into fastboot mode - in cmd.exe type

adb reboot bootloader

Show current bootloader state !

fastboot getvar unlocked
> unlocked: no

Reboot the phone . . .

fastboot reboot

---

Personal thanks to [MENTION=834547]letama[/MENTION] for the help, testing and support!

Credits to [MENTION=447404]OllieD[/MENTION] (https://xdaforums.com/g4/general/relocking-bootloader-t3380781) and [MENTION=7883776]xVANKO[/MENTION] (https://xdaforums.com/g4/general/h815-relock-bootloader-t3506634) for the development!