• Introducing XDA Computing: Discussion zones for Hardware, Software, and more!    Check it out!

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

Search This thread

aprold

Senior Member
Aug 24, 2011
79
173
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:
Code:
    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:
Code:
; 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 :)
 
Last edited:

officialreloaded

Senior Member
Jul 10, 2011
173
25
32
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. :D ;)
 
P

Paste A Name Here

Guest
Wrong place to post that. Read the unbricking thread. Do you mean you can't access software upgrade mode by plugin your usb with the battery removed? Did you try with adb?
 

rgabi88

Senior Member
Jan 11, 2011
271
43
Constanta
Worked for me!! Only with V10A_00!!
I also made your script executable with AHK Compiler.

Problems:
- "Different country" and "English" are not automatically selected...
- LGUserCSTool remains at 4% ... but ...it still works
- After the phone reboot, I had to kill LGUserCSTool program with task manager..
- tried with v10i and the script didn't work

But the final result is the one I expect! :)

Ideeas:
- can V10A firmware been stripped down to the bones in order to speed up the process? maybe a fake firmware?!? :cool: :rolleyes:
- What has to be changed in order to flash another (any) firmware version, besides V10a, obtaining the desired firmware installed... and rooted in the same time.... Maybe it can be done including installing some user apps... huh?
 

Zakyz

Senior Member
Aug 16, 2011
196
35
Brunei Darussalam
Please post the files

Since recovery phone via lgb2c doesn't worked at all,so I just have to try this BUT no files are included!! Please post it ASAP before my parents caught my phone bricked....:(
 

N00BY0815

Senior Member
Nov 6, 2011
2,528
1,897
Does it matter from which rom the recovery.img is coming from? If not, do you mind me uploading the whole package? :) Nice tutorial anyway :D
One thing I just noticed, the script uses the wrong path to the LG software in german XP version, as it seems.
The path isn't called D:\Dokumente und Einstellungen\All Users\Application Data\LGMOBILEAX\B2C_Client

but D:\Dokumente und Einstellungen\All Users\Anwendungsdaten\LGMOBILEAX\B2C_Client

maybe also different in other languages...

but I simply searched the file and replaced the line, just wanna inform you, if anyone else reports problems ;)

-edit-
-removed-
-edit2-
Is it possible to revert from v20x to v10x like this? Or will it brick the phone?
-edit3-
can really noone answer my question?
 
Last edited:

kparmar

Member
May 21, 2008
25
3
when i start unbrick.exe this error show
 

Attachments

  • untitled.JPG
    untitled.JPG
    54.2 KB · Views: 719

Top Liked Posts

  • There are no posts matching your filters.
  • 34
    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:
    Code:
        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:
    Code:
    ; 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 :)
    6
    Package

    Just created a full package to do exacly the same as explained in the first post.
    Read the included README!!.txt first!

    Download: http://d-h.st/mUM
    2
    I've almost always got bootloop with my experiment for bluetooth-audio, but still have nandroid backup and working recovery button :p:D

    Thanks for your hardwork, aprold :)
    1
    does it perform a hard reset ?
    1
    Fantastic work, thanks!