7161544 Workaround for brain dead BIOSes that refuse to boot off USB media
authorNiall Power <niall.power@oracle.com>
Wed, 18 Apr 2012 15:32:17 +1000
changeset 1638 36e83f910204
parent 1637 363448d5d44a
child 1639 a2b2db6d3608
7161544 Workaround for brain dead BIOSes that refuse to boot off USB media
usr/src/lib/install_boot/boot.py
--- a/usr/src/lib/install_boot/boot.py	Wed Apr 18 14:32:29 2012 +1000
+++ b/usr/src/lib/install_boot/boot.py	Wed Apr 18 15:32:17 2012 +1000
@@ -1023,11 +1023,15 @@
                 # target modules because we want precise control over the
                 # geometry, plus it's not well suited to lofi devices.
                 # Layout:
-                # type ESP, at 1M offset, partition size = uefi_image size
+                # - type ESP, active, at 1M offset,
+                # - partition size = uefi_image size
+                # The ESP is marked active, because despite the fact that we
+                # write GRUB to the MBR, some BIOSes are brain dead and won't
+                # boot USB media without an active DOS partition.
                 esptype = Partition.name_to_num("EFI System")
                 startblock = MB / BLOCKSIZE
                 uefi_image_nblocks = uefi_image_size / BLOCKSIZE
-                fdiskentry = "%d:0:0:0:0:0:0:0:%d:%d" \
+                fdiskentry = "%d:128:0:0:0:0:0:0:%d:%d" \
                              % (esptype, startblock, uefi_image_nblocks)
                 self.logger.debug("Creating fdisk table on %s:\n\t%s",
                                   lofi_rdev, fdiskentry)