An Android phone contains a few basic partitions along with other supporting partitions. This knowledge is vital to understanding how and where code is flashed to devices.
On our test device—Samsung Galaxy Nexus (or emulator)—we can view these partitions with the following command executed inside an adb shell. To obtain a shell on the device, you should connect the device via USB and you should make sure that the USB Debugging option is enabled (located at Settings | Developer Options).
Finally, to actually obtain a shell, while the device is connected, fire up a terminal and type in adb shell
and press Enter.
shell@android:/ $ ls -l /dev/block/platform/omap/omap_hsmmc.0/by-name lrwxrwxrwx root root 2012-06-28 22:03 boot -> /dev/block/mmcblk0p7 lrwxrwxrwx root root 2012-06-28 22:03 cache -> /dev/block/mmcblk0p11 lrwxrwxrwx root root 2012-06-28 22:03 dgs -> /dev/block/mmcblk0p6 lrwxrwxrwx root root 2012-06-28 22:03 efs -> /dev/block/mmcblk0p3 lrwxrwxrwx root root 2012-06-28 22:03 metadata -> /dev/block/mmcblk0p13 lrwxrwxrwx root root 2012-06-28 22:03 misc -> /dev/block/mmcblk0p5 lrwxrwxrwx root root 2012-06-28 22:03 param -> /dev/block/mmcblk0p4 lrwxrwxrwx root root 2012-06-28 22:03 radio -> /dev/block/mmcblk0p9 lrwxrwxrwx root root 2012-06-28 22:03 recovery -> /dev/block/mmcblk0p8 lrwxrwxrwx root root 2012-06-28 22:03 sbl -> /dev/block/mmcblk0p2 lrwxrwxrwx root root 2012-06-28 22:03 system -> /dev/block/mmcblk0p10 lrwxrwxrwx root root 2012-06-28 22:03 userdata -> /dev/block/mmcblk0p12 lrwxrwxrwx root root 2012-06-28 22:03 xloader -> /dev/block/mmcblk0p1
mtd
proc file:cat /proc/mtd
The output looks similar to the following:
dev: size erasesize name mtd0: 00200000 00040000 "bootloader" mtd1: 00140000 00040000 "misc" mtd2: 00800000 00040000 "boot" mtd3: 00800000 00040000 "recovery" mtd4: 1d580000 00040000 "cache" mtd5: 00d80000 00040000 "radio" mtd6: 006c0000 00040000 "efs"
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"
The main thing to notice here is the existence of a few common partitions which are important to flashing new software. The following are major partitions on most Android devices:
/boot
: This contains the kernel image and the associated RAM disk. This is executed by the bootloader during the startup process. Any newly built kernel is written to this partition. The phone will not boot if this partition is empty./system
: This contains the Android framework and the related system applications. During system operation, this is mounted as read-only so that critical system files are never modified./recovery
: Is an alternative boot partition used to boot the device into recovery mode. The recovery code is located at ANDROID_SRC/bootable/recovery
. There are many custom recovery firmware images available. A notable example is ClockWorkMod
.The three partitions just mentioned are the ones involved in flashing a new build of Android on to a device. In addition to these, there are a few other partitions that exist:
/data
: This contains user data and is sometimes called the user-data partition. All user-installed applications, settings, and personal data are stored in this partition./cache
: Will contain frequently accessed applications./sdcard
: This is the SD card attached to the phone. It is not a partition on the internal device memory.13.58.252.8