ia64/xen-unstable

changeset 14808:ed78f08aad61

pygrub: Support GPT (GUID Partition Table) as used by EFI.
Signed-off-by: Shinya Kuwamura <kuwa@jp.fujitsu.com>
Signed-off-by: Tomohiro Takahashi <takatom@jp.fujitsu.com>
author kfraser@localhost.localdomain
date Wed Apr 11 15:27:14 2007 +0100 (2007-04-11)
parents 83e4261378e7
children 6cd828db1a5d
files tools/pygrub/src/pygrub
line diff
     1.1 --- a/tools/pygrub/src/pygrub	Wed Apr 11 15:17:17 2007 +0100
     1.2 +++ b/tools/pygrub/src/pygrub	Wed Apr 11 15:27:14 2007 +0100
     1.3 @@ -59,6 +59,13 @@ def get_active_partition(file):
     1.4          if struct.unpack("<c", buf[poff:poff+1]) == ('\x80',):
     1.5              return buf[poff:poff+16]
     1.6  
     1.7 +        # type=0xee: GUID partition table
     1.8 +        # XXX assume the first partition is active
     1.9 +        if struct.unpack("<c", buf[poff+4:poff+5]) == ('\xee',):
    1.10 +            os.lseek(fd, 0x400, 0)
    1.11 +            buf = os.read(fd, 512)
    1.12 +            return buf[24:40] # XXX buf[32:40]
    1.13 +
    1.14      # if there's not a partition marked as active, fall back to
    1.15      # the first partition
    1.16      return buf[446:446+16]