[G2 and Desire Z Android Development] Mr_Q:
This thread is copied and modified from the G2 thread by trigeek for the Desire Z:

http://xdaforums.com/showthread.php?t=834228

Apart from the changed hboot and wpthis-Z kernel module for the Desire Z instead of the G2, I have also updated the su-binary and SuperUser.apk to the latest version by ChainsDD

In no way I can be held responsible for any bricks to your phone. You are using this guide at your own risk!!

I did test this guide on my own, and also on a friend's Desire Z.

As there was no manual rooting guide for the Desire Z, I posted it myself in order to help others that do not like visionary and like to do it 'the clean way'.

[GUIDE] Temp to permanent root on Desire Z, using rage instead of visionary

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

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!

DESIRE Z ROOT INSTRUCTIONS

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

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.

REQUIREMENTS

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

•Visionary disabled at boot or uninstalled completely

•Android Terminal Emulator app

•ADB

•desirez-combined-root.zip (Attached to this post)

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

VERY IMPORTANT!

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.

TEMP ROOT

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

ON YOUR PC:

Unzip the z-temp-root 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:

1.Launch Terminal Emulator

2.

/data/local/tmp/rage

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

4.Menu > Reset Term - Terminal Emulator will exit.

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

6.**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.

PERM ROOT

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

ON YOUR PC:

unzip z-perm-root and navigate to that folder. There will be four files. You will need to push two of these to your phone: hboot_7230_0.84.2000_100908.nb0 and wpthis-Z.ko. The other two files are optional for checksum verification.

$ adb push hboot_7230_0.84.2000_100908.nb0 /data/local
$ adb push wpthis-Z.ko /data/local

Optional but might came in handy:

$ adb push md5checksum /sdcard/md5checksum

ON YOUR PHONE:

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

Optional but recommended:

# /data/local/tmp/busybox md5sum /data/local/*

You should see:

hboot_7230_0.84.2000_100908.nb0

2ce1bdd5e4c1119ccfcecb938710d742

wpthis-Z.ko

c73c5e77c91d306c418983c002b60b93

In case your hboot or wpthis-Z.ko file do not have the same md5hash as shown above, DO NOT CONTINUE. This means your file is corrupt or you are using a different file, for example the one for the G2 instead of Desire Z.

Now, let's turn off security for permanent flashing:

# insmod /data/local/wpthis-Z.ko
init_module 'wpthis-Z.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)

You should see some messages indicating that it was written.

# /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!