這裡記錄一下QC的9x40 partition table configure file(common/build/partition_nand.xml)size與實際的大小怎麼換算。 大概就兩類tag,一個tag是size_blks,以eraseblock為單位。另一個是tag是size_kb,所以實際大小還要轉成eraseblock。 如:
/ # cat /proc/mtd dev: size erasesize name mtd0: 00280000 00040000 "sbl" mtd1: 00280000 00040000 "mibib" mtd2: 00c00000 00040000 "efs2" mtd3: 00140000 00040000 "tz" mtd4: 00100000 00040000 "rpm" mtd5: 00140000 00040000 "aboot" ...
partition table configure file內容
<partition>
<name length="16" type="string">0:SBL</name>
<size_blks length="4">0x8</size_blks>
<pad_blks length="4">0x2</pad_blks>
...
</partition>
...
<partition>
<name length="16" type="string">0:EFS2</name>
<size_kb length="4">11264</size_kb>
<pad_kb length="4">1024</pad_kb>
....
</partition>
SBL的設定為0x8+0x2個eraseblock,所以/proc/mtd大小為 (8 + 2) * 256 * 1024 = 0x280000。
EFS2的設定為11264+1024 KB,所以/proc/mtd大小為ceiling(11264 / 256)+ceiling(1024 / 256) = 48個eraseblock,所以/proc/mtd大小為48 * 256 * 1024 = 0xC0000。
eraseblock就是上面的erasesize,0x40000 / 1024 = 256kb。

沒有留言:
張貼留言