User Tools

Site Tools


doc:appunti:hardware:android_partitions

This is an old revision of the document!


Android Partitions on MTK Devices

NAND Flash vs eMMC Flash

NAND flash can only be read in pages, some bits in a page may be wrong and need to be corrected by an error correction mechanism. With NAND flash the OS and device drivers are responsible to handle these issues.

eMMC Flash combines NAND memory with a built-in controller, that handles most of the things you have to take care of when dealing with NAND flash.

EMMC Regions

EMMC_BOOT_1 and EMMC_USER

Inspecting partitions on the command line

The following commands were executed on a ZTE Blade A610, running Android 6.0, via the adb shell command line. The phone was rooted so that the su command was available.

cat /proc/partitions

cat /proc/partitions
major minor  #blocks  name

   7        0      12910 loop0
 254        0     986264 zram0
 179        0   15388672 mmcblk0
 179        1       3072 mmcblk0p1
 179        2       5120 mmcblk0p2
 179        3      10240 mmcblk0p3
 179        4      10240 mmcblk0p4
 179        5        512 mmcblk0p5
 179        6        512 mmcblk0p6
 179        7      16384 mmcblk0p7
 179        8      16384 mmcblk0p8
 179        9       8192 mmcblk0p9
 179       10      10240 mmcblk0p10
 179       11        512 mmcblk0p11
 179       12       2048 mmcblk0p12
 179       13       6144 mmcblk0p13
 179       14       8192 mmcblk0p14
 179       15       5120 mmcblk0p15
 179       16       5120 mmcblk0p16
 179       17       1024 mmcblk0p17
 179       18      32768 mmcblk0p18
 179       19      37888 mmcblk0p19
 179       20    3022848 mmcblk0p20
 179       21     409600 mmcblk0p21
 179       22   11759104 mmcblk0p22
 179       23      16384 mmcblk0p23
 179       96       4096 mmcblk0rpmb
 179       64       4096 mmcblk0boot1
 179       32       4096 mmcblk0boot0
 253        0   11759104 dm-0

sgdisk

The /system/bin/sgdisk command is accessible only with root privileges.

sgdisk --print /dev/block/mmcblk0                                              <
Disk /dev/block/mmcblk0: 30777344 sectors, 14.7 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 00000000-0000-0000-0000-000000000000
Partition table holds up to 23 entries
First usable sector is 1024, last usable sector is 30776319
Partitions will be aligned on 1024-sector boundaries
Total free space is 0 sectors (0 bytes)

Number  Start (sector)    End (sector)  Size       Code  Name
   1            1024            7167   3.0 MiB     0700  proinfo
   2            7168           17407   5.0 MiB     0700  nvram
   3           17408           37887   10.0 MiB    0700  protect1
   4           37888           58367   10.0 MiB    0700  protect2
   5           58368           59391   512.0 KiB   0700  lk
   6           59392           60415   512.0 KiB   0700  para
   7           60416           93183   16.0 MiB    0700  boot
   8           93184          125951   16.0 MiB    0700  recovery
   9          125952          142335   8.0 MiB     0700  logo
  10          142336          162815   10.0 MiB    0700  expdb
  11          162816          163839   512.0 KiB   0700  seccfg
  12          163840          167935   2.0 MiB     0700  oemkeystore
  13          167936          180223   6.0 MiB     0700  secro
  14          180224          196607   8.0 MiB     0700  keystore
  15          196608          206847   5.0 MiB     0700  tee1
  16          206848          217087   5.0 MiB     0700  tee2
  17          217088          219135   1024.0 KiB  0700  frp
  18          219136          284671   32.0 MiB    0700  nvdata
  19          284672          360447   37.0 MiB    0700  metadata
  20          360448         6406143   2.9 GiB     0700  system
  21         6406144         7225343   400.0 MiB   0700  cache
  22         7225344        30743551   11.2 GiB    0700  userdata
  23        30743552        30776319   16.0 MiB    0700  flashinfo

/dev/block/mmcblk0boot0

The partition /dev/block/mmcblk0boot0 is the one referred as region EMMC_BOOT_1 in the scatter file, dedicated to the preloader.

The actual Linux device content starts with the characters EMMC_BOOT. It seems that it is an header of 2048 (0x800) bytes and the actual preloader follows that header. FIXME Some stock ROMs include the preloader image, without that header. But if you readback the preloader partition using SP Flash Tool, you get an image with that heder included.

Web References

doc/appunti/hardware/android_partitions.1579249017.txt.gz · Last modified: 2020/01/17 09:16 by niccolo