gpt_parser: bugfix: correctly update alternate GPT header
authorArtem Bityutskiy <artem.bityutskiy@intel.com>
Thu, 16 May 2013 10:44:02 +0000 (13:44 +0300)
committerGui Chen <gui.chen@intel.com>
Fri, 17 May 2013 05:36:13 +0000 (01:36 -0400)
commit650a192cff243f1a44025a8aea4e4c307d9972bb
tree08cc55d03d72b484519b4af5c0c3ef3a9911af9c
parentf8f3b59bf35a68377420673628aaeb943eaddb09
gpt_parser: bugfix: correctly update alternate GPT header

This patch is a bug-fix which fixes the --part-type option.

The sysmptom of the issue was the following warning from kpartx:

GPT: partition_entry_array_crc32 values don't match: 0xa24d9e34 != 0xc4e77ef0
GPT: Use GNU Parted to correct GPT errors.

The reason of the issue was that we did not update the alternate partition
array. The root-cause is that we cannot rely on the 'offs' element of the
partition entry dictionary because it points to the primary prition array
offset, while we needed the alternate. Instead, we have to calculate the offset
ourselves.

Change-Id: Iec35ebefa28ba8f7a65c414177c909747b6512ed
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
mic/utils/gpt_parser.py