grub-devel.gnu.org archive mirror
 help / color / mirror / Atom feed
From: Andrey Borzenkov <arvidjaar@gmail.com>
To: The development of GNU GRUB <grub-devel@gnu.org>
Cc: mchang@suse.com
Subject: Re: pvgrub2 and old grub menu.lst
Date: Tue, 1 Apr 2014 20:06:44 +0400	[thread overview]
Message-ID: <20140401200644.0fecf331@opensuse.site> (raw)
In-Reply-To: <20140401074548.GB28903@linux-dsax.tai.apac.novell.com>

В Tue, 1 Apr 2014 15:46:22 +0800
Michael Chang <mchang@suse.com> пишет:

> 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)

From: Andrey Borzenkov <arvidjaar@gmail.com>
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 <mchang@suse.com>

---
 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	other threads:[~2014-04-01 16:07 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-01  7:46 pvgrub2 and old grub menu.lst Michael Chang
2014-04-01 16:06 ` Andrey Borzenkov [this message]
2014-04-02  8:43   ` Michael Chang
2014-04-02 10:29     ` Andrey Borzenkov
2014-04-02 16:13       ` Andrey Borzenkov
2014-04-03  6:50         ` Michael Chang
2014-04-03  8:25           ` Andrey Borzenkov
2014-04-03 10:23             ` Michael Chang
2015-01-24  5:53           ` Andrei Borzenkov

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=20140401200644.0fecf331@opensuse.site \
    --to=arvidjaar@gmail.com \
    --cc=grub-devel@gnu.org \
    --cc=mchang@suse.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).