[G2 and Desire Z Android Development] trigeek:
There's already a guide here for obtaining permanent root using VISIONary, but some folks in #G2ROOT are having issues with the way that VISIONary modifies parititons. Using rage directly is a bit cleaner, since you know exactly what it's going to touch at each step of the way. I did NOT come up with any of this on my own, I'm building completely off of work that others have done. Speaking of which-

None of this would be possible without the tireless work that scotty2 put in. He stayed with the project for well over a month, through lots of smashed hopes and dead ends, until the solution was finally found. Were it not for his work, as well as the help of a few other key folks- we wouldn't be here. He deserves our thanks and some donations! We're talking hundreds of hours of work here, a couple bucks is not too much for that. :) His paypal is:

walker.scott@gmail.com​

Send him some love! I'm not asking for anything myself, because I spent a half hour putting this together, and that doesn't deserve any donations!

[size=+2]G2 ROOT INSTRUCTIONS[/size]

=================================================

These are modified instructions based on the ones posted at http://bit.ly/g2root that use Visionary. A number of people have run into issues with the way that Visionary juggles around temporary partitions, and using the original root exploit is a much easier, and cleaner method for achieving permanent root. This tutorial will walk you through the rooting process by first achieving temporary root, and moving on to permanent root.

[size=+1]REQUIREMENTS[/size]

=================================================

Visionary disabled at boot or uninstalled completely

Android Terminal Emulator app

ADB

vision-combined-root.zip (Attached to this post, OR these two files: )

G2TempRoot.zip (http://xdaforums.com/showthread.php?t=797042) NOTE: only download the files! Don't follow these instructions yet

vision-perm-root.zip (http://xdaforums.com/showthread.php?t=833965) NOTE: again, just download the files from the thread.

In the commands to run below, $ or # represent the prompt and should NOT be entered as part of the commands.

[size=+2]VERY IMPORTANT![/size]​

Visionary has caused filesystem corruption for some users during the rooting process. Before attempting the instructions below, make sure that you have "auto run on boot" turned OFF, and reboot your system. Since you will not need visionary anyway after this, you might as well just uninstall visionary and reboot NOW before doing anything.

[size=+1]TEMP ROOT[/size]

=================================================

ON YOUR PC:

Unzip the G2TempRoot files to a folder. From a cmd window or terminal, navigate to that folder and execute these commands:

$ adb push su /sdcard/su
$ adb push Superuser.apk /sdcard/Superuser.apk
$ adb push rage /data/local/tmp/rage
$ adb push busybox /data/local/tmp/busybox
$ adb push root /data/local/tmp/root
$ adb shell chmod 0755 /data/local/tmp/*

ON YOUR PHONE:

Launch Terminal Emulator

/data/local/tmp/rage

Wait for the message: "Forked #### childs."

Menu > Reset Term - Terminal Emulator will exit.

Launch Terminal Emulator, it Force Closes. Launch a second time, and you'll have a root shell

**NOTE**: in the original directions from the XDA thread, you are instructed to run the /data/local/tmp/root script here. DON'T do this

just yet. Leave the terminal window open.

[size=+1]PERM ROOT[/size]

=================================================

ON YOUR PC:

unzip the vision-perm-root.zip and navigate to that folder. There will be four files. You will need to push two of these to your phone- hboot-eng.img, and one of the wpthis-[..].ko files.

If you HAVE applied the OTA update, push wpthis-OTA.ko.

If you HAVE NOT applied the OTA update, push wpthis-pre-OTA.ko.

$ adb push hboot-eng.img /data/local
$ adb push wpthis-OTA.ko /data/local

ON YOUR PHONE:

You should still have terminal emulator up, at a root prompt. Now run:

# insmod /data/local/wpthis-OTA.ko

You should see:

init_module 'wpthis-OTA.ko' failed (Function not implemented)

That means it worked. This next step is CRUCIAL. You must make sure that you are writing to the proper partition here or you could brick your phone. To be absolutely clear- the partition is mmcblk(zero)p(one)(eight)

dd if=/data/local/hboot-eng.img of=/dev/block/mmcblk0p18

You should see some messages indicating that it was written. Next, run:

# /data/local/tmp/root

This will lock in root, and give you 'su' access in the future. Next, run:

# sync

Now wait at least a minute, just to be safe. After waiting, reboot your phone using the power button. After it finishes starting up, launch the terminal emulator, and type 'su'. You should get the prompt asking you to grant permissions. If you got the prompt, congratulations! You have permanent root!