[Q] dead mmc -- ideas?

extrem0

Senior Member
Feb 7, 2012
1,188
467
0
Now that it's finished booting, it's really not sluggish at all. Hooray for class 10 sd cards.

Just to make this whole thing even a bit easier, I grabbed an arm-compiled version of the fastboot tool (search for fastbootarm) and put the kernel and ramdisk on my phone, so I can jump-start the tablet using my phone (via USB OTG cable) even when I'm not near my computer.
I read somewhere that class 4 sdcards can have random speeds faster than class 10. I didn't research about it but the source was confident if I recall correctly.

Congratulations for this! This will give life back to many expensive paperweights.
 

basuraunak

Senior Member
Aug 20, 2012
643
240
0
New Delhi
great!
That would be of great help in those unfortunate situations where we might have to end up with some expensive and shiny Coasters! :p:p
OP can you put up an generalized steps for other devices..is that possible??

:D:D
 

masterhaides

Senior Member
Apr 2, 2007
54
13
0
www.kali.org
I Support This

Would this be possible on any android device ?

I have a LG Optimus 3D (p920).
I have several devices i can test SD booting on...

---------- Post added at 11:20 PM ---------- Previous post was at 11:01 PM ----------

I'm using a custom build of TWRP that allows booting between multiple ROMs, stored wherever you choose, in a variety of formats. http://forum.xda-developers.com/showthread.php?t=2684052

Couldn't this method also be used? (And be simpler?)
Version Multiboot V2.1 add support for ubuntu touch 14.04 support ( only img files )

^^^^ that line is from your link, thanks ;)

and her is my video i made long ago for the Captivate...
https://www.youtube.com/watch?v=1XgKOFv197A

showing how to make a custom image from scratch
 

aguaz

Senior Member
Jan 16, 2014
136
31
0
To boot it, I put my tablet into fastboot mode. I booted the kernel and ramdisk using 'fastboot boot' -- no need for kexec from recovery. I can do this without any reliance whatsoever on the internal EMMC.
Coming from a Galaxy device I'm not very familiar with fastboot.
Where did you store the boot.img (kernel + ramdisk)? Where does fastboot itself boot from?

---------- Post added at 10:33 PM ---------- Previous post was at 10:32 PM ----------

With this breakthrough, what all partitions are possible to be mounted from the SdCard?
/cats
 

lexelby

Senior Member
Jan 6, 2012
94
81
0
I had a similar issue with my Nexus 5 and 7 (2013) where I could no longer mount or read the /data or /system partitions but I could still boot into recovery and thought I scored two brand new drink coasters, but then came across this thread where it repaired corrupted partitions and I could now read and mount all partitions normally.

Being a Transformer tablet and not a Nexus device i'm assuming one or two of the adb commands might be a bit different for the disk partitions like someone mentioned in a previous post though..?

Might not be useful to you but thought I'd post it here anyway incase it might help somehow :cowboy:
A useful technique, but filesystem corruption definitely was not the problem in my case. Trying to fsck a filesystem on a failing device is just asking to make the problem worse :) As folks in that thread pointed out, if your FS is badly corrupted, fsck is really just to get it functional enough to try to get your data off, then you should reformat. CWM has a 'format /data' option and similar for /system.
 

lexelby

Senior Member
Jan 6, 2012
94
81
0
I'm using a custom build of TWRP that allows booting between multiple ROMs, stored wherever you choose, in a variety of formats. http://forum.xda-developers.com/showthread.php?t=2684052

Couldn't this method also be used? (And be simpler?)
Not necessarily in my case. First of all, I'm not sure what magic twrp might be doing, but I'm pretty sure it can't force a ROM to use certain partitions if the ROM's initramdisk isn't set up that way. And second, in my case, my internal SD is failing -- and that's where the recovery is stored. I can sometimes get recovery to boot now, but I wouldn't be surprised to lose that functionality entirely.
 

lexelby

Senior Member
Jan 6, 2012
94
81
0
great!
That would be of great help in those unfortunate situations where we might have to end up with some expensive and shiny Coasters! :p:p
OP can you put up an generalized steps for other devices..is that possible??

:D:D
No need -- my steps are sufficiently general that they would work for any device with fastboot, and probably any ROM.
 

lexelby

Senior Member
Jan 6, 2012
94
81
0
(wherein I learn how to multiquote... sorry for the email notification spam!)

