fix partition module names when /boot is on diskfilter

/usr/local/grub2/sbin/grub-install: info: grub-mkimage --directory '/usr/local/grub2/lib/grub/i386-pc' --prefix '(mduuid/e6d1dcf06cea72140bafae74a8677f36)/grub' --output '/boot/grub/i386-pc/core.img' --format 'i386-pc' --compression 'auto'  'ext2' 'msdos' 'msdos' 'diskfilter' 'mdraid1x' 'biosdisk'
.
/usr/local/grub2/sbin/grub-install: error: cannot open `/usr/local/grub2/lib/grub/i386-pc/msdos.mod': No such file or directory.

Introduce common helper for both diskfilter and non-diskfilter case that
converts partition map names into module names.
This commit is contained in:
Andrey Borzenkov 2013-12-07 15:00:37 +04:00
parent 5ff249072d
commit f585c90505
4 changed files with 71 additions and 39 deletions

View file

@ -247,13 +247,12 @@ identify_partmap (grub_disk_t disk __attribute__ ((unused)),
void
SETUP (const char *dir,
const char *boot_file, const char *core_file,
const char *dev, int force,
const char *dest, int force,
int fs_probe, int allow_floppy)
{
char *core_path;
char *boot_img, *core_img, *boot_path;
char *root = 0;
char *dest = 0;
size_t boot_size, core_size;
#ifdef GRUB_SETUP_BIOS
grub_uint16_t core_sectors;
@ -270,28 +269,6 @@ SETUP (const char *dir,
#endif
bl.last_length = 0;
{
size_t len = strlen (dev);
if (len > 2 && dev[0] == '(' && dev[len - 1] == ')')
{
dest = xmalloc (len - 1);
strncpy (dest, dev + 1, len - 2);
dest[len - 2] = '\0';
}
}
if (! dest)
{
/* Possibly, the user specified an OS device file. */
dest = grub_util_get_grub_dev (dev);
if (! dest)
grub_util_error (_("Invalid device `%s'.\n"), dev);
grub_util_info ("transformed OS device `%s' into GRUB device `%s'",
dev, dest);
}
/* Read the boot image by the OS service. */
boot_path = grub_util_get_path (dir, boot_file);
boot_size = grub_util_get_image_size (boot_path);
@ -326,7 +303,6 @@ SETUP (const char *dir,
dest_dev = grub_device_open (dest);
if (! dest_dev)
grub_util_error ("%s", grub_errmsg);
free (dest);
core_dev = dest_dev;