Package: grub-pc
Version: 1.95+20071101-1
Severity: normal
Tags: patch

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 for grub2 is attached. Note however that the paravirtual
bootloader used by Xen (pygrub) does not yet support the grub2 grub.cfg
format, just the previous menu.lst format so this patch is necessary but
not yet sufficient. I'll be working on a patch for this aspect separately.

Thanks,
Ian.

-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.22-3-amd64 (SMP w/1 CPU core)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
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);

Reply via email to