aboutsummaryrefslogtreecommitdiffstats
path: root/tools/pygrub
diff options
context:
space:
mode:
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>2007-04-11 15:27:14 +0100
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>2007-04-11 15:27:14 +0100
commita6954d648bf6bb02ab5061f47392dd703a7261fc (patch)
tree710b99ba602b6cc7fcbbbb84dfb73c828007c426 /tools/pygrub
parent94ffc9e546aec100daf42ee7078b626f7c2316e1 (diff)
downloadxen-a6954d648bf6bb02ab5061f47392dd703a7261fc.tar.gz
xen-a6954d648bf6bb02ab5061f47392dd703a7261fc.tar.bz2
xen-a6954d648bf6bb02ab5061f47392dd703a7261fc.zip
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>
Diffstat (limited to 'tools/pygrub')
-rw-r--r--tools/pygrub/src/pygrub7
1 files changed, 7 insertions, 0 deletions
diff --git a/tools/pygrub/src/pygrub b/tools/pygrub/src/pygrub
index 8f4e3473f7..99c2debd40 100644
--- a/tools/pygrub/src/pygrub
+++ b/tools/pygrub/src/pygrub
@@ -59,6 +59,13 @@ def get_active_partition(file):
if struct.unpack("<c", buf[poff:poff+1]) == ('\x80',):
return buf[poff:poff+16]
+ # type=0xee: GUID partition table
+ # XXX assume the first partition is active
+ if struct.unpack("<c", buf[poff+4:poff+5]) == ('\xee',):
+ os.lseek(fd, 0x400, 0)
+ buf = os.read(fd, 512)
+ return buf[24:40] # XXX buf[32:40]
+
# if there's not a partition marked as active, fall back to
# the first partition
return buf[446:446+16]