With this breakthrough, what all partitions are possible to be mounted from the SdCard?
Anything, really. Any device that the kernel can recognize as something mountable. I think you could even make ext4fs images in files on a FAT32-formatted SD card, if you really wanted... depends on whether the fstab for your rom allows mount options though, I suppose. I could, for example, make 5 sets of /system and /data on a really huge SD card and switch between 5 different ROMs, each of which I modded to boot off of its own pair of partitions.

Coming from a Galaxy device I'm not very familiar with fastboot.
Where did you store the boot.img (kernel + ramdisk)? Where does fastboot itself boot from?


I believe fastboot is built into the chips in the device itself -- think of it as analogous to the BIOS on a traditional PC. You can get into the BIOS without any disks connected, and it can try to boot an OS. Fastboot is a low-level interface to let you write the recovery or boot partitions, or even boot an image on the fly (which is what I'm doing).

A boot.img is just a packed up ramdisk and kernel, the two pieces necessary to boot a Linux system. When I do `"fastboot boot kernel.gz initramfs.gz", the fastboot command on my computer transfers the ramdisk and kernel to the device, which stores them directly in memory and then executes the kernel. The internal SD is never involved in that process.


Ooh, check it out, this thread made xda's front page!

An update: turns out that running fastbootarm on my phone doesn't work -- no idea why, but it can't see the tf701t. So that left me back with a "tethered" solution (what is this, a jailbroken iphone?!). I built a boot.img out of my modified ramdisk and kernel (using mkbootimg from the android SDK) and flashed that to the tf701t's internal SD using fastboot on my computer. That worked the one time I've tried booting off of it, so provided my internal SD doesn't completely fail, I can boot without my computer. If it does fail, I'll be back to tethered -- but at least I don't have a coaster :)

My class 10 card is fairly fast, but the system does get hung up on IO fairly often (thanks, Cool Tool!). I'm thinking about one of those sandisk extreme pro cards rated at like 80MB/s. Still, the tablet is far more usable now than when it was a paperweight :)
 

aromerblz

Senior Member
Sep 23, 2012
479
111
73
my backyard
(wherein I learn how to multiquote... sorry for the email notification spam!)



Anything, really. Any device that the kernel can recognize as something mountable. I think you could even make ext4fs images in files on a FAT32-formatted SD card, if you really wanted... depends on whether the fstab for your rom allows mount options though, I suppose. I could, for example, make 5 sets of /system and /data on a really huge SD card and switch between 5 different ROMs, each of which I modded to boot off of its own pair of partitions.



I believe fastboot is built into the chips in the device itself -- think of it as analogous to the BIOS on a traditional PC. You can get into the BIOS without any disks connected, and it can try to boot an OS. Fastboot is a low-level interface to let you write the recovery or boot partitions, or even boot an image on the fly (which is what I'm doing).

A boot.img is just a packed up ramdisk and kernel, the two pieces necessary to boot a Linux system. When I do `"fastboot boot kernel.gz initramfs.gz", the fastboot command on my computer transfers the ramdisk and kernel to the device, which stores them directly in memory and then executes the kernel. The internal SD is never involved in that process.


Ooh, check it out, this thread made xda's front page!

An update: turns out that running fastbootarm on my phone doesn't work -- no idea why, but it can't see the tf701t. So that left me back with a "tethered" solution (what is this, a jailbroken iphone?!). I built a boot.img out of my modified ramdisk and kernel (using mkbootimg from the android SDK) and flashed that to the tf701t's internal SD using fastboot on my computer. That worked the one time I've tried booting off of it, so provided my internal SD doesn't completely fail, I can boot without my computer. If it does fail, I'll be back to tethered -- but at least I don't have a coaster :)

My class 10 card is fairly fast, but the system does get hung up on IO fairly often (thanks, Cool Tool!). I'm thinking about one of those sandisk extreme pro cards rated at like 80MB/s. Still, the tablet is far more usable now than when it was a paperweight :)

Excuse the noobness, when you said all partitions, those that include like radio/modem partition. Am asking for a project am working on. Converting a SGH-S970G to a SGH-M919. Like fully running the phone off the SD card.
 

lexelby

Senior Member
Jan 6, 2012
94
81
0
HTML:
Excuse the noobness, when you said all partitions, those that include like radio/modem partition. Am asking for a project am working on. Converting a SGH-S970G to a SGH-M919. Like fully running the phone off the SD card.
Oh! I'm so sorry, I misunderstood your original question. I had forgotten that samsung devices (and probably others?) use a separate partition to hold the radio firmware. Actually makes me wonder if maybe my device's wifi card is still being read off of the internal SD -- well, it works for now, hooray.

To answer your question, I don't know. My method works for booting because I changed the ROM's idea of what device/partition /system and /data live on. I don't know where your device holds its idea of which partition holds the radio firmware. If it's somewhere in the initramfs, then you can modify it in the same way I modified mine and tell it to load the radio off of the external SD. If the ROM is hardcoded to look for the radio on the internal SD, then you may be screwed.

A quick note on the initramfs for those curious: the initramfs (initrd, initramdisk, etc) is a compressed miniature linux filesystem holding the bare essentials necessary to get a linux system running. The initrd's job is to figure out where the filesystem(s) are that hold the actual linux installation, mount them, and hand over control to that linux system.

It's not absolutely necessary to use an initrd to boot a linux system, but it makes it a lot easier because you can load drivers, prepare the filesystem, etc. The stock ROM for the TF701t (and I'm assuming most, if not all ROMs for all android devices) use an initrd to mount /system, /data, and any other necessary partitions. I'm just telling it to mount those from my external SD instead of internal.

