grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: pvgrub2 and old grub menu.lst


From: Michael Chang
Subject: Re: pvgrub2 and old grub menu.lst
Date: Wed, 2 Apr 2014 16:43:30 +0800
User-agent: Mutt/1.5.21 (2010-09-15)

On Tue, Apr 01, 2014 at 08:06:44PM +0400, Andrey Borzenkov wrote:
> В Tue, 1 Apr 2014 15:46:22 +0800
> Michael Chang <address@hidden> пишет:
> 
> > While trying to boot xen pv guest with old grub config (menu.lst),
> > the pvgrub2 loads it's menu successfully, but when you attemp to boot
> > the kernel it failed with the following message. 
> > 
> >   error: couldn't load file /boot/vmlinuz-3.0.76-0.11-xen.
> >   error: you need to load the kernel first.
> > 
> >   Press any key to continue..."
> > 
> > The kernel is there and boots fine with pygrub.
> > 
> > After some investigation, it boils down to the menu.lst has explicitly
> > set it's root device to (hd0,1) and therefore the root device is not
> > recognized by pvgrub2.
> > 
> > title Xen -- SUSE Linux Enterprise Server 11 SP3 - 3.0.76-0.11
> >   root (hd0,1)
> >   kernel /boot/vmlinuz-3.0.76-0.11-xen root=/dev/xvda2 resume=/dev/xvda1
> > splash=silent showopts initrd /boot/initrd-3.0.76-0.11.xen
> > 
> > I'd like to know whether old grub configuration is considered or planned
> > to work with pvgrub2 ? And is it a viable suggestion to have (hdX,Y) a
> > valid xen disk name because it's quite common in some existing configs ?
> > 
> 
> I believe this technically should work; but this needs someone who
> knows how Xen disks is mapped to hd number in legacy grub.
> 
> It would be something like (completely untested)

Thank you for the patch. I applied it and tried to test it. The
virtdisks[i].handle never matched with num as it's id of the disk (on
my system it is 51712).

Please pardon my ignorant, can num be the index to the virtdisks array
to get the mapped xen disk ?

Thanks,
Michael

> 
> From: Andrey Borzenkov <address@hidden>
> Subject: [PATCH] accept also hdX as alias to native Xen disk name
> 
> This allows reusing legacy pvgrub menu.lst which is using hdX names.
> 
> Suggested-By: Michael Chang <address@hidden>
> 
> ---
>  grub-core/disk/xen/xendisk.c | 13 ++++++++++++-
>  1 file changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/grub-core/disk/xen/xendisk.c b/grub-core/disk/xen/xendisk.c
> index 2b11c2a..c6c8ecc 100644
> --- a/grub-core/disk/xen/xendisk.c
> +++ b/grub-core/disk/xen/xendisk.c
> @@ -70,9 +70,20 @@ grub_virtdisk_open (const char *name, grub_disk_t disk)
>    grub_uint32_t secsize;
>    char fdir[200];
>    char *buf;
> +  int num = -1;
>  
> +  if (name[0] == 'h' && name[1] == 'd')
> +    {
> +      num = grub_strtoul (hd+2, 0, 10);
> +      if (grub_errno)
> +     {
> +       grub_errno = 0;
> +       num = -1;
> +     }
> +    }
>    for (i = 0; i < vdiskcnt; i++)
> -    if (grub_strcmp (name, virtdisks[i].fullname) == 0)
> +    if ((num != -1 && virtdisks[i].handle == num) ||
> +      grub_strcmp (name, virtdisks[i].fullname) == 0)
>        break;
>    if (i == vdiskcnt)
>      return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "not a virtdisk");
> -- 
> tg: (4afd010..) e/xen/hdX-compat (depends on: master)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]