+2010-09-11 Vladimir Serbinenko <phcoder@gmail.com>
+2010-09-11 Colin Watson <cjwatson@ubuntu.com>
+
+ * util/grub-install.in (grub_partition): New variable.
+ Set prefix_drive on EFI and PC to (,$grub_partition) as last resort.
+ * util/i386/pc/grub-setup.c (setup): Don't touch prefix.
+ Fixes a bug reported by Yves Blusseau.
+
2010-09-11 Vladimir Serbinenko <phcoder@gmail.com>
Fix emu on mipsel.
grub_drive="`$grub_probe --target=drive --device ${grub_device}`" || exit 1
# Strip partition number
+ grub_partition="`echo ${grub_drive} | sed -e 's/^[^,]*,//; s/)$//'`"
grub_drive="`echo ${grub_drive} | sed -e s/,[a-z0-9,]*//g`"
if [ "$disk_module" = ata ] ; then
# generic method (used on coreboot and ata mod)
echo 'set prefix=($root)'"${relative_grubdir}" >> ${grubdir}/load.cfg
config_opt="-c ${grubdir}/load.cfg "
modules="$modules search_fs_uuid"
+ elif [ "x$platform" = xefi ] || [ "x$platform" = xpc ]; then
+ # we need to hardcode the partition number in the core image's prefix.
+ prefix_drive="(,$grub_partition)"
fi
else
prefix_drive=`$grub_probe --target=drive --device ${grub_device}` || exit 1
struct grub_boot_blocklist *first_block, *block;
grub_int32_t *install_dos_part, *install_bsd_part;
grub_int32_t dos_part, bsd_part;
- char *install_prefix;
- char *prefix = NULL;
char *tmp_img;
int i;
grub_disk_addr_t first_sector;
+ GRUB_KERNEL_MACHINE_INSTALL_DOS_PART);
install_bsd_part = (grub_int32_t *) (core_img + GRUB_DISK_SECTOR_SIZE
+ GRUB_KERNEL_MACHINE_INSTALL_BSD_PART);
- install_prefix = (char *) (core_img + GRUB_DISK_SECTOR_SIZE +
- GRUB_KERNEL_MACHINE_PREFIX);
/* Open the root device and the destination device. */
root_dev = grub_device_open (root);
dos_part = root_dev->disk->partition->number;
bsd_part = -1;
}
-
- if (install_prefix[0] != '(')
- {
- char *root_part_name;
-
- root_part_name =
- grub_partition_get_name (root_dev->disk->partition);
- prefix = xasprintf ("(,%s)%s", root_part_name, install_prefix);
- free (root_part_name);
- }
}
else
dos_part = bsd_part = -1;
*install_dos_part = grub_cpu_to_le32 (dos_part);
*install_bsd_part = grub_cpu_to_le32 (bsd_part);
- if (prefix)
- strcpy (install_prefix, prefix);
/* The first blocklist contains the whole sectors. */
first_block->start = grub_cpu_to_le64 (embed_region.start + 1);
*install_dos_part = grub_cpu_to_le32 (dos_part);
*install_bsd_part = grub_cpu_to_le32 (bsd_part);
- if (prefix)
- strcpy (install_prefix, prefix);
/* Write the first two sectors of the core image onto the disk. */
grub_util_info ("opening the core image `%s'", core_path);
/* Sync is a Good Thing. */
sync ();
- free (prefix);
free (core_path);
free (core_img);
free (boot_img);