From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: M A Young <m.a.young@durham.ac.uk>,
Ian Campbell <Ian.Campbell@eu.citrix.com>
Cc: xen-devel@lists.xensource.com
Subject: Re: [PATCH] Improve GPT support in pygrub
Date: Mon, 17 Oct 2011 13:03:27 -0400 [thread overview]
Message-ID: <20111017170327.GC19756@phenom.dumpdata.com> (raw)
In-Reply-To: <alpine.DEB.2.00.1110162117190.27361@vega-c.dur.ac.uk>
On Sun, Oct 16, 2011 at 09:45:00PM +0100, M A Young wrote:
> This patch is part of a fix I applied to Fedora 16 to get pygrub to
> boot a Fedora 16 guest (see
> https://bugzilla.redhat.com/show_bug.cgi?id=745335 ). By default
> Fedora 16 installs a Bios boot partition as the first GPT partition
> to contain grub2 boot code, and the grub2 configuration files are in
> the GPT second partition. Pygrub currently only checks the first
> partition, so the attached patch tells it to check all the GPT
> partitions for grub configuration.
>
> Michael Young
> Check all GPT partitions for grub configuration, not just the first
> Signed-off-by: Michael Young <m.a.young@durham.ac.uk>
Tested-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
>
> --- a/tools/pygrub/src/pygrub 2011-10-16 20:58:02.000000000 +0100
> +++ b/tools/pygrub/src/pygrub 2011-10-16 20:59:52.000000000 +0100
> @@ -78,9 +78,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 +122,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-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel
next prev parent reply other threads:[~2011-10-17 17:03 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-16 20:45 [PATCH] Improve GPT support in pygrub M A Young
2011-10-17 17:03 ` Konrad Rzeszutek Wilk [this message]
2011-10-19 7:07 ` Paolo Bonzini
2011-10-19 7:31 ` M A Young
2011-10-19 7:36 ` Ian Campbell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20111017170327.GC19756@phenom.dumpdata.com \
--to=konrad.wilk@oracle.com \
--cc=Ian.Campbell@eu.citrix.com \
--cc=m.a.young@durham.ac.uk \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.