Quantcast
Channel: xda-developers - Android Software and Hacking General [Developers Only]
Viewing all articles
Browse latest Browse all 3614

[TOOL][DOCS] LG Download Mode (LAF)

$
0
0
Introduction
Hi folks,

While trying to get CM on a LG G3 (D855), I found people recommending Newest Root Method for LG devices (by digital-bug). Unfortunately this tool is Windows only and does not really describe what happens under the hood. For this reason I started reverse engineering the Download Mode protocol and created a Python tool that can replace the Send_Command.exe binary.

This project is aimed at users who would like to dump or restore partitions and developers who need some power in download mode.

Source code: https://github.com/Lekensteyn/lglaf
(Protocol documentation: https://github.com/Lekensteyn/lglaf/...er/protocol.md)

Features
  • Should work on any LG device.
  • Dump and restore partitions.
  • Dump individual files.
  • Run any shell command as root in Download Mode.
  • Works on Linux.
  • Works on Windows.
  • Opensource code and protocol documentation.

Installation instructions
See the README for details. Basically:
  1. Install Python (www.python.org)
  2. Install PyUSB (Linux) or LG drivers (Windows)
  3. Ensure phone is connected and started in Download Mode (poweroff, hold Volume Up and insert USB cable in a PC).
  4. Run the tool of your choice (lglaf.py, partitions.py, etc.)

Examples
Some examples are listed in the README, here are additional ones:

List partitions, dump the userdata partition (/data) to a local "data.bin" file (may take a while):
Code:

python partitions.py --list
python partitions.py --dump data.bin userdata

Dump all partitions (except ones larger than 64 MiB: cache, userdata, system, cust):
Code:

python extract-partitions.py
Backup the contents of the data partition (assuming it to be small enough to fit in /) and retrieve it:
Code:

python lglaf.py -c "busybox tar czf data.tar.gz data"
python dump-file.py /data.tar.gz data.tar.gz

Get more usage information on these tools:
Code:

python lglaf.py --help
python partitions.py --help
python extract-partitions.py --help
python dump-file.py --help

Q&A
Q: What devices are supported?
A: In principle all LG devices as they all use the same download mode. Tested with G2, G3, G4 (see README).

Q: How can I root a device with this?
A: This depends on your currently installed ROM. Feel free to post a guide.

Q: How can I install a custom ROM using this?
A: With older bootloader versions, you should be able to write a "bumped" recovery image:
Code:

python partitions.py --wipe recovery
python partitions.py --restore cm-12.1-20151117-SNAPSHOT-YOG7DAO1K8-d855-recovery.img recovery

Newer versions (such as my G3 (D855 with 20T)) do not support the "bump" method and will refuse to boot ("ERROR: Boot certification verify").
In that case, wipe the recovery partition and you will end up in the fastboot mode where you can boot your custom images:
Code:

# recovery
fastboot boot cm-12.1-20151117-SNAPSHOT-YOG7DAO1K8-d855-recovery.img
# after installing zip in recovery, reboot, then boot with:
unzip cm-12.1-20151117-SNAPSHOT-YOG7DAO1K8-d855.zip boot.img
fastboot boot boot.img

XDA:DevDB Information
LG Download Mode utility (LGLAF.py), Tool/Utility for all devices (see above for details)

Contributors
Lekensteyn
Source Code: https://github.com/Lekensteyn/lglaf


Version Information
Status: Beta

Created 2016-01-04
Last Updated 2016-01-04

Viewing all articles
Browse latest Browse all 3614

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>