diff options
author | Artem Bityutskiy <artem.bityutskiy@intel.com> | 2013-05-16 13:44:02 +0300 |
---|---|---|
committer | Gui Chen <gui.chen@intel.com> | 2013-05-17 01:36:13 -0400 |
commit | 650a192cff243f1a44025a8aea4e4c307d9972bb (patch) | |
tree | 08cc55d03d72b484519b4af5c0c3ef3a9911af9c | |
parent | f8f3b59bf35a68377420673628aaeb943eaddb09 (diff) | |
download | mic-650a192cff243f1a44025a8aea4e4c307d9972bb.tar.gz mic-650a192cff243f1a44025a8aea4e4c307d9972bb.tar.bz2 mic-650a192cff243f1a44025a8aea4e4c307d9972bb.zip |
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>
-rw-r--r-- | mic/utils/gpt_parser.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/mic/utils/gpt_parser.py b/mic/utils/gpt_parser.py index 7ca0a78..5d43b70 100644 --- a/mic/utils/gpt_parser.py +++ b/mic/utils/gpt_parser.py @@ -299,7 +299,9 @@ class GptParser: entry['name'].encode('UTF-16')) # Write the updated entry to the disk - self._write_disk(entry['offs'], raw_entry) + entry_offs = header['ptable_offs'] + \ + header['entry_size'] * entry['index'] + self._write_disk(entry_offs, raw_entry) # Calculate and update partition table CRC32 raw_ptable = self._read_disk(header['ptable_offs'], |