[G3 General] ingoljosh:
[PHP][PHP][QUOTE="topet2k12001, post: 59287063, member: 5231281"][CENTER][COLOR=Blue][B][SIZE=4]OWNERS OF OTHER LG G3 VARIANTS ARE WELCOME TO TRY![/SIZE][/B][/COLOR]
[SIZE=4][B]IMAGEPREP: ONE-CLICK SCRIPT (MODIFIED) FOR LG G3[/B][/SIZE]
[SIZE=4][B] Tested on: LG G3 D858HK
[/B][/SIZE]
[/CENTER]
[SIZE=4][B]April 5, 2015 Update[/B][/SIZE]:

With the discovery of the rooting commands for the LG G3 by @[URL="http://xdaforums.com/member.php?u=4911249"]Unjustified Dev[/URL] and script, it opened the doors for rooting the LG G3. Other XDA members further improved it:

1. @[URL="http://xdaforums.com/member.php?u=2200907"]avicohh[/URL] automated the commands into a script
2. @[URL="http://xdaforums.com/member.php?u=4479135"]jac10000[/URL] took it up a notch by adding TWRP (targeted for the D855)So, I experimented a bit by modifying the script and tried on a non-D855 (mine is a D858HK) and I got it to work. I am therefore sharing this with the intention of making the initial work to be made compatible with other LG G3 models/variants too.
[B]
Disclaimer

(March 15, 2015 Update):[/B] please consider the fact that there are a lot of LG G3 variants. Hardware specs may exactly be the same, but it is possible that there may be key differences in the software. I exerted "best-and-reasonable" efforts to ensure that the script works properly while keeping in mind that there are other LG G3 variants. My LG G3 variant is a D858HK so if you are going to use this on your LG G3 variant you are, in a way, testing it "at your own risk".

So long as you have a full backup of your system, and that you have a custom recovery installed, consider this as an "educated and calculated risk". I am not even a developer or a programmer, and yet I am able to restore my device when I was doing my experiments. It's all about having presence of mind, attentiveness to details, and diligence in documenting every event so that you can reverse/undo it.

[B]Credits

