Package: grub
Version: 0.97-29
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.

Patches for grub-install and grub itself (for device.map generation) are
attached.

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

-- no debconf information
--- a/util/grub-install.in      2007-06-26 07:10:40.000000000 +0100
+++ b/util/grub-install.in      2007-12-15 12:50:16.000000000 +0000
@@ -144,13 +144,13 @@
        case $1 in
                /dev/md*)  set -- `getraid_mdadm $1`
        esac
-       tmp_disk=`echo "$1" | sed -e 's%\([sh]d[a-z]\)[0-9]*$%\1%' \
+       tmp_disk=`echo "$1" | sed -e 's%\(\(s\|h\|xv\)d[a-z]\)[0-9]*$%\1%' \
                                  -e 's%\(d[0-9]*\)p[0-9]*$%\1%' \
                                  -e 's%\(fd[0-9]*\)$%\1%' \
                                  -e 's%/part[0-9]*$%/disc%' \
                                  -e 's%\(c[0-7]d[0-9]*\).*$%\1%' \
                                  -e 's%\(e[0-9]\.[0-9]*\).*$%\1%'`
-       tmp_part=`echo "$1" | sed -e 's%.*/[sh]d[a-z]\([0-9]*\)$%\1%' \
+       tmp_part=`echo "$1" | sed -e 's%.*/\(s\|h\|xv\)d[a-z]\([0-9]*\)$%\2%' \
                                  -e 's%.*d[0-9]*p%%' \
                                  -e 's%.*/fd[0-9]*$%%' \
                                  -e 's%.*/floppy/[0-9]*$%%' \
--- a/lib/device.c
+++ b/lib/device.c
@@ -395,6 +395,16 @@
 #endif
 }
 
+static void
+get_xvd_disk_name (char *name, int unit)
+{
+#ifdef __linux__
+  sprintf (name, "/dev/xvd%c", unit + 'a');
+#else
+# warning "Xen XVD drives cannot be guesst in your operating system."
+  *name = 0;
+#endif
+}
 #ifdef __linux__
 static void
 get_dac960_disk_name (char *name, int controller, int drive)
@@ -770,7 +780,28 @@
 	  num_hd++;
 	}
     }
-  
+
+#ifdef __linux__
+  /* Xen Virtual Disks. */
+  for (i = 0; i < 16; i++)
+    {
+      char name[16];
+
+      get_xvd_disk_name (name, i);
+      if (check_device (name))
+        {
+          (*map)[num_hd + 0x80] = strdup (name);
+          assert ((*map)[num_hd + 0x80]);
+
+          /* If the device map file is opened, write the map.  */
+          if (fp)
+            fprintf (fp, "(hd%d)\t%s\n", num_hd, name);
+
+          num_hd++;
+        }
+    }
+#endif
+
 #ifdef __linux__
   /* This is for DAC960 - we have
      /dev/rd/c<controller>d<logical drive>p<partition>.

Reply via email to