d48d28a
--- xen-4.1.0/tools/pygrub/src/pygrub.orig	2010-12-31 15:24:11.000000000 +0000
d48d28a
+++ xen-4.1.0/tools/pygrub/src/pygrub	2011-01-30 18:58:17.000000000 +0000
c9994c1
@@ -97,6 +97,7 @@
d48d28a
     fd = os.open(file, os.O_RDONLY)
d48d28a
     buf = os.read(fd, 512)
c9994c1
     os.close(fd)
d48d28a
+    offzerocount = 0
d48d28a
     for poff in (446, 462, 478, 494): # partition offsets
d48d28a
 
d48d28a
         # MBR contains a 16 byte descriptor per partition
d48d28a
@@ -105,6 +106,7 @@
d48d28a
         
d48d28a
         # offset == 0 implies this partition is not enabled
d48d28a
         if offset == 0:
d48d28a
+            offzerocount += 1
d48d28a
             continue
d48d28a
 
d48d28a
         if type == FDISK_PART_SOLARIS or type == FDISK_PART_SOLARIS_OLD:
d48d28a
@@ -123,6 +125,9 @@
d48d28a
         else:
d48d28a
             part_offs.append(offset)
d48d28a
 
d48d28a
+    if offzerocount == 4:
d48d28a
+        # Might be a grub boot sector pretending to be an MBR
d48d28a
+        part_offs.append(0)
d48d28a
     return part_offs
d48d28a
 
d48d28a
 class GrubLineEditor(curses.textpad.Textbox):