I don't know how radio partitions work. Is it just a raw firmware image on the partition, or is it an ext4 (or other) filesystem with a firmware binary file on it? The latter case might mean the initrd mounts the radio firmware along with everything else it does before handing over control to android, so it might mean you can change it to a partition on the external card.
 
  • Like
Reactions: aguaz and aromerblz

aromerblz

Senior Member
Sep 23, 2012
479
111
73
my backyard
HTML:
Oh! I'm so sorry, I misunderstood your original question. I had forgotten that samsung devices (and probably others?) use a separate partition to hold the radio firmware. Actually makes me wonder if maybe my device's wifi card is still being read off of the internal SD -- well, it works for now, hooray.

To answer your question, I don't know. My method works for booting because I changed the ROM's idea of what device/partition /system and /data live on. I don't know where your device holds its idea of which partition holds the radio firmware. If it's somewhere in the initramfs, then you can modify it in the same way I modified mine and tell it to load the radio off of the external SD. If the ROM is hardcoded to look for the radio on the internal SD, then you may be screwed.

A quick note on the initramfs for those curious: the initramfs (initrd, initramdisk, etc) is a compressed miniature linux filesystem holding the bare essentials necessary to get a linux system running. The initrd's job is to figure out where the filesystem(s) are that hold the actual linux installation, mount them, and hand over control to that linux system.

It's not absolutely necessary to use an initrd to boot a linux system, but it makes it a lot easier because you can load drivers, prepare the filesystem, etc. The stock ROM for the TF701t (and I'm assuming most, if not all ROMs for all android devices) use an initrd to mount /system, /data, and any other necessary partitions. I'm just telling it to mount those from my external SD instead of internal.

I don't know how radio partitions work. Is it just a raw firmware image on the partition, or is it an ext4 (or other) filesystem with a firmware binary file on it? The latter case might mean the initrd mounts the radio firmware along with everything else it does before handing over control to android, so it might mean you can change it to a partition on the external card.
Really nice explanation.. I would really need a guide to do all this and find out where the radio mounts at the starting point to direct it to another partition. Since I cannot flash modem.bin with out failing. As the bootloader fails signature check everytime. With this on the other hand I think I would load the partion where the other radio is located.. in this case an sd card partition. All in all I think this is a really awesome hack that if explored can give a lot of possibilities.

It has been proven with some Samsung devices to flash the bootloader from an sdcard just to boot up the phone.
 

micahs

Member
Feb 10, 2012
34
6
0
I did a bunch of research into the sd card thing when I was dual booting the Nook Color and Nook Tablet a while ago. The Sandisk class 4 cards were the best. I used Crystal Diskmark to look at the 4k random r/w speeds. Slow cards definitely will impact system performance. (New, fast cards transfer large blocks of data quickly, but small blocks sometimes really slowly.) I'll look around for old benchmarks from good cards for comparison...

EDIT: Can't find any. Grrr. I think the 4k random reads were usually no problem, but the writes sometimes were so slow that the os lagged. Iirc, above 1MB/s was fine. Below that might cause problems. It's been a while, though!
 