[/B]@Chainfire for SuperSU[B].
[/B]@[URL="http://xdaforums.com/member.php?u=2684188"]autoprime[/URL] for his tutorial on “[URL="http://xdaforums.com/lg-g3/development/psa-stop-taking-ota-updates-update-t2909412"]Manual Firmware Update[/URL]” to keep root/”bump’d”, and for guiding and giving clarity by explaining what happens in the background when I conducted my experiment.
@[URL="http://xdaforums.com/member.php?u=2174433"]Skin1980[/URL] for allowing me to use the commands from his Sharpening Script Mod (for sharpening options) as well as the commands for "live bumping" ("bumping" on-the-fly) of the boot.img.
@[URL="http://xdaforums.com/member.php?u=2376614"]jcase[/URL] for putting up the the “[URL="http://xdaforums.com/lg-g3/orig-development/root-stump-root-lg-g3-sprint-verizon-t2850906"]Stump[/URL]” thread. Without “Stump” we would not have enjoyed “root” functionality of the LG G3.
@[URL="http://xdaforums.com/member.php?u=1157052"]thecubed[/URL] for “[URL="http://xdaforums.com/lg-g3/orig-development/bump-unlock-lg-g3-twrp-d852-d852g-f400-t2900614"]Bump[/URL]”. Such a wonderful tool. It opened the doors of customization for the LG G3.
@[URL="http://xdaforums.com/member.php?u=2452553"]bullghost[/URL] for the “[URL="http://xdaforums.com/showpost.php?p=49192452&postcount=1"]KDZ and TOT Extractor[/URL]” tool. This nifty tool allowed us to extract the important components (partitions) of the LG G3’s firmware.
@[URL="http://xdaforums.com/member.php?u=5382112"]mronly1love[/URL] for “[URL="http://xdaforums.com/lg-g3/general/bump-window-version-t2956829"]Bump Windows version[/URL]”. It is through this tool that I was able to “bump” my TWRP 2.8.4.0.
@[URL="http://xdaforums.com/member.php?u=3717338"]hoangnova[/URL] for his post about the [URL="http://xdaforums.com/showpost.php?p=53010666&postcount=6"]partition layout of the LG G3[/URL]. It helped me confirm how I should flash aboot.img.
@[URL="http://xdaforums.com/member.php?u=5340614"]itsbighead[/URL] for his post that helped me understand what [URL="http://xdaforums.com/showpost.php?p=59189704&postcount=10"]aboot.img, laf.img, and sbl1.img[/URL] meant, and for the same post that explains what causes the LG G3 to boot into an error screen that says “certificate verify”.
@[URL="http://xdaforums.com/member.php?u=5996345"]gzkenny[/URL] from bbs.gfan.com for “[URL="http://bbs.gfan.com/android-7816518-1-1.html"]D858HK TWRP 2.8.4.0[/URL]”. It is a purely Chinese website and I actually spent time understanding everything even with Google Translate. I’m not sure if he/she will able to read/understand this but I thank him/her too.
@[URL="http://xdaforums.com/member.php?u=2308854"]6ril1[/URL] for sharing to me how to "bump" a boot.img. Also thanking him for sharing a secret/tip, which actually inspired me to [URL="http://xdaforums.com/showpost.php?p=59329302&postcount=17"]start learning how to program[/URL] (I'm starting with simple scripts for now). This is the reason why I was able to come up with "imageprep".
@[URL="http://xdaforums.com/member.php?u=4911249"]Unjustified Dev[/URL] for sharing a method of [URL="http://xdaforums.com/android/development/guide-root-method-lg-devices-t3049772"]rooting the Android Lollipop without downgrading to Kitkat[/URL].
@[URL="http://xdaforums.com/member.php?u=4646677"]zurny[/URL] for [URL="http://xdaforums.com/showpost.php?p=59381937&postcount=85"]proof-reading the guide and pointing out clerical errors or any other errors[/URL] that may cause future problems for the readers.
@[URL="http://xdaforums.com/member.php?u=5374539"]DE52[/URL] for spreading the word about this thread and helping to explain the logic to fellow XDA members
@[URL="http://xdaforums.com/member.php?u=2200907"]avicohh[/URL] for automating the rooting commands via a script
@[URL="http://xdaforums.com/member.php?u=4479135"]jac10000[/URL] for modifying the scripted rooting commands to add TWRP
@[URL="http://xdaforums.com/member.php?u=4008653"]somboons[/URL] for One Click ROOT+TWRP Recovery for Lollipop Stock Firmware

[B]Additional Features that not already present in the original and modified script:[/B]
1. "Windows Bump" included to "bump" your custom recovery.img (TWRP) in case it is not yet bump'd.
2. KDZ and TOT Extractor Tool included to extract aboot.img and laf.img (with written guide on the script that you can easily follow).
3. Extracted image files (aboot.img and laf.img) will automatically be renamed properly and to the correct file extension (from .bin to .img).
4. Sharpening Mod Script of Skin1980 included (to be manually flashed upon reboot to TWRP Custom Recovery) - this will "bump" your Kernel (boot.img) and will apply your desired sharpening level of the LG G3's display.

[B]What you need beforehand:[/B]
1. Your LG G3 KITKAT Firmware (KDZ)
2. Your custom recovery (TWRP) for your respective LG G3 model

[B]How to use:[/B]
1. Extract the zip to a folder
2. Run (double-click) the "OneClick_ROOT_RECOVERY.bat" file

[B]Download (v1.5): [/B][URL="https://mega.co.nz/#%211Nc1lSKD%21vfiiTO5wIZP8bvtfZNEb4P7m0_8rCKl-Ltfv2iCjwu4"]https://mega.co.nz/#!1Nc1lSKD!vfiiTO5wIZP8bvtfZNEb4P7m0_8rCKl-Ltfv2iCjwu4[/URL]

[B][B] Previous methods are still working and are kept/maintained for reference purposes (Hidden below)[/B]
[/B]
[HIDE]This procedure has been tested on my LG G3 D858HK variant (dual-SIM). Please make sure to back up all your important files (contacts, SMS, photos, videos, call logs, etc.) and preferably a complete backup of your Android system via custom recovery such as TWRP. Make sure to transfer your backup to another device such as your computer or any other storage device. Although I have repeatedly tested the procedure on my device with 100% success rate, this makes no guarantee that it will work with all LG G3 variants (your mileage/results may vary). Please try at your own risk.

It is worthwhile to note that there are developers who have already published “pre-rooted” stock Lollipop ROMs. Also, the more prominent variants of the LG G3 seem to be rooted more easily (such as the D855 – the International variant). This makes the process more convenient for you. Just search in XDA Forums under your respective LG G3 device variant. I would say that a “pre-rooted” stock Lollipop ROM is as good as stock; the only difference is that this tutorial is more of a DIY approach version. What this DIY approach offers is an attempt to have a “universal” way of updating to Lollipop (plus root and “bump’d” boot.img and “bump’d” TWRP) because the LG G3 has a multitude of variants, making it difficult for developers to keep on creating “pre-rooted” stock Lollipop ROMs for each and every variant available.

Believe me, if there was a “pre-rooted” stock Lollipop ROM for my LG G3 variant I wouldn’t have bothered to figure all of this out and create a tutorial.

[B]Important note:[/B] I am not a developer by profession. I was looking for a nice, high-end dual-SIM phone that I plan to keep for a long time and I found it in the LG G3 (D858HK variant). This ultimately led me to reading and discovering the trick to updating my device to Android Lollipop while keeping root, ”bump’d” boot.img, and “bump’d” custom recovery. As such, be aware that I did not “invent” anything here. I just figured it out and wanted to document it so that I have something to go back to in case I forget in the future. If this documentation helped out anyone else, then I just consider it as an extra bonus.

[B]Introduction[/B]

[B]March 15, 2015 Update: Technology advances quickly, and so will approaches to it.[/B] (wow...I suddenly realized, March 15, 2015 = 05.15.15!)

This is an update from my original post because as we all know, we can now root our LG G3 running Android Lollipop without downgrading to Kitkat. We call this the "No Downgrade" approach. The first version of my how-to guide requires downgrading to the latest Kitkat version so we called it the "Kitkat Downgrade" approach. It is originally conceptualized by @[URL="http://xdaforums.com/member.php?u=2684188"]autoprime[/URL]. The primary reason I created a how-to guide was really for the D858HK, but eventually it progressed to support other LG G3 variants too.

The new root "No Downgrade" methods can be found [URL="http://xdaforums.com/lg-g3/general/guide-root-stock-lolipop-roms-t3050179"]here[/URL] and [URL="http://xdaforums.com/android/development/guide-root-method-lg-devices-t3049772"]here[/URL]. You can follow either approach; you will have the same result of having root without the need to downgrade to the latest Android Kitkat version.

Despite these new, "No Downgrade" approaches, I still liked the "Kitkat Downgrade" approach because at that time, only the "Kitkat Downgrade" approach will give you "bump'd" boot.img and "bump'd" custom recovery.img (TWRP). The new "No Downgrade" approach only offered rooting...no "bump'd" boot.img and no "bump'd" custom recovery.img (a.k.a. TWRP).

I did some experimentation on the "No Downgrade" approach and finally uncovered how to have "bump'd" boot.img and "bump'd" custom recovery.img (TWRP). This opened a new "door" to the LG G3 users - they no longer have to downgrade, which improved the convenience of achieving root on Android while having "bump'd" boot.img and "bump'd" custom recovery.img. However, the process was still very manual. It involved entering commands in the Terminal/Command Line, which can create opportunities for mistakes by end-users.

Trying to find a solution to the problem, I forced myself to learn "basic programming" - the "Shell Script". I regularly use Microsoft Excel at work (I'd say I'm above-Intermediate level). Microsot Excel is like programming as it uses logic. So, my learning curve in learning how to do basic programming via Shell Script was not that steep.

I tried to create a script that will "combine" the manual commands that we are typing so that we can reduce our errors/mistakes. This marked my very first script which we call [B]"[URL="http://xdaforums.com/showpost.php?p=59447661&postcount=153"]Imageprep[/URL]"[/B] (I know, I know...it's a horrible name. I couldn't think of something catchy, hahaha!).

"Imageprep" is only at version 1.1 so it is indeed very new. I welcome other LG G3 owners to try and test it, and give feedback. If you want to test, please be ready for regular re-flashing of your device because I will really need to get detailed feedback from you. Also, a "fresh flash" of your LG G3 eliminates outside factors to a failed attempt at using my script.

[B][B]Original, manual "Kitkat Downgrade" approach (this is still a working method so I'm keeping it in case of emergency)[/B]

We typically update/upgrade our device firmware via two popular methods:

1. An OTA (Over-The-Air) update, where we get automatically notified of updates in apps or the firmware (the OS) itself directly on the device.
2. A “full flash” (in simple terms, it is like “reformatting a hard disk”), where we download the full firmware image (“full OS”) and “flash” it to our device via tools like the LG Flash Tool.

But there is one more method of flashing, and this is what we call “manual” flashing. The individual components (partitions) of the “full OS” are flashed manually by entering commands in the Terminal, Command Line, or DOS Box, in a particular order.

Long-time users of Android, owners of “Google devices” (a.k.a. “Nexus” products), and/or fans of doing things via the “DOS Box” (a.k.a. the “Terminal” or the “Command Line”) are familiar with this approach. As a Nexus owner and fan myself, this was the first method of flashing that I learned (my wife and kids are Nexus users – Nexus 4, Nexus 5, and Nexus 7 2012 Wi-fi). Such is also the procedure in @[URL="http://xdaforums.com/member.php?u=2684188"]autoprime[/URL]’s tutorial for manual firmware update of the LG G3.

This documentation follows the exact procedure from @[URL="http://xdaforums.com/member.php?u=2684188"]autoprime[/URL]’s [URL="http://xdaforums.com/lg-g3/development/psa-stop-taking-ota-updates-update-t2909412"]thread[/URL] for updating to Android Lollipop while keeping “root” status, but only with the addition of an extra step that will “bump” the Android Lollipop version of the boot.img. This will ensure that you will also keep/maintain your “bump’d” TWRP custom recovery. And then as a bonus, I merely detailed the process of extracting the necessary Image files via the [URL="http://xdaforums.com/showpost.php?p=49192452&postcount=1"]KDZ and TOT Extractor[/URL] software.

Possibly, not all LG G3 variants need to make use of my version of the tutorial. If I’m not mistaken, other LG G3 variants are able to keep their “root” status and “bump’d” custom recovery via existing procedures such as that of @[URL="http://xdaforums.com/member.php?u=2684188"]autoprime[/URL]. I strongly recommend to follow his tutorial first, just like what I did, and only try this procedure if you were unsuccessful.

[/B][B]How To Report Your Results[/B]

As I myself did when experimenting and eventually discovered how to do it, I encourage everyone to “take it forward” by also sharing their results. I believe this is how an “online community” should work. But when doing so, please be as detailed as possible. Even for a non-developer such as myself, simply reporting/posting something like “…it doesn’t work. Help?” or the like is deemed as counter-productive, as it leads to more posts/questions by other members to ask for clarification/details. It unnecessarily lengthens a thread and therefore, makes it more difficult for new joiners to find the information they need.

If you have tried this procedure and it worked successfully for your variant, I would appreciate submitting a post and reporting your LG G3 variant and Android OS version (e.g. Android 5.0.1, etc.).

I did my best in organizing the procedure in the simplest/most logical manner that I know. For efficiency, please mention the Step # that you are having problems with. I will also upload a YouTube video which you can download, and you may also refer to this document as your guide. Feedback is always welcome.

[B] -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
[SIZE=4][B]March 15, 2015 Update: looking for owners of other LG G3 variants to test! Must be willing to reflash!

Old results (based on original "Kitkat Downgrade" Approach)
[B][Regularly Updated]: proven working on the following LG G3 variants. If you get it to work and wanted to have your LG G3 variant listed, please let me know!
D858HK
[URL="http://xdaforums.com/showpost.php?p=59310549&postcount=20"]D852G[/URL][/B]
[B][URL="http://xdaforums.com/showpost.php?p=59335690&postcount=37"]D852 Rogers[/URL][/B]
[B][URL="http://xdaforums.com/showpost.php?p=59362878&postcount=50"]D850 AT&T[/URL]
[URL="http://xdaforums.com/showpost.php?p=59365693&postcount=58"]D855[/URL] (the ever-popular International variant)[/B][/B][/SIZE]-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

[SIZE=4][B][CENTER]Imageprep: single-command automated script to add "Bump'd" boot.img and "Bump'd" TWRP for Rooted LG G3
[/CENTER]
[/B][/SIZE]
[B]The Logic Behind It All[/B]

[/B][B]Requirements[/B]

[B]March 15, 2015 Update: for the "No Downgrade" Approach[/B]

[LIST]
[*][I][B]A "freshly-flashed" Stock Android Lollipop (either by fully flashing a KDZ or TOT, or by OTA update)[/B][/I] - strongly recommended, to ensure that there is no "mix" of Kitkat and Lollipop files
[*][I][B]Root[/B][/I] - please follow the rooting guides from the other threads [URL="http://xdaforums.com/lg-g3/general/guide-root-stock-lolipop-roms-t3050179"]like this one[/URL]
[*][I][B]Extracted Kitkat "Android Bootloader"[/B][/I] - this is aboot.img. Use the KDZ and TOT Extractor Tool to get it. Once extracted, make sure to rename it AND change the file type from ".bin" to ".img". So the file should look like this: kitkat-aboot.img
[*][I][B]Extracted Kitkat "Boot Stack" (aboot.img, dbi.img, rpm.img, persist.img, sbl1.img, laf.img, tz.img)[/B][/I] - use the KDZ and TOT Extractor Tool to get them. Once extracted, make sure to rename them AND change the file type from ".bin" to ".img". So the files should look like this:
[LIST]
[*]kitkat-laf.img
[*]kitkat-dbi.img
[*]kitkat-rpm.img
[*]kitkat-persist.img
[*]kitkat-sbl1.img
[*]kitkat-tz.img
[/LIST]

[*][I][B]"Bump'd" TWRP Custom Recovery[/B][/I]
[*][I][B]Android Terminal Emulator[/B][/I] - get it from the Google Play Store
[*][I][B]Busybox[/B][/I] - make sure to open the app and you will see a loading progress indicator at the top portion. Once it completes, please click on "Install" at the bottom portion.
[*][I][B]Root Checker[/B][/I] - to make sure that you have Root and Busybox properly installed
[/LIST]
[B]Requirements for the original "Kitkat Downgrade" Manual Approach[/B]
1. MUST read the Disclaimer.
2. MUST back up all important files, and preferably backed up current Android System via TWRP.
3. MUST be fully rooted, MUST be running Android Kitkat, and MUST have “bump’d” custom recovery (TWRP) already installed. As a bonus for D858HK users, [URL="http://xdaforums.com/showpost.php?p=58868251&postcount=106"]I have uploaded a “bump’d” TWRP version 2.8.4.0[/URL].
[B]NOTE:[/B] some LG G3 variants need to “downgrade” to a “rootable” Kitkat version, like the D858HK (version 10D), and then update to the latest Kitkat version (D858HK version 10F). As a bonus for D858HK users, I have uploaded a [URL="http://xdaforums.com/showpost.php?p=58469891&postcount=79"]YouTube video tutorial[/URL] of this process.
4. MUST [URL="http://xdaforums.com/lg-g3/development/efs-lg-g3-efs-backup-restore-t2907329"]back up EFS partitions[/URL]. I always to this even on my Nexus devices.
5. Your Lollipop full firmware in KDZ format. As a bonus for D858HK users, please [URL="http://xdaforums.com/showpost.php?p=59189722&postcount=142"]check this post[/URL].
6. The LG [URL="http://xdaforums.com/showpost.php?p=49192452&postcount=1"]KDZ and TOT Extractor[/URL] tool.
7. [URL="http://downloads.codefi.re/autoprime/LG/LG_G3/flash2"]Tools for flashing the extracted image files[/URL]: [URL="http://downloads.codefi.re/autoprime/LG/LG_G3/flash2/Flash2Boot.zip"]Flash2Boot.zip[/URL], [URL="http://downloads.codefi.re/autoprime/LG/LG_G3/flash2/Flash2Modem.zip"]Flash2Modem.zip[/URL], and [URL="http://downloads.codefi.re/autoprime/LG/LG_G3/flash2/Flash2System.zip"]Flash2System.zip[/URL].
8. MUST disable OS (OTA) Updates via “Settings” in your LG G3.
[B]NOTE:[/B] unlike the D858HK, some variants do not have an automatic/easy way of disabling this. Please read @[URL="http://xdaforums.com/member.php?u=2684188"]autoprime[/URL]’s [URL="http://xdaforums.com/lg-g3/development/psa-stop-taking-ota-updates-update-t2909412"]tutorial[/URL] for alternative procedures to achieve this.
9. MUST have enough sleep before doing this. Seriously.
10. MUST have patience in reading and MUST know how to follow instructions.

[B]Process Overview[/B]

[B]March 15, 2015 Update:[/B]

For the "No Downgrade" rooted LG G3, the process involves three steps in summary, which we can call "[B]ERR[/B]"[B]:[/B]

[LIST=1]
[*][I][B]Extract[/B][/I]
[*][I][B]Root[/B][/I]
[*][I][B]Run the Script[/B][/I]
[/LIST]
[B]Process overview of the original "Kitkat Downgrade" Manual Approach[/B]
Assuming completion of the requirements above, this tutorial involves three steps which I personally call [B]“ETF”[/B]:

1. [B][URL="http://xdaforums.com/showpost.php?p=59287221&postcount=2"]Extract:[/URL][/B] this is the longest piece because I detailed each step, with pictures
2. [B][URL="http://xdaforums.com/showpost.php?p=59287246&postcount=3"]Transfer:[/URL][/B] transferring of the needed files to the device
3. [B][URL="http://xdaforums.com/showpost.php?p=59287369&postcount=4"]Flash:[/URL][/B] flashing the needed files

We also have a [B][URL="http://xdaforums.com/showpost.php?p=59287411&postcount=5"]Troubleshooting and Q&A section[/URL][/B]. I will do my best to check this thread at least once a day and respond to queries. If there are new finds along the way, I will also update the Troubleshooting and Q&A section.

[SIZE=4][B]Imageprep Method: head over to [URL="http://xdaforums.com/showpost.php?p=59447661&postcount=153"]Post #153[/URL] for the process steps in detail![/B][/SIZE]

[B]Collection of Daily Responses to Posts by Fellow XDA Members[/B]

[URL="http://xdaforums.com/showpost.php?p=59313722&postcount=23"]03.09.2015[/URL]
[URL="http://xdaforums.com/showpost.php?p=59320363&postcount=32"]03.09.2015 (2)[/URL]
[URL="http://xdaforums.com/showpost.php?p=59370533&postcount=59"]03.12.2015[/URL][/HIDE][/QUOTE]

[/PHP][/PHP]

How will this work if we are on stock lollipop rooted only??? Youre requiring a KitKat KDZ