On Tue, May 06, 2008 at 03:12:54PM +0200, Aurelien Jarno wrote: > > > > Ah, I think I see the problem. Please try this patch. > > It does work for /dev/vda, but not for /dev/vda1:
Looks like I missed a small detail. Here, I merged all the above changes in a single patch. Does this one work? -- Robert Millan <GPLv2> I know my rights; I want my phone call! <DRM> What use is a phone call… if you are unable to speak? (as seen on /.)
diff -x configure -x config.h.in -x CVS -x '*~' -x '*.mk' -urp ../grub2/util/biosdisk.c ./util/biosdisk.c --- ../grub2/util/biosdisk.c 2008-04-07 18:45:01.000000000 +0200 +++ ./util/biosdisk.c 2008-05-06 16:14:32.000000000 +0200 @@ -227,6 +227,7 @@ linux_find_partition (char *dev, unsigne format = "part%d"; } else if ((strncmp (real_dev + 5, "hd", 2) == 0 + || strncmp (real_dev + 5, "vd", 2) == 0 || strncmp (real_dev + 5, "sd", 2) == 0) && real_dev[7] >= 'a' && real_dev[7] <= 'z') { @@ -645,12 +646,13 @@ get_os_disk (const char *os_dev) 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 + || strncmp ("vd", p, 2) == 0 || strncmp ("sd", p, 2) == 0) && p[2] >= 'a' && p[2] <= 'z') { - /* /dev/[hs]d[a-z][0-9]* */ + /* /dev/[hsv]d[a-z][0-9]* */ p[3] = '\0'; return path; } diff -x configure -x config.h.in -x CVS -x '*~' -x '*.mk' -urp ../grub2/util/grub-mkdevicemap.c ./util/grub-mkdevicemap.c --- ../grub2/util/grub-mkdevicemap.c 2008-05-06 12:10:08.000000000 +0200 +++ ./util/grub-mkdevicemap.c 2008-05-06 16:18:50.000000000 +0200 @@ -267,6 +267,12 @@ get_scsi_disk_name (char *name, int unit #ifdef __linux__ static void +get_virtio_disk_name (char *name, int unit) +{ + sprintf (name, "/dev/vd%c", unit + 'a'); +} + +static void get_dac960_disk_name (char *name, int controller, int drive) { sprintf (name, "/dev/rd/c%dd%d", controller, drive); @@ -443,6 +449,22 @@ make_device_map (const char *device_map, } #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. */ for (i = 0; i < 8; i++) {