7190711 ultra20 hangs while trying to load GRUB from USB when booting s11u1_15 or later S11U1Build24
authorMary Ding <mary.ding@oracle.com>
Thu, 23 Aug 2012 14:23:37 -0700
changeset 1769 36ef49b30618
parent 1768 b1640ab6e595
child 1770 e8f6a5ba743a
7190711 ultra20 hangs while trying to load GRUB from USB when booting s11u1_15 or later
usr/src/cmd/install-tools/usbcopy
usr/src/lib/install_boot/boot.py
--- a/usr/src/cmd/install-tools/usbcopy	Thu Aug 23 11:38:47 2012 -0700
+++ b/usr/src/cmd/install-tools/usbcopy	Thu Aug 23 14:23:37 2012 -0700
@@ -96,7 +96,7 @@
     # 191  0      0     0     0    0     0     0    (a)+(b):(c)   diskblocks-(c)
     solstart=$(($mbrnblocks + $uefinblocks))
     solnblocks=$(($devblocks - $solstart))
-    addsolpart="191:0:0:0:0:0:0:0:$solstart:$solnblocks"
+    addsolpart="191:128:0:0:0:0:0:0:$solstart:$solnblocks"
     fdisk -A $addsolpart $dev
 
     # fdisk is stupid and overwrites the MBR boot code region with mboot so we
@@ -189,6 +189,8 @@
 bdev=${dev/rdsk/dsk}
 s0cdev=${dev/p0/s0}
 s0bdev=${s0cdev/rdsk/dsk}
+p2cdev=${dev/p0/p2}
+p2bdev=${p2cdev/rdsk/dsk}
 mountdev=${s0bdev/s0}
 if [ ! -b $s0bdev ] || [ ! -c $s0cdev ]; then
 	echo "Missing device nodes for $dev"
@@ -280,6 +282,11 @@
     error_handler "Failed to find boot loader configuration"
 fi
 
+# Remove the PBR from the Solaris partition to ensure no stray data confuses
+# some BIOSes
+dd if=/dev/zero of=${p2bdev} count=1 > /dev/null 2>&1
+[[ $? -ne 0 ]] && { echo Failed to zero Solaris PBR on USB device. ; exit 1; }
+ 
 # Now create root partition.  We want to find number of cylinders in backup
 # partition from label created by fdisk and then generate root partition
 # using whole disk minus cylinder 1
--- a/usr/src/lib/install_boot/boot.py	Thu Aug 23 11:38:47 2012 -0700
+++ b/usr/src/lib/install_boot/boot.py	Thu Aug 23 14:23:37 2012 -0700
@@ -1067,13 +1067,16 @@
                 # Layout:
                 # - 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.
+                # The Solaris partition will be marked active when usbcopy
+                # writes the usb image to disk, 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,
+                # and marking the EFI system partition active causes other
+                # BIOSes to think the USB drive is a floppy/ZIP drive.
                 esptype = Partition.name_to_num("EFI System")
                 startblock = MB / BLOCKSIZE
                 uefi_image_nblocks = uefi_image_size / BLOCKSIZE
-                fdiskentry = "%d:128:0:0:0:0:0:0:%d:%d" \
+                fdiskentry = "%d:0: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)