2008-05-09 Robert Millan <rmh@aybabtu.com>

* util/biosdisk.c (linux_find_partition, get_os_disk): Handle Virtio
        devices.
        * util/grub-mkdevicemap.c (get_virtio_disk_name)
        (make_device_map): Likewise.
        Reported by Aurelien Jarno <aurel32@debian.org>
This commit is contained in:
robertmh 2008-05-09 12:13:03 +00:00
parent ed7593907d
commit 1cf4059a49
3 changed files with 34 additions and 2 deletions

View file

@ -1,3 +1,11 @@
2008-05-09 Robert Millan <rmh@aybabtu.com>
* util/biosdisk.c (linux_find_partition, get_os_disk): Handle Virtio
devices.
* util/grub-mkdevicemap.c (get_virtio_disk_name)
(make_device_map): Likewise.
Reported by Aurelien Jarno <aurel32@debian.org>
2008-05-07 Ian Campbell <ijc@hellion.org.uk> 2008-05-07 Ian Campbell <ijc@hellion.org.uk>
* util/biosdisk.c (get_os_disk): Recognise xvd type disks. * util/biosdisk.c (get_os_disk): Recognise xvd type disks.

View file

@ -227,6 +227,7 @@ linux_find_partition (char *dev, unsigned long sector)
format = "part%d"; format = "part%d";
} }
else if ((strncmp (real_dev + 5, "hd", 2) == 0 else if ((strncmp (real_dev + 5, "hd", 2) == 0
|| strncmp (real_dev + 5, "vd", 2) == 0
|| strncmp (real_dev + 5, "sd", 2) == 0) || strncmp (real_dev + 5, "sd", 2) == 0)
&& real_dev[7] >= 'a' && real_dev[7] <= 'z') && real_dev[7] >= 'a' && real_dev[7] <= 'z')
{ {
@ -668,12 +669,13 @@ get_os_disk (const char *os_dev)
return path; return path;
} }
/* If this is an IDE disk or a SCSI disk. */ /* If this is an IDE, SCSI or Virtio disk. */
if ((strncmp ("hd", p, 2) == 0 if ((strncmp ("hd", p, 2) == 0
|| strncmp ("vd", p, 2) == 0
|| strncmp ("sd", p, 2) == 0) || strncmp ("sd", p, 2) == 0)
&& p[2] >= 'a' && p[2] <= 'z') && p[2] >= 'a' && p[2] <= 'z')
{ {
/* /dev/[hs]d[a-z][0-9]* */ /* /dev/[hsv]d[a-z][0-9]* */
p[3] = '\0'; p[3] = '\0';
return path; return path;
} }

View file

@ -266,6 +266,12 @@ get_scsi_disk_name (char *name, int unit)
} }
#ifdef __linux__ #ifdef __linux__
static void
get_virtio_disk_name (char *name, int unit)
{
sprintf (name, "/dev/vd%c", unit + 'a');
}
static void static void
get_dac960_disk_name (char *name, int controller, int drive) get_dac960_disk_name (char *name, int controller, int drive)
{ {
@ -455,6 +461,22 @@ make_device_map (const char *device_map, int floppy_disks)
} }
#ifdef __linux__ #ifdef __linux__
/* Virtio disks. */
for (i = 0; i < 20; i++)
{
char name[16];
get_virtio_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++;
}
}
/* ATARAID disks. */ /* ATARAID disks. */
for (i = 0; i < 8; i++) for (i = 0; i < 8; i++)
{ {