WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] Re: [PATCH 1 of 6] pygrub should check all GPT partitions

To: M A Young <m.a.young@xxxxxxxxxxxx>
Subject: [Xen-devel] Re: [PATCH 1 of 6] pygrub should check all GPT partitions
From: Ian Campbell <Ian.Campbell@xxxxxxxxxx>
Date: Thu, 20 Oct 2011 09:25:19 +0100
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Thu, 20 Oct 2011 01:25:53 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <alpine.DEB.2.00.1110200002250.15667@xxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Organization: Citrix Systems, Inc.
References: <alpine.DEB.2.00.1110200002250.15667@xxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
On Thu, 2011-10-20 at 00:03 +0100, M A Young wrote:
> 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.
> Signed-off-by: Michael Young <m.a.young@xxxxxxxxxxxx>
> 
> --- 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.

Is this comment now inaccurate?

> -    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@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel