|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-4.1-testing] pygrub: check all GPT partitions
# HG changeset patch
# User Michael Young <m.a.young@xxxxxxxxxxxx>
# Date 1326215102 0
# Node ID ee80c2ef9400276a8dcff4f1cf58f5dc983ba1ac
# Parent 95a0e0b47e9581fa20f6a7a89471f9ae729a4b56
pygrub: check all GPT partitions
On Fedora 16 the first GPT partition is a boot partition for grub2 with
the grub2 configuration in the second partition.
Check all GPT partitions for grub configuration, not just the first.
[ Also remove now-inaccurate comment. -iwj ]
Signed-off-by: Michael Young <m.a.young@xxxxxxxxxxxx>
Tested-by: Paolo Bonzini <pbonzini@xxxxxxxxxx>
Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Committed-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
xen-unstable changeset: 23998:85d7b207fabc
Backport-requested-by: Pasi Karkkainen <pasik@xxxxxx>
Committed-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
diff -r 95a0e0b47e95 -r ee80c2ef9400 tools/pygrub/src/pygrub
--- a/tools/pygrub/src/pygrub Tue Jan 10 16:10:00 2012 +0000
+++ b/tools/pygrub/src/pygrub Tue Jan 10 17:05:02 2012 +0000
@@ -77,10 +77,17 @@
def get_fs_offset_gpt(file):
fd = os.open(file, os.O_RDONLY)
- # assume the first partition is an EFI system partition.
- os.lseek(fd, SECTOR_SIZE * 2, 0)
+ os.lseek(fd, SECTOR_SIZE, 0)
buf = os.read(fd, 512)
- return struct.unpack("<Q", buf[32:40])[0] * SECTOR_SIZE
+ partcount = struct.unpack("<L", buf[80:84])[0]
+ partsize = struct.unpack("<L", buf[84:88])[0]
+ i = partcount
+ offsets = []
+ while i>0:
+ buf = os.read(fd, partsize)
+ offsets.append(struct.unpack("<Q", buf[32:40])[0] * SECTOR_SIZE)
+ i -= 1
+ return offsets
FDISK_PART_SOLARIS=0xbf
FDISK_PART_SOLARIS_OLD=0x82
@@ -114,7 +121,9 @@
continue # no solaris magic at that offset, ignore partition
if type == FDISK_PART_GPT:
- offset = get_fs_offset_gpt(file)
+ for offset in get_fs_offset_gpt(file):
+ part_offs.append(offset)
+ break
# Active partition has 0x80 as the first byte.
# If active, prepend to front of list, otherwise append to back.
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |