gpt_write: add flag to preserve hybrid

When updating the GPT to match the underlying block device, the
protective MBR will normally also be updated. In case a hybrid MBR is
used, as is done if 'image/disk' is specified, setting the
'preserve_hybrid' flag will prevent the component from overriding the
MBR.
This commit is contained in:
Josef Söntgen 2018-06-04 11:13:33 +02:00 committed by Christian Helmuth
parent 7367ec2f1a
commit 268b8205a1
2 changed files with 7 additions and 1 deletions

View File

@ -71,6 +71,10 @@ useable space of the GPT:
! <config update_geometry="yes"/>
When updating the geometry, setting the 'preserve_hybrid' attribute to 'yes'
will prevent the component from overriding a hybrid MBR with a proper
protective MBR.
Setting the 'initialize' attribute will instruct the component to clear
any existing GPT/PMBR.

View File

@ -53,6 +53,7 @@ struct Gpt::Writer
/* flags */
bool _verbose { false };
bool _update_geometry { false };
bool _preserve_hybrid { false };
bool _initialize { false };
bool _wipe { false };
bool _force_alignment { false };
@ -68,6 +69,7 @@ struct Gpt::Writer
_wipe = config.attribute_value("wipe", false);
_force_alignment = config.attribute_value("force_align", false);
_update_geometry = config.attribute_value("update_geometry", false);
_preserve_hybrid = config.attribute_value("preserve_hybrid", false);
{
Util::Size_string align =
@ -362,7 +364,7 @@ struct Gpt::Writer
{
if (_pgpt.backup_lba == _block_count - 1) { return; }
_setup_pmbr();
if (!_preserve_hybrid) { _setup_pmbr(); }
_old_backup_hdr_lba = _pgpt.backup_lba;