Skip to content

Instantly share code, notes, and snippets.

@zacharee
Last active December 16, 2020 03:19
Show Gist options
  • Save zacharee/6aa5fcb56d0a42937869494b12d77da2 to your computer and use it in GitHub Desktop.
Save zacharee/6aa5fcb56d0a42937869494b12d77da2 to your computer and use it in GitHub Desktop.

Notes

  • This shouldn't be any more dangerous than flashing anything else, but as always be careful. If something does break, it's on you.
  • When you have a terminal or CMD window open (which you will), keep it open until you're sure you're finished with everything! Unless you know what you're doing, it can be a hassle to CD into the right directory.
  • On Windows, make sure you have the LG Mobile drivers installed.

Windows 10

  1. Open the Windows Store and install the Ubuntu (by Canonical) app.

  2. Open Ubuntu and let it install.

  3. Once installed, make sure everything is updated, using sudo apt update and then sudo apt dist-upgrade.

  4. Make sure you have the following:

    sudo apt install git adb fastboot openssl python3-pip
    
  5. Install the needed Python dependencies:

    pip3 install cryptography 
    pip3 install PyUSB
    pip3 install pycryptodome
    
  6. Make sure you're in your user directory:

    cd /mnt/c/Users/YOURUSERNAME/
    
  7. Follow the main instructions

Windows 8.1 and below

  1. Install Git BASH, Python 3 and ADB

  2. Open Git BASH.

  3. Install the needed Python dependencies:

    pip install cryptography  
    pip install PyUSB
    pip install pycryptodome
    
  4. Make sure you're in your user directory:

    C:
    cd C:\Users\YOURUSERNAME\
    
  5. Follow the main instructions

Ubuntu and similar

  1. Make sure everything is updated, using sudo apt update and then sudo apt dist-upgrade

  2. Make sure you have the following installed:

    sudo apt install git adb fastboot openssl python3-pip
    
  3. Install the needed Python dependencies:

    pip3 install cryptography  
    pip3 install PyUSB
    pip3 install pycryptodome
    
  4. Make sure you're in your user directory:

    cd ~/
    
  5. Follow the main instructions

Other Linux distros

  1. If you're this advanced, you should know how to install the needed Python dependencies: cryptography and PyUSB.

    • Just make sure you're in ~/ and have git, fastboot and ADB installed.

Main Instructions

  1. Enter Download/LAF Mode
  • Shut down your device completely, or pull the battery.
  • While holding the Volume-Up button, plug your phone into the computer.
  • If a screen with a loading symbol and a warning against unplugging come up, you're good.
  1. Download the needed files:

    git clone https://github.com/runningnak3d/lglaf  
    
  2. CD into the newly-created lglaf folder and prepare it:

    cd lglaf
    git checkout h918-miscwrte #for the TMO V20
    git checkout v10-miscwrte #for the TMO V10
    
  3. Download TWRP for your device and move it into the lglaf folder (should be under your user directory)

  4. Rename the TWRP image to twrp.img

  5. Run the following commands, with your phone connected and in Download Mode:

     ./partitions.py --dump laf.img laf  
     ./partitions.py --dump misc.img misc  
     ./partitions.py --restoremisc twrp.img laf
    
  • The last command will take a while
  1. Unplug your device and power it off (remove the battery or hold PWR+VOLUP+VOLDWN until it reboots, then shut it down).
  2. Try entering Download Mode again. If all went well, you'll be greeted with TWRP.

Optional Steps

Right now, TWRP will be installed to the LAF partition, and not recovery, which isn't very convenient if you don't have ready access to a computer. This will guide you on installing TWRP to your recovery partition.

  1. Enter Download Mode (or TWRP at this point).

  2. In the terminal, run:

    adb push twrp.img /sdcard/
    
  3. In TWRP, press Install>>Install Image and select twrp.img. Slide to confirm the flash, and then reboot to recovery.

If you want, you can restore the LAF partition. This isn't required, and personally I think it's better to have two versions of TWRP, especially if the recovery partition breaks or you can't boot to it; TWRP is more robust than LAF.

  1. Make sure your device is in TWRP and plugged into your computer, and run these commands in the terminal:

    adb push laf.img /sdcard/
    adb push misc.img /sdcard/
    adb shell
    dd if=/sdcard/laf.img of=/dev/block/bootdevice/by-name/laf 
    dd if=/sdcard/misc.img of=/dev/block/bootdevice/by-name/misc
    
@kitchung
Copy link

runningnak3d has since moved his stuff to https://gitlab.com/runningnak3d/lglaf, update commands above accordingly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment