GPT 规范分区表 CRC32 校验和 到底是怎么计算的?

5次阅读

共计 708 个字符,预计需要花费 2 分钟才能阅读完成。

最近想把某路由的 emmc 换成更小的,需要修改下分区表文件。市面肯定没有相关的分区表文件。就琢磨能不能自己能不能修改分区表文件再刷入。

其他都可以搞定了,就是这个 crc32 校验怎么都不对。

Size (in bytes) of each entry in the Partition Entry array – must be a value of 128×2ⁿ where n ≥ 0 (in the past, multiples of 8 were acceptable)

The Partition Entry array can contain unused entries — that is, the GUID value is set to zero. For the purposes of the GPT header, these should be counted when considering the Number of Partition Entries field, and should also be taken into account when calculating the CRC32 of the entire array. There should be no more entries in the array, unused or otherwise, than are indicated by this field.

看上面话的意思,把分区表起始位置中间 128*128 数据以十六进制复制出来,进行 CRC32 计算就可以了。但实际总是不对。我用的 WinHex。

可是 gpt 表头 92 字节的 CRC32 计算就没问题。也是这么操作的。

大家可以提取自己的 gpt 分区表试一试。把前面 34 个扇区保存下来即可。

dd if=/dev/sda of=gpt.img bs=512 count=35

正文完
 0