我有一个包含分区表及其 4 个分区的图像(更具体地说是为熟悉 Yocto 框架的人提供的 wic 图像)。它的大小略小于 1GB。
为了将此图像写入 eMMC:
- 我首先通过 TFTP 将它加载到 RAM
=> tftp 0x600000000 <image>.wic
- 然后我将图像从 RAM 写入 eMMC
=> mmc write 0x600000000 0x0 0x1FFFFF
- 图像写入正确,我可以列出 4 个分区。到目前为止,一切都很好。
=> mmc part
Partition Map for MMC device 1 -- Partition Type: EFI
Part Start LBA End LBA Name
Attributes
Type GUID
Partition GUID
1 0x00000800 0x0000681f "boot"
attrs: 0x0000000000000000
type: 0fc63daf-8483-4772-8e79-3d69d8477de4
guid: cd5df8ce-ded3-4cf4-b364-33d7a4b24953
2 0x00006820 0x000139e7 "first"
attrs: 0x0000000000000000
type: 0fc63daf-8483-4772-8e79-3d69d8477de4
guid: 3acc4557-2273-462a-a2bd-d130b3a5745d
3 0x00014000 0x000fefff "second"
attrs: 0x0000000000000000
type: 0fc63daf-8483-4772-8e79-3d69d8477de4
guid: efe25a87-e0ba-401e-8bf6-e81ae29cbc35
4 0x000ff000 0x001e9fff "third"
attrs: 0x0000000000000000
type: 0fc63daf-8483-4772-8e79-3d69d8477de4
guid: 150f9151-7710-42f4-b819-3b3bd506a2bf
现在我想复制 eMMC 中的图像,这样我就得到了 8 个分区,如下所示:
Part Start LBA End LBA Name
Attributes
Type GUID
Partition GUID
1 0x00000800 0x0000681f "boot"
attrs: 0x0000000000000000
type: 0fc63daf-8483-4772-8e79-3d69d8477de4
guid: cd5df8ce-ded3-4cf4-b364-33d7a4b24953
2 0x00006820 0x000139e7 "first"
attrs: 0x0000000000000000
type: 0fc63daf-8483-4772-8e79-3d69d8477de4
guid: 3acc4557-2273-462a-a2bd-d130b3a5745d
3 0x00014000 0x000fefff "second"
attrs: 0x0000000000000000
type: 0fc63daf-8483-4772-8e79-3d69d8477de4
guid: efe25a87-e0ba-401e-8bf6-e81ae29cbc35
4 0x000ff000 0x001e9fff "third"
attrs: 0x0000000000000000
type: 0fc63daf-8483-4772-8e79-3d69d8477de4
guid: 150f9151-7710-42f4-b819-3b3bd506a2bf
5 0x00000800 0x0000681f "boot"
attrs: 0x0000000000000000
type: 0fc63daf-8483-4772-8e79-3d69d8477de4
guid: cd5df8ce-ded3-4cf4-b364-33d7a4b24953
6 0x00006820 0x000139e7 "first"
attrs: 0x0000000000000000
type: 0fc63daf-8483-4772-8e79-3d69d8477de4
guid: 3acc4557-2273-462a-a2bd-d130b3a5745d
7 0x00014000 0x000fefff "second"
attrs: 0x0000000000000000
type: 0fc63daf-8483-4772-8e79-3d69d8477de4
guid: efe25a87-e0ba-401e-8bf6-e81ae29cbc35
8 0x000ff000 0x001e9fff "third"
attrs: 0x0000000000000000
type: 0fc63daf-8483-4772-8e79-3d69d8477de4
guid: 150f9151-7710-42f4-b819-3b3bd506a2bf
所以我用偏移量再次将相同的图像写入 eMMC(不覆盖现有的图像)
=> mmc write 0x600000000 0x200000 0x3FFFFF
MMC write: dev # 1, block # 2097152, count 4194303 ... 4194303 blocks written: OK
但是,我没有得到我期望的 8 个分区,而只有 4 个分区:
=> mmc rescan
=> mmc part
Partition Map for MMC device 1 -- Partition Type: EFI
Part Start LBA End LBA Name
Attributes
Type GUID
Partition GUID
1 0x00000800 0x0000681f "boot"
attrs: 0x0000000000000000
type: 0fc63daf-8483-4772-8e79-3d69d8477de4
guid: cd5df8ce-ded3-4cf4-b364-33d7a4b24953
2 0x00006820 0x000139e7 "first"
attrs: 0x0000000000000000
type: 0fc63daf-8483-4772-8e79-3d69d8477de4
guid: 3acc4557-2273-462a-a2bd-d130b3a5745d
3 0x00014000 0x000fefff "second"
attrs: 0x0000000000000000
type: 0fc63daf-8483-4772-8e79-3d69d8477de4
guid: efe25a87-e0ba-401e-8bf6-e81ae29cbc35
4 0x000ff000 0x001e9fff "third"
attrs: 0x0000000000000000
type: 0fc63daf-8483-4772-8e79-3d69d8477de4
guid: 150f9151-7710-42f4-b819-3b3bd506a2bf