]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
* util/grub-install.in (grub_partition): New variable.
authorVladimir Serbinenko <phcoder@gmail.com>
Sat, 11 Sep 2010 15:21:48 +0000 (17:21 +0200)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Sat, 11 Sep 2010 15:21:48 +0000 (17:21 +0200)
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.

ChangeLog
util/grub-install.in
util/i386/pc/grub-setup.c

index e80ccad9ef9e4a12b2b50a5ff1912da2283da931..02cbb91cfc7402feb8331d578bea7ae27282355d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+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.
index 3ac7f677fc97fc2ae448646a730b897447fd8f83..ef1778b2a51960799a3ca2bae7a51d94e0335af8 100644 (file)
@@ -367,6 +367,7 @@ if [ "x${devabstraction_module}" = "x" ] ; then
     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)
@@ -389,6 +390,9 @@ if [ "x${devabstraction_module}" = "x" ] ; then
        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
index ff5aeda4008bf267c0f30ed69b628a4ad8e00697..987e2d05a42686fe8116e11ccbc51a6a9bbf548a 100644 (file)
@@ -81,8 +81,6 @@ setup (const char *dir,
   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;
@@ -214,8 +212,6 @@ setup (const char *dir,
                                       + 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);
@@ -291,16 +287,6 @@ setup (const char *dir,
              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;
@@ -389,8 +375,6 @@ setup (const char *dir,
 
   *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);
@@ -553,8 +537,6 @@ unable_to_embed:
 
   *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);
@@ -574,7 +556,6 @@ unable_to_embed:
   /* Sync is a Good Thing.  */
   sync ();
 
-  free (prefix);
   free (core_path);
   free (core_img);
   free (boot_img);