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

Bug#786621: grub2: kfreebsd lacks support for xbd and virtio disks



Package: src:grub2
Version: 2.02~beta2-22
Severity: important
Tags: patch

Hi,

grub-probe (and thus grub-install and the grub-installer udeb) does not
recognise Xen xbd and KVM virtio disks on kfreebsd.  It is quite simple
to add their definitions to the #ifdef __FreeBSD_kernel__ section with
the attached patch to fix this.

I'll be making an upload with this fix to our jessie-kfreebsd suite,
but please also consider it for sid.  Thanks.

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

Kernel: kFreeBSD 9.0-2-amd64-xenhvm-ipsec
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
--- a/util/deviceiter.c
+++ b/util/deviceiter.c
@@ -305,6 +305,18 @@ get_mfi_disk_name (char *name, int unit)
 {
   sprintf (name, "/dev/mfid%d", unit);
 }
+
+static void
+get_virtio_disk_name (char *name, int unit)
+{
+  sprintf (name, "/dev/vtbd%d", unit);
+}
+
+static void
+get_xvd_disk_name (char *name, int unit)
+{
+  sprintf (name, "/dev/xbd%d", unit);
+}
 #endif
 
 #ifdef __linux__
@@ -694,6 +706,32 @@ grub_util_iterate_devices (int (*hook) (
 	    goto out;
         }
     }
+
+  /* Virtio disks.  */
+  for (i = 0; i < 96; i++)
+    {
+      char name[16];
+
+      get_virtio_disk_name (name, i);
+      if (check_device_readable_unique (name))
+	{
+	  if (hook (name, 0, hook_data))
+	    goto out;
+	}
+    }
+
+  /* Xen virtual block devices.  */
+  for (i = 0; i < 96; i++)
+    {
+      char name[16];
+
+      get_xvd_disk_name (name, i);
+      if (check_device_readable_unique (name))
+	{
+	  if (hook (name, 0, hook_data))
+	    goto out;
+	}
+    }
 #endif
 
 #ifdef __linux__

Reply to: