Remove All Ads from XDA

[DEV] All-in-one flash/root/recovery unbricking script

79 posts
Thanks Meter: 176
By aprold, Member on 17th December 2011, 12:16 AM
Post Reply Email Thread
Here is a small AutoHotkey script for getting your bricked phone back in the game in less than 10 minutes. Today I noticed that my dear phone spent more time being bricked than alive. This all due to failed overclocking trials with next Nova kernel version. And even if I already managed to get my phone up in half an hour or so it still involved a lot of manual work which was disturbing my parallel tasks. Considering the fact that my endeavours with OC are still half way there I decided to automate my life a little. I chose AutoHotkey because it allowed easy interaction with LG Update tool.

Here are the files you'll need:
    161 792 adb.exe
     96 256 AdbWinApi.dll
    585 731 psneuter
  6 291 456 recovery.img
      1 534 unbrick.ahk
238 968 158 V10A_00.kdz
adb.exe and AdbWinApi.dll are taken from Android SDK, psneuter is from SuperOneClick, recovery.img I dumped from my phone mmcblk0p4 partition, unbrick.ahk is the script I wrote (you'll need to install AutoHotkey to run it), and V10A_00.kdz is LG KDZ. I did not try newer KDZ versions as my goal here was only to get recovery up and running to be able to flash CyanogenMod and continue from there. The script presumes that you already have LG USB drivers and B2C Client installed.

And here's the script itself:
; start LG Update tool (presumably installed at %ProgramData%\LGMOBILEAX\B2C_Client\)
Progress, m zh0, Starting LG S/W Update...
Run, %ProgramData%\LGMOBILEAX\B2C_Client\LGUserCSTool.exe userid=QM;usertype=B2C;region=K;country=KR;branch=KR;csemergency=F;language=KR;startstep=1;mode=TRUE;url=%A_ScriptDir%\V10A_00.kdz;binversion=V10A_00;localurl=%A_ScriptDir%\V10A_00.kdz;localver=V10A_00;usernd=Y;fileclass=CSE
WinWait, Select Country
Control, ChooseString, Diff, ComboBox1
Control, ChooseString, English, ComboBox2
Send {Enter}
WinWait, LG S/W Update

; wait for update to finish
ControlGetText, s, Edit4, LG S/W Update
Progress, m zh0, Waiting for LG S/W Update to finish...
While InStr(s, "Found(2004, 100)") = 0 {
  Sleep 100
  ControlGetText, s, Edit4, LG S/W Update
Process, Close, LGUserCSTool.exe

; at this point the phone should be rebooting
Progress, m zh0, Wait for the phone to reboot and turn on USB debugging to continue.
RunWait, adb.exe kill-server
RunWait, adb.exe -d wait-for-device

; get temporary root and flash recovery
Progress, m zh0, Rooting...
RunWait, adb.exe -d push recovery.img /data/local/tmp/
RunWait, adb.exe -d push psneuter /data/local/tmp/
RunWait, adb.exe -d shell "chmod 0755 /data/local/tmp/psneuter"
Run, adb.exe -d shell /data/local/tmp/psneuter,,,pid
Sleep 3000
WinKill, %pid%
RunWait, adb.exe kill-server
RunWait, adb.exe shell "dd if=/data/local/tmp/recovery.img of=/dev/block/mmcblk0p4" 
Progress, OFF
RunWait, adb.exe reboot recovery
MsgBox, The phone is rebooting into recovery now and we're done here.
Just boot your phone to software update mode and execute unbrick.ahk. It'll perform the following tasks:
  • Executes LG Update tool, waits for it to finish, and kills it then
  • Waits for you to enable USB debugging
  • Roots the shell with psneuter, flashes and reboots to recovery
From this moment on you can already continue inside recovery to restore your backup or flash CM and so on. This and enabling USB debugging are the only user interactions, everything else is automated with the script.

I hope someone will find it useful beside me as well. Do not fear experimenting with stuff and bricking the phone - unbricking is as easy as running a single script. This is a huge timesaver if you're planning to do this in hourly basis
The Following 34 Users Say Thank You to aprold For This Useful Post: [ View ] Gift aprold Ad-Free
17th December 2011, 12:51 AM |#2  
redy2006's Avatar
Senior Member
Thanks Meter: 571
Donate to Me
I've almost always got bootloop with my experiment for bluetooth-audio, but still have nandroid backup and working recovery button

Thanks for your hardwork, aprold
The Following 2 Users Say Thank You to redy2006 For This Useful Post: [ View ] Gift redy2006 Ad-Free
17th December 2011, 01:07 AM |#3  
gabwerkz's Avatar
Senior Member
Flag Three Stars and a Sun
Thanks Meter: 1,545
Count me in! I don't know how many times I bricked/unbricked my phone (poor thing). Thanks for dedicating such time.
17th December 2011, 03:41 AM |#5  
Senior Member
Thanks Meter: 25
Thanks a lot aprold, i happen to brick my phone averagely 2-3 times a week. Will surely follow this method with next brick. Perhaps for the first time i 'm eager to see my OB bricked.... may your nova v12 test version give that chance.
17th December 2011, 10:05 PM |#7  
OP Member
Thanks Meter: 176
Originally Posted by Ilko

does it perform a hard reset ?

What do you mean by that? Wiping data? This is actually a good idea as you'd have to do this in recovery anyway. I'll add it next time I'm bricking my phone
17th December 2011, 10:49 PM |#8  
Thanks Meter: 15
Please add the archive with all files.
18th December 2011, 03:17 AM |#9  
Ilko's Avatar
Senior Member
Funky town
Thanks Meter: 529
Originally Posted by aprold

What do you mean by that? Wiping data? This is actually a good idea as you'd have to do this in recovery anyway. I'll add it next time I'm bricking my phone

I mean the reset process which is performed when r&d test tool is used. in some cases this is the only way to unbrick
21st December 2011, 02:10 AM |#10  
vincelokmeg's Avatar
Junior Member
Thanks Meter: 3
Please add the archive with all files.
22nd December 2011, 04:15 AM |#11  
Flag Phnom Penh
Thanks Meter: 0
My phone is in black screen with 4 button blinking. Can't get into Software Update mode. what should I do?
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes