With this post I would like to show the results of the my work about the partition table of our device. As you will see there are a lot of useful informations for future ROM developing and for understanding how Huawei DEVS built their ROMs.
All the things you will see, you can do it by yourself in order to check if I am right or if I am missing something.
I actually also need to give credits to some guys from http://www.androidiani.com as they helped me in checking the work and encourage me in doing this.
Internal SDCARD / eMMC
This is the output of the
fdisk command if you run it in your terminal:
# fdisk -l /dev/block/mmcblk0 Disk /dev/block/mmcblk0: 7952 MB, 7952400384 bytes 256 heads, 63 sectors/track, 963 cylinders Units = cylinders of 16128 * 512 = 8257536 bytes Device Boot Start End Blocks Id System /dev/block/mmcblk0p1 1 947 7634943+ ee EFI GPT Partition 1 has different physical/logical beginnings (non-Linux?): phys=(1023, 255, 63) logical=(0, 0, 2) Partition 1 has different physical/logical endings: phys=(1023, 255, 63) logical=(946, 203, 11)
As you can see is not very useful this first command. So I decided to go a bit deeper with a high-end binary, that you can run if you download it from here and you copy it in
#parted /dev/block/mmcblk0 print Error: The backup GPT table is not at the end of the disk, as it should be. This might mean that another operating system believes the disk is smaller. Fix, by moving the backup to the end (and removing the old backup)? Fix/Ignore/Cancel? I I Warning: Not all of the space available to /dev/block/mmcblk0 appears to be used, you can fix the GPT to use all of the space (an extra 262111 blocks) or continue with the current setting? Fix/Ignore? I I Model: MMC 008G4B (sd/mmc) Disk /dev/block/mmcblk0: 7952MB Sector size (logical/physical): 512B/512B Partition Table: gpt Number Start End Size File system Name Flags 1 131kB 393kB 262kB xloader 2 393kB 4194kB 3801kB round 3 4194kB 8389kB 4194kB nvme 4 8389kB 12.6MB 4194kB misc 5 12.6MB 21.0MB 8389kB splash 6 21.0MB 54.5MB 33.6MB oeminfo 7 54.5MB 62.9MB 8389kB reserved1 8 62.9MB 71.3MB 8389kB ext4 reserved2 9 71.3MB 79.7MB 8389kB recovery2 10 79.7MB 88.1MB 8389kB recovery 11 88.1MB 96.5MB 8389kB boot 12 96.5MB 130MB 33.6MB ext4 modemimage 13 130MB 138MB 8389kB ext4 modemnvm1 14 138MB 147MB 8389kB ext4 modemnvm2 15 147MB 1086MB 940MB ext4 system 16 1086MB 1355MB 268MB ext4 cache 17 1355MB 1892MB 537MB ext4 cust 18 1892MB 7818MB 5927MB ext4 userdata
This command shows a lot of useful information, that we will process step-by-step.
Let’s just start with the firsts 17kB, where we can find the GPT of the filesystem.
We can find exactly this infos:
- LBA0: Master Boot Record
- LBA1: Partition Header. It should contain a sort of checksum verified by the bootloader.
- LBA2: Partition 1 to 4 infos.
- LBA3: Partition 5 to 128 infos.
|Start [B]||End [B]||Size [B]||Content|
After this first 17kB we expect the first partition, but …. Surprise!!! We have 111kB of something unknown…
As we saw before we also need to underline another weird feature of our partition table; after all the partitions we still have 134MB left free inside the eMMC (or at least we think it’s unused).
Here you can see how it should look like your memory card (if it’s of 16 GB)
# fdisk -l /dev/block/mmcblk1 Disk /dev/block/mmcblk1: 16.0 GB, 16012804096 bytes 255 heads, 63 sectors/track, 1946 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/block/mmcblk1p1 1 1947 15633408 c Win95 FAT32 (LBA)