Last edited:
  • Like
Reactions: pelago

dstruct2k

Senior Member
Jan 31, 2008
1,253
937
0
Winnipeg
I don't know how radio partitions work. Is it just a raw firmware image on the partition, or is it an ext4 (or other) filesystem with a firmware binary file on it? The latter case might mean the initrd mounts the radio firmware along with everything else it does before handing over control to android, so it might mean you can change it to a partition on the external card.
(also @aromerblz)
On the Galaxy S3 I747, it's a FAT filesystem with about a dozen individual files inside. I'd imagine most Samsung devices are similar. You could definitely reassign that partition to another block/loop device if you wanted. I can't promise that the firmware would get loaded into the modem properly though, that'd have to be tested.
 

HypoTurtle

Senior Member
May 5, 2011
1,991
1,277
0
Victory!
I took sdbags's stock zip (4.3) and extracted it on my computer. I used unmkbootimg to extract the initramfs.gz and kernel.gz from the boot.img in the ROM. I unzipped the initramfs and un-cpio'd it, then modified macallan.fstab to refer to /dev/block/mmcblk1p1 for /data, p2 for /system, and p3 for /cache. I also modified init.macallan.rc to avoid having it try to make filesystems on the EMMC -- I want it not to try touching the EMMC at all.
Next I rebuilt the initramfs.gz. I bought a good quality class 10 microsd and partitioned it on my computer with 3 primary partitions, one for /data, one for /system, and one for /cache (about 2GB and 1GB for /system and /cache). I made ext4 filesystems on all 3 partitions, mounted p2, and copied the rom over and installed it by hand using the updater-script as a guide. Then I unmounted and popped the SD card into my TF701t.
To boot it, I put my tablet into fastboot mode. I booted the kernel and ramdisk using 'fastboot boot' -- no need for kexec from recovery. I can do this without any reliance whatsoever on the internal EMMC. It took awhile to boot up, but it booted first try. The app drawer was a bit slow to come up, but I'm pretty happy I get to use my tablet at all! This whole process turned out to be MUCH easier than I expected it would be, and I'm quite confident I could do this to boot any ROM I wanted. I only use stock because of driver issues with my bluetooth keyboard.
Still willing to try my hand at maintaining cromi's ROM2SD branch though :)
Thanks everyone for all of your help!
If that's all that's required then my script should do it, with a few changes, (and allow for more then 1 rom). In my sig. It was written for the HD2 but kept as generic as possible, all I think needs changing is mmcblk0p* to mmcblk1p* and yaffs to EMMC. (a cache partition isn't used atm but could be added in), feel free to PM.
 

lexelby

Senior Member
Jan 6, 2012
94
81
0
I did a bunch of research into the sd card thing when I was dual booting the Nook Color and Nook Tablet a while ago. The Sandisk class 4 cards were the best. I used Crystal Diskmark to look at the 4k random r/w speeds. Slow cards definitely will impact system performance. (New, fast cards transfer large blocks of data quickly, but small blocks sometimes really slowly.) I'll look around for old benchmarks from good cards for comparison...

EDIT: Can't find any. Grrr. I think the 4k random reads were usually no problem, but the writes sometimes were so slow that the os lagged. Iirc, above 1MB/s was fine. Below that might cause problems. It's been a while, though!
Interesting! I have a class 4 card, but it'd be a bit of a pain to swap it in... maybe a project for a rainy day.

(also @aromerblz)
On the Galaxy S3 I747, it's a FAT filesystem with about a dozen individual files inside. I'd imagine most Samsung devices are similar. You could definitely reassign that partition to another block/loop device if you wanted. I can't promise that the firmware would get loaded into the modem properly though, that'd have to be tested.
Oh! In that case, yeah, I imagine this technique could work. If it's just loading the firmware off of a mounted partition, it's not going to care what's mounted there, so long as it has the firmware.

If that's all that's required then my script should do it, with a few changes, (and allow for more then 1 rom). In my sig. It was written for the HD2 but kept as generic as possible, all I think needs changing is mmcblk0p* to mmcblk1p* and yaffs to EMMC. (a cache partition isn't used atm but could be added in), feel free to PM.
Ooh, neat! I see that it automatically patches an initrd with a more advanced technique than I was using. I like how you replaced init with your own shell script so that you could hook into the boot process as soon as possible. Cool stuff.