Remove All Ads from XDA
Find Your Device:
Or Continue to Thread: [GUIDE][ROOT][BUMP][TWRP] Imag…
15th March 2015, 12:29 AM
OP Senior Member
Flag Metro Manila
Thanks Meter: 597
[ANNOUNCEMENT][SCRIPT] Imageprep: One-click solution for TWRP and BUMP v 1.5
Hi Friends,

New version 1.5! Please visit Post #1

Old/Previous Method is archived below for reference purposes.

I noticed that some users have some difficulty and/or confusion with manually having to enter commands in the Android Terminal Emulator. Manually having to type commands using a mobile device is not an ideal scenario as it creates opportunities for people to make mistakes. As a result, some of us encounter mishaps like:
  • "Certificate Verify" errors
  • "Security Error"
  • Loss of "Download Mode"
I thought hard about it and committed myself to making a solution that will somehow automate all of the things we need to do in order to achieve "Bump'd" TWRP and "Bump'd" boot.img. I took effort, as a non-programmer, to read online and learn how to make simple "shell scripts". I learned that you can create a simple file that will contain all the commands needed. This way, we will type or enter only one command in the Android Terminal Emulator.

I present to you: "imageprep"! (Sorry I can't think of a name, I know it sounds corny...)

Video Tutorial (includes rooting, how to extract a KDZ, and how to use "Imageprep"...version 1.4 was used):!FYNF2Qya!bMo2C4...0mKZuyi8MiSyts

Version Updates

(March 15, 2015) 1.0: Initial Release
(March 15, 2015) 1.1:
  • Added requirement for user to make selections: reminder and confirmation for end-user, flashing of Kitkat "entire" Boot Stack or just LAF partition only
  • Added Sharpness Adjustment (selection of sharpness value)
(March 16, 2015) 1.2:
  • Fixed folder order. Version 1.1 is extracting directly to the Internal Storage. Should extract instead to a folder named "imageprep" (i.e. should be /sdcard/imageprep/(the corresponding sub-folders)
(March 16, 2015) 1.3:
  • Visual and wording clean-up
  • Found a "bug" where the selected sharpness level does not take effect. Click here for the explanation/finding.
(March 18, 2015) 1.4:
  • Added security feature: script will check if "Kitkat" image files and custom recovery image file are present in the correct location.
  • Added security feature: Kitkat version laf.img will be flashed by default. This will ensure that once the "bump'd"(signed with Kitkat signature) boot.img is flashed, the device can boot to Download Mode.
  • Sequence of events:
    • Prepare essential files for "bumping" the boot.img
    • A reminder will be shown. You need to confirm that you have read and accomplished all requirements by typing "yes".
    • The script will not believe you. It will still check. If the ".img" files are not in their correct locations, the script will exit.
    • The script will back up your Lolliopop BOOT (kernel), ABOOT (Android Bootloader), LAF (LG Download Mode), and RECOVERY (stock recovery) partitions and will create backups.
    • The script will wipe your recovery partition and will replace it with your "bump'd" custom recovery (TWRP).
    • The script will wipe your stock (Lollipop) ABOOT (Android Bootloader) and LAF (Download Mode) partitions, and will replace them with Kitkat version. This is needed because once the boot.img is bump'd later in the script, it will be signed with a Kitkat "signature" and you will get a "certificate verify" error. Once ABOOT is replaced with a Kitkat version, then the signature that is used to sign (bump) boot.img will now match that of ABOOT, and will therefore "pass" the signature check. You will now be allowed to boot into Android.
    • The script will back up your Lollipop Boot Stack (SBL1, RPM, PERSIST, TZ, AND DBI).
    • The script will let you adjust your preferred sharpness level.
    • The script will "bump" (sign with a Kitkat signature) your boot.img.
    • The script will wipe your BOOT partition and will will replace it with the "bump'd" Lollipop boot.img. Congratulations!
    • "Post-Install option": the script will ask you if you want to wipe your Lollipop Boot Stack partitions and replace them with Kitkat versions. IMPORTANT: select "no" the first time around. Reboot the device and try Download Mode. If it does not work, then it means you need to do this step. Run the script again and when you get to this part of the script, select "yes".
    • Type "exit" to end the script and then reboot via the Power button.
    • For sharpness of display: upon reboot, turn off the display (power button) and then turn on again.
What does it do (features)?
  • Backup, wipe the recovery partition, and flash a custom recovery (TWRP).
  • Backup, wipe the stock boot.img, "bump" it (credits to @Skin1980 for giving permission to use his original work/commands and @6ril1 for also sharing his version of the commands), and then flash it.
  • Backup, wipe the Lollipop "Boot Stack", and replace with Kitkat "Boot Stack".
  • Allows you to set your preferred display sharpness (with permission from @Skin1980).
  • Allows you to choose whether you want to replace the entire Lollipop Boot Stack with Kitkat, or just the LAF partition (only the Download Mode). Some users reported that they needed to replace the entire Lollipop Boot Stack; some reported that they only need LAF. So I am giving this as an option.
What are the requirements?
  • A "freshly-flashed" Stock Android Lollipop (either by fully flashing a KDZ or TOT, or by OTA update) - strongly recommended, to ensure that there is no "mix" of Kitkat and Lollipop files
  • Root - please follow the rooting guides from the other threads like this one
  • Extracted Kitkat Boot Stack (aboot.img, dbi.img, rpm.img, persist.img, sbl1.img, laf.img, tz.img) - use the KDZ and TOT Extractor Tool to get them. If you don't know yet how to extract the needed ".img" files, or if you need a refresher, please visit Post #2 of this thread.
  • "Bump'd" TWRP Custom Recovery
  • Android Terminal Emulator
  • Busybox - 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.
  • Root Checker - to make sure that you have Root and Busybox properly installed
Where to get a copy and how do I use it?
  • Download it from the attachment of this post
  • Extract it to your Internal Storage (the "main" /sdcard, NOT /external_SD!)
How to use it?
  • Once extracted, open the folder (the name is "imageprep")
  • You will see more folders and will place the necessary files:
    • "kkimagefiles" - place your extracted Kitkat Boot Stack files here. Make sure that they are named with "kitkat-" before the filename. Make sure also that you not only change the file name, but also the file type (from ".bin" to ".img"). So, your "kkimagefiles" sub-folder should contain the following ".img" files and they should be written like this:
      • kitkat-aboot.img
      • kitkat-laf.img
      • kitkat-dbi.img
      • kitkat-rpm.img
      • kitkat-sbl1.img
      • kitkat-persist.img
      • kitkat-tz.img
    • "limagefiles" - this is empty. The script will back up your Lollipop Boot Stack files and it will place them here.
    • "tmp" - DO NOT TOUCH!
    • "twrp" - place your "bump'd" TWRP Custom Recovery here. Rename it as "twrp.img" (without the quotes).
  • Open Android Terminal Emulator
  • Type the following commands:
sh /sdcard/imageprep/
Take note of the command...I always change the filename of to the latest version. This is to ensure that you won't mistakenly use an old version of the script (Android Terminal Emulator will give you a "Not Found" error). This is intended as a safety feature.
  • The script will run automatically
  • Somewhere along the script, you will be prompted to select your preferred display sharpness (this is the Sharpness Script Mod)
  • Type a value from 0 to 40, where: 0 = disable oversharpening effect; 40 = default sharpness of LG G3
  • Press Enter to apply your selected sharpening level
  • Also somewhere along the script, you will be asked if you wanted to replace the entire Lollipop Boot Stack with Kitkat Boot Stack, or only the LAF partition (laf.img). The LAF partition is the partition that holds the "Download Mode". Some users reported that they needed to replace the entire Lollipop Boot Stack; some reported that they only need LAF. So I am giving this as an option.
  • Select "yes" (without the quotes) to replace the entire Lollipoo Boot Stack with Kitkat. Select "no" (without the quotes) if you want to replace only LAF. If you're not sure, just select "yes".
  • Remember: upon reboot, turn off your display (power button), wait for a few seconds, and turn on the display again so that the selected sharpness will take effect
I have tested this on my LG G3 D858HK, so I need folks who are willing to test this on their respective LG G3 variants and let me know!

NEW!!! Pre-packed (Repackaged) Imageprep Downloads: some good members of XDA have uploaded Imageprep pre-packed with the needed files for certain LG G3 models/variants. Big thank you!
Attached Files
File Type: zip - [Click for QR Code] (1.44 MB, 13068 views)
The Following 36 Users Say Thank You to topet2k12001 For This Useful Post: [ View ] Gift topet2k12001 Ad-Free