I filed this patch against the Debian grub2 package and the maintainer
asked me to bring it to [EMAIL PROTECTED] Took me an age but here I
am ;-) [resending now I'm subscribed].

Back then I said:
> The grub package does not currently support installation in a Xen
> guest domain because it does not understand the Xen virtual block
> devices (/dev/xvd[a-z]).
> 
> This support is mainly useful because it allows the Debian installer to
> work in a Xen guest without Xen specific workarounds.
> 
> It might also be useful for someone who wanted to switch between
> a guest between para-virtual and fully-virtualised (HVM) operation.

Patch is attached.

Ian.
-- 
Ian Campbell
Current Noise: Strapping Young Lad - Antiproduct

The Public is merely a multiplied "me."
                -- Mark Twain
Index: grub2-1.95+20071101/util/biosdisk.c
===================================================================
--- grub2-1.95+20071101.orig/util/biosdisk.c	2007-12-16 16:41:43.000000000 +0000
+++ grub2-1.95+20071101/util/biosdisk.c	2007-12-16 16:42:29.000000000 +0000
@@ -640,6 +640,13 @@
 	  return path;
 	}
       
+      if ((strncmp ("xvd", p, 3) == 0) && p[3] >= 'a' && p[3] <= 'z')
+        {
+	  /* /dev/xvd[a-z][0-9]* */
+	  p[4] = '\0';
+	  return path;
+	}
+
       /* If this is an IDE disk or a SCSI disk.  */
       if ((strncmp ("hd", p, 2) == 0
 	   || strncmp ("sd", p, 2) == 0)
Index: grub2-1.95+20071101/util/grub-mkdevicemap.c
===================================================================
--- grub2-1.95+20071101.orig/util/grub-mkdevicemap.c	2007-12-16 16:41:43.000000000 +0000
+++ grub2-1.95+20071101/util/grub-mkdevicemap.c	2007-12-16 16:49:22.000000000 +0000
@@ -273,6 +273,13 @@
 {
   sprintf (name, "/dev/i2o/hd%c", unit);
 }
+
+static void
+get_xvd_disk_name (char *name, int unit)
+{
+  sprintf (name, "/dev/xvd%c", unit + 'a');
+}
+
 #endif
 
 /* Check if DEVICE can be read. If an error occurs, return zero,
@@ -515,6 +522,24 @@
   }
 #endif /* __linux__ */
 
+#ifdef __linux__
+  /* Xen Virtual Disks. */
+  for (i = 0; i < 16; i++)
+    {
+      char name[16];
+
+      get_xvd_disk_name (name, i);
+      if (check_device (name))
+        {
+            char *p;
+            p = grub_util_get_disk_name (num_hd, name);
+            fprintf (fp, "(%s)\t%s\n", p, name);
+            free (p);
+            num_hd++;
+        }
+    }
+#endif
+
  finish:
   if (fp != stdout)
     fclose (fp);

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to