[Droid Eris Android Development] anoek:
How I *made* a "good" card to get into adb recovery

So I just got into adb recovery, twice.

This is awesome because I had bought 3 2gb pny cards, and borrowed a hand full of other cards, tried this method well over a hundred times and failed on every account. None of them seemed to have the magic that tereg's "good" card did. Until now.

Requirements:

2 flash cards, mine happened to be the same size, but I'm 99% sure they don't have to be. One of them you should be a normal card, mine was recently formated, but it really shouldn't matter. The other one, we are going to add a bunch of partitions and make into a "good" card to get us into recovery mode.

*NOTE* Following these instructions will make your new "good" card unreadable by the android phone! I'm hoping it's readable by other sd card readers you can plug into your computer, but I don't have one so I don't know! However, this new "good" card functioned to get me into adb recovery, so I could care less if it is still usable for anything else or not!

How I made a "good" card:

* With your phone normally booted, insert your future "good" card into the phone and select "Disk drive" so you can see the sdcard on your computer.

* Open up your card in fdisk

* Delete all of the existing partitions

* Create three new primary paritions, I created each one of mine with just 1 block, though you can probably give them more

* Create an extended partition, give it the rest of the card space

* Create 56 more partitions, i created each one with just 1 block, but I doubt it really matters. (56 happens to be the maximum number of parititions you can create.. it's not a magic number, i just did it until i couldn't do it anymore)

* Write that to the card, sync, change back to Charge only

(You can probably do all of that in windows using the disk manager, but I'm not a windows guy so I'll let someone else post about that..)

You may be able to make a card that isn't completely useless after you get into recovery, but since I haven't (and can't) test right now, I'm putting my thoughts on this at the bottom of the post. Someone else should try it out and see if it works!

EDIT: For those of you using fdisk, once in fdisk you should just be able to paste in h ttp://pastebin.com/h60j2HPx to setup all of your partitions.. hit p <enter> to view the partition table and make sure everything looks ok, then hit w <enter> to write the changes to the disk. If it errors out about the +1's, then your fdisk is not as awesome as mine and you'll have to manually specify the partition ends (meaning, you'll see the start sector for your partition, add one to it and type this in instead of the +1's) PLEASE be careful with fdisk. If you select the wrong device, you can very easily wipe out your hard drive!! If you are affraid, gparted or windows or something else!

Using the new "good" card:

Follow teregs instructions until you get into the adb recovery device. That is, boot into the fastboot menu with the card out, boot hboot, when the phone vibrates, count to 4-1000 pretty quickly and insert your hopefully-now-"good" card. With any luck, you'll see the recovery device pop up. NOW: Eject that card, and put in your other card that has the usable file system. Continue following teregs instructions, and enjoy your rooted phone!

Now, as for why this works: I'm pretty sure it's because it extends the window to exploit the race condition which brings up the adbd recovery device. These dmesg logs are from a normal boot with the card already in:

2GB card with 1 partition:

<3>[ 5.709106] mmc1: Command timeout (cmd= 8 mci_st=00000004)
<4>[ 5.714782] Warning: unable to open an initial console.
<3>[ 5.715484] mmc1: Command timeout (cmd= 5 mci_st=00000004)
<3>[ 5.721832] mmc1: Command timeout (cmd= 5 mci_st=00000004)
<3>[ 5.727966] mmc1: Command timeout (cmd= 5 mci_st=00000004)
<3>[ 5.734313] mmc1: Command timeout (cmd= 5 mci_st=00000004)
<4>[ 5.741577] desirec_sdslot_switchvdd: Setting level to 2800
<3>[ 5.746704] mmc1: Command timeout (cmd= 8 mci_st=00000004)
<4>[ 5.828857] mmc1: host does not support reading read-only switch. assuming write-enable.
<6>[ 5.829345] mmc1: new SD card at address bffc
<6>[ 5.835540] mmcblk0: mmc1:bffc SU02G 1.89 GiB
<6>[ 5.836456] mmcblk0: p1

Note the time between the last mmc1: Command timeout line and the last line, when the device is recognized by the system.. it's about 0.09 seconds.

Our "good" card with 60 partitions:

<3>[ 6.036529] mmc1: Command timeout (cmd= 5 mci_st=00000004)
<3>[ 6.042663] mmc1: Command timeout (cmd= 5 mci_st=00000004)
<3>[ 6.049011] mmc1: Command timeout (cmd= 5 mci_st=00000004)
<3>[ 6.055145] mmc1: Command timeout (cmd= 5 mci_st=00000004)
<4>[ 6.062591] desirec_sdslot_switchvdd: Setting level to 2800
<6>[ 6.479675] yaffs: dev is 32505859 name is "mtdblock3"
<6>[ 6.480163] yaffs: passed flags ""
<4>[ 6.480407] yaffs: Attempting MTD mount on 31.3, "mtdblock3"
<4>[ 6.486694] mmc1: host does not support reading read-only switch. assuming write-enable.
<6>[ 6.486999] mmc1: new high speed SD card at address 1234
<6>[ 6.488739] mmcblk0: mmc1:1234 SA02G 1.83 GiB
<6>[ 6.489471] mmcblk0: p1 p2 p3 p4 < >

Notice that the window is now .43 seconds, making it much easier (if not strictly possible), to exploit!

Other Thoughts:

I'm not sure if the android phone won't recognize the "good" card anymore because it has 60 partitions, or because the first partition I created is only 1 block. I'm starting to guess the later though, so it may be the case that the phone wont freak out if the partitions aren't so small, so for someone daring, or that has a normal sd card reader that can likely reset their card if this doesn't work, I'd be curious to know if creating a large usable partition 1, then creating 59 other smaller partitions, produces a "good" card that can get you into recovery, as well as a card that you can continue using later. If that works, then you should be able to use that one card throughout the process without the need for a second card, maybe.

System Setup Notes:

I did everything on linux, though I'm now positive you can do this on any OS with the SDK installed on it though. I wasn't running the loop, but I'm positive it's fine to run it (since tereg regularly runs it as he gets into adb recovery). My phone was flashed with the RUU update as per tereg's instructions, although I had already started using it as normal phone again, that is to say, I had setup my gmail account, installed a few apps, my data service and phone were both turned on.. no airplane mode or anything like that. I'm 99% sure none of that matters.

Hope this helps some others that have had crappy luck with that hellish timing step! Don't blame me if you can never use that "good" sd card for anything except getting into recovery mode again!