diff --git a/ChangeLog b/ChangeLog index d4dcd5907..2f6b3f697 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2008-05-28 Robert Millan + + * util/biosdisk.c (linux_find_partition, get_os_disk): Handle MMC + devices. + * util/grub-mkdevicemap.c (get_mmc_disk_name) + (make_device_map): Likewise. + 2008-05-20 Bean * fs/fshelp.c (grub_fshelp_map_block): New function. diff --git a/util/biosdisk.c b/util/biosdisk.c index ddb3718c0..651677f02 100644 --- a/util/biosdisk.c +++ b/util/biosdisk.c @@ -239,7 +239,7 @@ linux_find_partition (char *dev, unsigned long sector) || strncmp (real_dev + 5, "sd", 2) == 0) && real_dev[7] >= 'a' && real_dev[7] <= 'z') { - p = real_dev + 8; + p = real_dev + sizeof("/dev/hda")-1; format = "%d"; } else if (strncmp (real_dev + 5, "rd/c", 4) == 0) /* dac960 */ @@ -266,6 +266,11 @@ linux_find_partition (char *dev, unsigned long sector) format = "p%d"; } + else if (strncmp (real_dev + 5, "mmcblk", sizeof("mmcblk")-1) == 0) + { + p = real_dev + sizeof("/dev/mmcblk0")-1; + format = "p%d"; + } else return 0; @@ -675,6 +680,17 @@ get_os_disk (const char *os_dev) return path; } + /* If this is a MultiMediaCard (MMC). */ + if (strncmp ("mmcblk", p, sizeof ("mmcblk") - 1) == 0) + { + /* /dev/mmcblk[0-9]+(p[0-9]+)? */ + p = strchr (p, 'p'); + if (p) + *p = '\0'; + + return path; + } + /* If this is an IDE, SCSI or Virtio disk. */ if ((strncmp ("hd", p, 2) == 0 || strncmp ("vd", p, 2) == 0 diff --git a/util/grub-mkdevicemap.c b/util/grub-mkdevicemap.c index d24d84416..2e8e82dba 100644 --- a/util/grub-mkdevicemap.c +++ b/util/grub-mkdevicemap.c @@ -296,6 +296,12 @@ get_cciss_disk_name (char *name, int controller, int drive) sprintf (name, "/dev/cciss/c%dd%d", controller, drive); } +static void +get_mmc_disk_name (char *name, int unit) +{ + sprintf (name, "/dev/mmcblk%d", unit); +} + static void get_xvd_disk_name (char *name, int unit) { @@ -598,6 +604,22 @@ make_device_map (const char *device_map, int floppy_disks) } } + /* MultiMediaCard (MMC). */ + for (i = 0; i < 10; i++) + { + char name[16]; + + get_mmc_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++; + } + } + finish: #endif /* __linux__ */