From 25b20b420cb9b8a93bc86eb9f1b5b601c67859ed Mon Sep 17 00:00:00 2001 From: Michael Marineau Date: Sat, 30 Aug 2014 16:26:26 -0700 Subject: [PATCH] disk_util: support exposing a hybrid partition without syslinux We don't need to do anything like manually install the MBR boot code for grub but we do need to continue to expose the ESP partition as a hybrid partition to support pvgrub. --- build_library/disk_util | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/build_library/disk_util b/build_library/disk_util index 6f51e3989e..995e3fd67a 100755 --- a/build_library/disk_util +++ b/build_library/disk_util @@ -281,7 +281,8 @@ def WritePartitionTable(options, config=None, partitions=None): image_fd.truncate(config['metadata']['bytes']) Cgpt('repair', options.disk_image) - syslinux = None + syslinux = False + hybrid = None for partition in partitions.itervalues(): if partition['type'] != 'blank': Cgpt('add', '-i', partition['num'], @@ -293,13 +294,16 @@ def WritePartitionTable(options, config=None, partitions=None): options.disk_image) features = partition.get('features', []) - if not syslinux and 'syslinux' in features: - syslinux = partition['num'] + if not hybrid and ('syslinux' in features or 'hybrid' in features): + hybrid = partition['num'] + if 'syslinux' in features: + syslinux = True + + if hybrid: + # Enable legacy boot flag and generate a hybrid MBR partition table + Cgpt('add', '-i', hybrid, '-B1', options.disk_image) if syslinux and options.mbr_boot_code: - # Enable legacy boot flag and generate a hybrid MBR partition table - Cgpt('add', '-i', syslinux, '-B1', options.disk_image) - try: with open(options.mbr_boot_code, 'r') as mbr_fd: mbr_code = mbr_fd.read()