Matt's Droid FAQ

Last Updated:

  1. fizgig

    fizgig Active Member This Topic's Starter

    Dec 12, 2009
    Likes Received:
    Matt's Droid Info

    I've seen tutorials that just walk you through the steps of how to root or how to flash but they mostly don't explain much leaving you (or me) very confused as to what's going on under the surface. I'm going to maintain a post that explains things a bit better I hope as a learning experience for me (as I'm sure I'll get some stuff wrong and get corrected) and I hope others can benefit from it.

    Rooting your phone appears to allow the user to change files that a non-rooted phone wont let you have access to. You can then install things such as new ROMs that allow you to run your droid at a faster speed, have more features like live wallpaper and so on. A nice guide that explains how to root that worked for me was Obtaining Root | Root Your Droid

    The small file in the guide linked to above has two folders in it. You don't need to look into it but I wanted to know what was going on.

    The two folders are:
    (1) META-INF
    (2) system

    The META-INF has a text script and a binary script. Not sure why two scripts are needed but text file script (updater-script) seems pretty straightforward as it seems to do the following (feel free to open the file yourself in wordpad in windows or something that understands unix end-of-line characters):

    1. Mount your droids filesystem (I think this is required to make it writable)
    2. Copy the file to /system/bin/su
    3. Copy the file to /system/app/Superuser.apk
    4. Change permissions of both files.
    5. Unmount the filesystem.

    I guess this explains why there is a superuser program in your menu after you reboot.

    Speaking of the superuser program, that appears to be a program that monitors which programs have been given superuser priveledges by you. After rooting, when you run the program, it will have a blank screen since you haven't granted permissions to any programs yet that want it (such as /system/bin/sh or the tether program). When you do start granting permission to programs, you'll see them in the superuser program. You can take away permission by clicking on it in the superuser program which would require the program to ask for permission the next time it's run.

    * Post Root *

    Ok. So you've rooted your phone and all you've gotten is a superuser program that does nothing interesting... The next step is to install some utilities that allow you to move around a little easier.

    I followed this guide ( to install a ROM but it includes the steps I'm talking about. I want to explain/understand them better.

    The link walks through what to do after you install droid root helper from the marketplace. I don't see it there anymore but I do see it on google all over the place so you can download it with your computer, mount your phone, copy it to your phone and use astro browser to see it and click on it to start the package installer. You'll have to check "Unknown Sources" under settings->applications on your phone to install this way since it wouldn't be coming directly from the market. The good news is that you don't really need it as you can do all the steps manually which I think is a better idea.

    In the droid root helper, there's a button for getting the tools. This simply gets you to download a file to your card using the browser. This file contains busybox which is a program that gives you more commands you can run in a terminal. For example, android doesn't ship with the ability to read a file with the "more" command which lets you read it a page at a time. With busybox installed you could type "busybox more filename" and it would be just like you had typed "more filename" on a larger linux installation.

    You can install busybox just fine without a tool. You can download busybox compiled for android and use adb (a tool provided by google that allows you to use your computer to do things to your droid such as move files to and from, install packages and actually start a shell session on the droid.) Do a google search for "busybox android" and the first link will probably be busybox compiled for android with instructions for copying it to the droid. I let droid root helper do it for me back when I didn't know what was going on. I'd probably do it manually if I was to do it again. Also part of the process is to make it executable after you copy it to the droid (if you use droid root helper, it does that for you.) This post has some good manual documentation to install busybox:

    The next thing those instructions ask you to do is to install "flash_image". I believe that's a program that actually allows you to change the recovery program - that's what is run when you hold down "x" when you reboot - a kind of bootstrap recovery console stored on a special recovery partition that allows you to install a ROM image or run nandroid. We flash the image on the droid that changes the recovery program to not check any files for correct signatures (so we can install custom Roms and hacks), allow running of ADB as root and finally has nandroid so you can backup and restore your phone. Anyhow, you can't run flash_image from the memory card, you have to mount your file system as read/write (next paragraph) and move flash_image over and make it executable using chmod (chmod 755 /system/bin/flash_image). The image file can be on the memory card as you write it to the system files but the writer program (flash_image) must be on the droid (/system/bin). The recovery images are made by a guy named SirPscho and you can get the latest flashes here: It also tells you how to manually install it. You can use "terminal emulator" on your droid or adb shell on your computer.

    Note that at some points you'll be typing commands like this: "mount -o remount,rw -t yaffs2 /dev/block/mtdblock4 /system" or this: "mount -o remount,r -t yaffs2 /dev/block/mtdblock4 /system". Note the small difference between the two. The first is used to make the /system folder writable. The second gets it back into its default read-only mode. After making your filesystem read-only with the second command, you should run the "sync" command - not sure what it does though.

    There's a step where you're supposed to rename a file: "mv /system/recovery-from-boot.p /system/recovery-from-boot.p.old". That's because every time you boot the droid it will overwrite the recovery program with /system/recovery-from-boot.p. Since recovery-from-boot.p is the standard recovery console, you'd be back to where you started with the stock recovery console. Renaming it prevents that from happening.

    Let's talk about nandroid for a minute. It appears to be a part of the recovery console. You can boot into the recovery console after you flashed it to your droid as mentioned above. You'll have the ability to run nandroid and do a restore or backup. The advanced backup allows you to checkmark what you want to back up. I'm not clear as to why you'd want to or not want to select each option so I just select them all. I then change the name to something that makes sense to me and get it going. It saves to a folder on your sdcard called /sdcard/nandroid. It probably would be a wise move to then copy that backup to your computer for safe keeping. I did so and looked inside. Here's what I saw:

    nandroid.md5 : A file used to make sure your backup isn't corrupted I guess
    cache.tar : Not sure
    data.tar : About 150 megs and includes a bunch of sub folders including "system", "app", "data".
    system.tar : About 100 megs and includes a bunch of sub folders as well. There is a "media" subfolder that contains "" That has a bunch of pics of the booting animation in it.

    Well, after digging a little, I found that there are actually several mounted file systems. You can see them by typing the command "cat /proc/mtd" in a shell (adb shell for me). MTD stands for "Memory Technology Devices" which I guess means a memory block device that you can mount just like a hard drive block device. I get the following on my droid from the cat /proc/mtd command:

    mtd0: "pds"
    mtd1: "misc"
    mtd2: "boot"
    mtd3: "recovery"
    mtd4: "system"
    mtd5: "cache"
    mtd6: "userdata"
    mtd7: "kpanic"

    Notice that the images nandroid backs up match the devices (boot, misc and recovery). For whatever reason, nandroid appears to use tar files to backup cache, data and system. Note also that "system" in that list is the same "system" that you keep mounting read-write and the read-only as you do modifications. You can backup any of these by typing "cat /dev/mtd/mtd1 > /sdcard/mtd1.img" or whatever mtd number you want. Mtd3 (recovery) is reflashed at boot time with /system/recovery-from-boot.p.

    I wonder if you can modify the files, push this back to your sdcard and then do a restore to have it placed into your phone. I did see a post where those that want to install ROM after ROM and are tired of constantly getting their home screens and icons back to the way they were can install a new rom and then do a nandroid advanced restore of just the "data" from the last backup. There was a caveat that this doesn't always work as the data from one ROM might cause a conflict with another ROM. If that happens, you can just say screw-it and restore the entire backup and be back to where you were before you installed the new ROM - no harm done.

    Nandroid does have a webpage. Check it out here: the readme file at the top has lots of useful info.

    ----------more to come

    goodle, UBRocked, NeuroNY and 2 others like this.
  2. johnlgalt

    johnlgalt Antidisestablishmentarian VIP Member

    Oct 28, 2009
    Likes Received:
    Excellent idea - delving into the guts of the phone so we get a better understanding of what goes where an, more importantly, why it goes where it goes.

    Gonna give you thanks now in advance - and maybe I'll even be able to hep out here and there (doubt it - this stuff is still too new to me)....
  3. alostpacket

    alostpacket Over Macho Grande? VIP Member

    Nov 29, 2009
    Likes Received:
    Nice, I've been wondering about a lot of this stuff as someone who knows more than how to just follow instructions I wasn't sure where to learn some of this, or some of the linux stuff.

    Cheers fizgig

Share This Page