View Full Version : How do I backup original images?
damccull
22nd January 2009, 11:06 PM
Hello,
I\'m getting ready to do the RC30->RC29->Android Dev SPL->ModRC30/ADP1 conversion of my G1, but I would like to know if there is any way to dump all three of the current images (spl, recovery.img, and the RC30 stock image) to my computer before I do this so that I can revert back to factory if I even need to.
Anyone know of a way to do that? Also, what sort of differences in the interface or reliability of the phone\'s services are there between the stock RC30 and the modified version? And how about with the G1 development builds?
Thanks ahead of time for answering, folks. I\'m still new to HTC hacking. I appreciate it.
damccull
namsir
22nd January 2009, 11:41 PM
using fastboot to restore your images :)
damccull
23rd January 2009, 12:29 AM
True. But how do I back up the images before I go through with the upgrade in the first place? Restoring is the second step, and from what I understand, fastboot isn't supported by the G1 stock bootloader.
humble
23rd January 2009, 01:31 AM
By JesusFreke
How to flash the G1
--------------------------------------------------------------------------------
WARNING: Following these instructions may brick your phone, void your warranty and kill your dog. You don't want your dog to die do you?
Once I got root access on my G1, I've been messing around with trying to build reflash the recovery partition. That project is still in progress, but I have learned a bit about how to flash the various partitions on the G1.
First things first, you have to have root access. See this thread.
There are 6 mtd devices or partitions on the G1, mtd0-mtd5. They are located at /dev/mtd. You can use the /system/bin/flash_image tool to flash an image to any of these.
The syntax for the flash_image tool is:
Code:
# flash_image
usage: flash_image partition file.img
#You can see a list of partition names and which device they are associated with by doing a "cat /proc/mtd".
Code:
#cat /proc/mtd
dev: size erasesize name
mtd0: 00040000 00020000 "misc"
mtd1: 00500000 00020000 "recovery"
mtd2: 00280000 00020000 "boot"
mtd3: 04380000 00020000 "system"
mtd4: 04380000 00020000 "cache"
mtd5: 04ac0000 00020000 "userdata"
#
These should all be self explanatory, except maybe "misc", which just appears to have a few string values.. Not really sure what it's used for..
Before you do any erasing or writing, it's a "really good idea" (tm) to make backups of each of these. Even if you don't plan on writing to them. I had accidentally erased the bootloader partition (typed mtd0 instead of mtd1), which I'm fairly sure would have bricked my phone if I had tried to reboot it. Ugh! Luckily, I had created a backup earlier, so I was able to restore it. (And then was nervous as heck when I tried to reboot it... "Please boot up! Please boot up!")
To create the backups:
Code:
# cat /dev/mtd/mtd0 > /sdcard/mtd0.img
# cat /dev/mtd/mtd1 > /sdcard/mtd1.img
# cat /dev/mtd/mtd2 > /sdcard/mtd2.img
# cat /dev/mtd/mtd3 > /sdcard/mtd3.img
# cat /dev/mtd/mtd4 > /sdcard/mtd4.img
# cat /dev/mtd/mtd5 > /sdcard/mtd4.img
#Now you can use flash_image to write the new image.
Code:
#flash_image recovery /system/recovery.img
#And that's how it's done.
Update: You normally don't need to erase the flash before you write, as long as you don't corrupt the flash first, by trying to "cat" an image directly to the mtd device, like I did . If you get a lot of ECC errors when you use flash_image then you need to erase it
Code:
# cat /dev/zero > /dev/mtd/mtd1
write: No space left on device
#
On a related note, Based on my experience so far, the recovery partition is not critical to booting the G1. When I first tried this, I used flash_image to write a new image without erasing the partition first, and it corrupted it pretty good. When I tried to boot the G1 into recovery mode (power+home), it would go to the bootloader screen instead. But it would boot into normal mode just fine.
Additionally, I've verified that the device will boot into recovery mode if you screw up the boot partition (mtd2). So as long as you at least have a good recovery image *or* a good boot image, you should be able to get back in business. Just don't try to update both at the same time.
Even so.. be careful, and don't come crying to me when you brick your phone. Or if your dog dies. You don't want your dog to die do you?
--------------------------------------------------------------------------------
Thats what i did befor i had root
JesusFreke
23rd January 2009, 02:25 AM
By JesusFreke
How to flash the G1
...
Thats what i did befor i had root
Wow, blast from the past :). So did your dog die? :D
humble
23rd January 2009, 02:55 AM
Wow, blast from the past :). So did your dog die? :D
yeah back then:( but good thing i had thoes back ups you saved me 4 & some change:D lol
damccull
24th January 2009, 12:38 AM
humble, thanks for the repost. That helps. :) My phone is successfully flashed to JC's modded RC30 now. Hurray! Now what other neato things can I do to this thing? >:D
And JesusFreke, thanks for the mad cool images. I like the backup feature you and those other people hacked into the recovery mode. ALT-B for the win! How did you figure out how to dump those images in the first place? And then modify them for root? That's beyond my comprehension. Where would you suggest I begin to learn at? :)
-damccull
JesusFreke
24th January 2009, 10:47 AM
And JesusFreke, thanks for the mad cool images. I like the backup feature you and those other people hacked into the recovery mode. ALT-B for the win! How did you figure out how to dump those images in the first place? And then modify them for root? That's beyond my comprehension. Where would you suggest I begin to learn at?
-damccull
It depends on your current level of expertise :). If you're a programmer, go check out the source, there's tons of useful info. But really, it's just a matter of trying to figure out how it all works. Playing with it, breaking it, fixing it.. you get the idea :)
humble
24th January 2009, 12:56 PM
humble, thanks for the repost. That helps. :) My phone is successfully flashed to JC's modded RC30 now. Hurray! Now what other neato things can I do to this thing? >:D
-damccull
i always try to help;) now your on a modded image Woot!Woot! enjoy:D
damccull
25th January 2009, 12:35 AM
It depends on your current level of expertise . If you're a programmer, go check out the source, there's tons of useful info. But really, it's just a matter of trying to figure out how it all works. Playing with it, breaking it, fixing it.. you get the idea
Hmm. I am a programmer. I'll look at the source. But how do you figure out how to dump an image off of a phone in the first place? You modded the RC30 ota image to create yours right? Did you just copy the system files off somehow? What kinds of tools did you use? I find this stuff really interesting :) Thanks for the replies!
JesusFreke
25th January 2009, 03:05 AM
Hmm. I am a programmer. I'll look at the source. But how do you figure out how to dump an image off of a phone in the first place? You modded the RC30 ota image to create yours right? Did you just copy the system files off somehow? What kinds of tools did you use? I find this stuff really interesting :) Thanks for the replies!
I mainly modified the OTA itself. Added binaries, a new kernel.. etc. etc. I didn't have to pull anything from the phone, because it's all in the OTA.
damccull
27th January 2009, 04:10 AM
Oh, you copied the update file off the phone after it downloaded and modded that? :) Sweet.
vBulletin® v3.8.7, Copyright ©2000-2012, vBulletin Solutions, Inc.