How to modify the Android boot sequence in order to boot from an SD Card?

17,485

I don't really know of a standard way of booting from an SD card, how easy it is or isn't depends mostly on what Android device you are using:

For example if you have a Nexus device you can just download MultiROM from the Play store and you're good to go. It's never normally that simple; I currently am trying to get my Mediatek MT6575 based device to boot from SD card as the internal eMMC memory is dead, and have not managed it yet, so I guess right now it's 'bricked'.


What I'm trying to say here is that there is no step-by-step guide that will work with all devices as there large range of devices, each with different partition layouts, kernels, etc.

I'll provide some examples on how to boot from SD for a few different devices, and hopefully you'll be able to see whats involved, also if you say what device you have I may have come across a working method for that device.

Boot Android from SdCard wiki - This is on a site for 'sunxi' android tablets, but the info is helpful as it contains info on editing the recovery and boot partitions, even if the SD card images will only work on sunxi tablets.

Use SD instead of eMMC on GS3 - Gives step by step on how to partitions the SD card and editing boot.img. I've tried this method on my MT6575 but just changing info on the fstab wasn't enough, it was still trying to boot from eMMC for my device but if you have a GS3 this is ideal.

Multiboot for MediaTek devices - How to have 1 rom on internal eMMC and a 2nd rom on the SD card. Gives a rough step by step, may work if you have a mediatek device.

Convert ROM to boot from SD card - Written with a Nokia X2 in mind, but I'm going thru this method right now, mounts both system partitions at once, mount point for SD system partition is /system-ext

That's all I have for now, if you manage to boot from SD could you please post a comment saying what method you used and what device you used, thanks. :)

Share:
17,485

Related videos on Youtube

Keychain1
Author by

Keychain1

Updated on September 18, 2022

Comments

  • Keychain1
    Keychain1 over 1 year

    I've been looking into how to boot Android form an SD card. This is the post with the instructions:

    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!

    Then there was more elaboration here:

    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.

    I don't quite understand, and I was hoping for some elaboration as this seems to deal with similar things to the Linux OS (inramfs.gz, kernel.gz, and the bootup process in general.

  • phk
    phk almost 8 years
    Why no direct links to those xda-developers pages?
  • Jakob Bennemann
    Jakob Bennemann almost 8 years
    Normally, link-only answers are not ideal, but you have explained the motivations for your links very well (that there is no general procedure, and that your links are just examples for various kinds of hardware). I have inlined your links.
  • HypnoToad
    HypnoToad almost 8 years
    Thanks for editing the links in. If I ever get my device to boot from SD then I'll post a follow up on how I managed it, with a step-by-step method, as that would be better than a link.