[myTouch 4G Android Development] ksubedi:
You just rooted your Mytouch 4g using gfree. But for some reason you want to get back to stock again and unroot the device and lock the bootloader (s-on). If you used gfree, the only method would be to restore ur partition 7 backup file. But what if you dont have that file or if you lost it?

Lets start off by talking about partition 7 first. Partition 7 is the seventh partition on your emmc chip where all the device specific data like imei number are stored. It also contaiins a flag which control's the s-on/off status of the bootloader. Gfree patches the flag and makes your bootloader show "s-off" which is basically unlocking the bootloader. gfree automatically backup's your partition7 image file to your sd card which is named part7backup-xxxxxxx.bin . This file is the image or copy of your original parititon 7 where everything is stored. Gfree makes this backup so that you can restore it to stock if you need it later.

Ok so you lost it, what now? you could just get someone else's part7bin file from xda or somewhere else and replace ur's. But whats the problem with that? your imei number will be replaced with their and there will be 2 phones with the same imei on the same network. And according to what i have learnt, this is illegal. So how do u fix this? Well, there is a way, but what i am going to explain below will help you restore the imei of your phone to your own by using someone else's part7backup file.

PLEASE NOTE THAT CHANGING IMEI NUMBER TO SOMEONE ELSE'S IMEI IS ILLEGAL AND IS CONSIDERED A CRIME. PLEASE USE YOUR OWN IMEI NUMBER AND DO NOT POST YOUR PARTITION7BACKUP FILE IN PUBLIC! I TAKE NO RESPONSIBILY IF YOU BRICK OR DAMAGE YOUR PHONE BY USING THE STEPS BELOW. IT WORKED FOR ME SO IT SHOULD WORK FOR YOU AS WELL.

You will need to do some hex editing in order to do this, and every step is REQUIRED, if you dont follow every step carefully, you might BRICK your phone and no one but yourself will be responsible for that.

Instructions:

Warning : THIS MIGHT ERASE ALL YOUR DATA

1) Make up your mind to do some hardcore hacking with your phone (jk its not hardcore) :D

2) Get a hex editor, i would recomment 30 day trial of 010 editor. Get it here : http://www.sweetscape.com/download/download_010editor.html

3) Install it. Now dowload the attached part7.zip file and extract part7.bin file (DO NOT REPLACE THIS PART7 BIN FILE DIRECTLY YOU MIGHT BRICK YOUR PHONEE!! This file has the imei number removed)

4) Now right click the extracted part7.bin file and open with 010 editor (Or open the file with any other hex editor).

5) 010 Editor will pop up, scroll down till you get to address 0600h

5) As you can see on the image above, the 14 ++++++++++++++ bytes are where your imei number will go. I replaceed the original imei on the part7bin file with ++++++++++++++ for security reasons.

6) Get the original IMEI number of your phone from the back of your battery or from your phone's box if you have one.

7) Type it in notepad or somewhere and copy the first 14 numbers out of 15. The last number is automatically generated and is called imei check number. It is generated automatically using luhn algorithm.

DO NOT USE ANY OTHER IMEI NUMBER THAN YOUR OWN, ITS ILLEGAL! AND DO NOT PUT RANDOM NUMBERS IT MIGHT BRICK YOUR DEVICE!!

8) Go to 010 editor, select the 14 + signs, and right click them, and paste the copied imei.

9) The first 14 digits of your IMEI should be in yellow letters now.

10) Press CTRL+S to save the file.

11) Connect your phone, and put the edited part7.bin file on your sdcard.

12) If you are running stock ROM which is already rooted, skip to step 17

13) Download this file : http://www.megaupload.com/?d=V4NAODYZ

(You are about to restore your phone to stock rom, because we will need to push the part7bin file to your phone, and to do so emmc power cycling is necessary. Most other kernel's dont support modules needed to power cycle emmc. So you will need to use PD15IMG.zip method to get back to stock if you arent on it already.)

14) Put it on your sdcard.

15) Power down your phone and hold your volume down + power button till you get into a white screen with some stuff on it.

WARNING : DOING THE NEXT STEP WILL ERASE ALL YOUR DATA!

16) Press power to get into boorloader mode. Wait till it scans the PD15IMG.zip file. Then press volume up when asked. Wait till it completes and restarts into your stock rom.

17) Download Visionary from here : http://android.modaco.com/topic/320350-19nov-r14-visionary-one-click-root/ and install it on your phone.

18) Turn on usb debugging and temp-root the phone using visionary if not rooted already.

19) Install adb drivers and install android sdk : follow instructions here if you havent already : http://xdaforums.com/showthread.php?t=928370

20) Connect your phone to pc, and change usb mode to "Charge Only". (!IMPORTANT)

21) Now download the gfree.zip file attached and extract it somewhere.

22) If you are on windows vista and up, hold down shift button and right click on the extracted gfree folder. Choose open command window here. (if not on win 7 or vista, open cmd and navigate to the folder).

23) Type the following in the command window as it is, do not change anything if you dont know what you are doing.

24) Now you should see a $ sign in the front. Type the following, press enter and press allow on your phone's screen when asked.

25) You should see a # sign now instead of $. Now use the follwing commands:

26) Your phone will reboot now. And if everything worked perfect, you will see your original imei. To check this open dialer and type *#06# . If you get original imei, then you're done, you will have stock rom with original imei and everything. Enjoy :)

This was definitely not a easy task, but after working on it for whole night and risking my phone (i could have bricked it), i finally got mine working. Now you can root and do everything else. But just dont forget to save the original part7backup file in safe place if you use gfree again :D Peace

I TAKE NO RESPONSIBILITY WHAT SO EVER IF ANYTHING GOES WRONG WITH YOUR PHONE! USE AT YOUR OWN RISK.

MODS: I could make an easy part7bin generator for windows, but i am not sure if that would be illegal or if i would be allowed to publish that on xda. Please guide me on this. I am sure an generator would make a lots of things easier. :)