]> git.proxmox.com Git - grub2.git/commitdiff
2008-07-30 Robert Millan <rmh@aybabtu.com>
authorrobertmh <robertmh@localhost>
Wed, 30 Jul 2008 10:44:38 +0000 (10:44 +0000)
committerrobertmh <robertmh@localhost>
Wed, 30 Jul 2008 10:44:38 +0000 (10:44 +0000)
        * include/grub/i386/pc/kernel.h (GRUB_KERNEL_MACHINE_DATA_END):
        Increase from 0x50 to 0x60.
        * util/i386/pc/grub-install.in: Detect cross-disk installs, and
        use UUIDs to identify the root drive for them.  If that's not
        possible, abort.
        * util/i386/pc/grub-setup.c (setup): Do not special-case, or even
        check, for cross-disk installs.

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

index 63f073a466176770499ff6c33fc872e773c6eca3..601dbf94b52b9c8ddcc06c6e6b93643cf9bf8fdf 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2008-07-30  Robert Millan  <rmh@aybabtu.com>
+
+       * include/grub/i386/pc/kernel.h (GRUB_KERNEL_MACHINE_DATA_END):
+       Increase from 0x50 to 0x60.
+       * util/i386/pc/grub-install.in: Detect cross-disk installs, and
+       use UUIDs to identify the root drive for them.  If that's not
+       possible, abort.
+       * util/i386/pc/grub-setup.c (setup): Do not special-case, or even
+       check, for cross-disk installs.
+
 2008-07-30  Robert Millan  <rmh@aybabtu.com>
 
        * kern/ieee1275/init.c (grub_machine_set_prefix): If `grub_prefix'
index 402faa3a9674e17fcbee518d2be92c3c6442566c..a00117bd78de614644c460c7752e070ad8a4336f 100644 (file)
@@ -41,7 +41,7 @@
 #define GRUB_KERNEL_MACHINE_PREFIX             0x20
 
 /* End of the data section. */
-#define GRUB_KERNEL_MACHINE_DATA_END           0x50
+#define GRUB_KERNEL_MACHINE_DATA_END           0x60
 
 /* The size of the first region which won't be compressed.  */
 #if defined(ENABLE_LZO)
index d7966d59533d7041bef13a8bacd820cc9458bb66..5875039a947a352458db9604f22a299cea28eda5 100644 (file)
@@ -233,15 +233,34 @@ partmap_module=`$grub_probe --target=partmap --device ${grub_device} 2> /dev/nul
 # Device abstraction module, if any (lvm, raid).
 devabstraction_module=`$grub_probe --target=abstraction --device ${grub_device}`
 
+# The order in this list is critical.  Be careful when modifying it.
+modules="$modules $fs_module $partmap_module biosdisk $devabstraction_module"
+
+prefix_drive=
 if [ "x${devabstraction_module}" = "x" ] ; then
-    prefix_drive=
+    if echo "${install_device}" | grep -qx "(.*)" ; then
+      install_drive="${install_device}"
+    else
+      install_drive="`$grub_probe --target=drive --device ${install_device}`"
+    fi
+    grub_drive="`$grub_probe --target=drive --device ${grub_device}`"
+
+    # Strip partition number
+    install_drive="`echo ${install_drive} | sed -e s/,[0-9]*//g`"
+    grub_drive="`echo ${grub_drive} | sed -e s/,[0-9]*//g`"
+    if [ "x${grub_drive}" != "x${install_drive}" ] ; then
+        uuid="`$grub_probe --target=fs_uuid --device ${grub_device}`"
+        if [ "x${uuid}" = "x" ] ; then
+          echo "You attempted a cross-disk install, but the filesystem containing ${grubdir} does not support UUIDs." 1>&2
+          exit 1
+        fi
+        prefix_drive="(UUID=${uuid})"
+        modules="$modules fs_uuid"
+    fi
 else
     prefix_drive=`$grub_probe --target=drive --device ${grub_device}`
 fi
 
-# The order in this list is critical.  Be careful when modifying it.
-modules="$modules $fs_module $partmap_module biosdisk $devabstraction_module"
-
 grub_prefix="${prefix_drive}`make_system_path_relative_to_its_root ${grubdir}`" || exit 1
 
 $grub_mkimage --output=${grubdir}/core.img --prefix=${grub_prefix}/ $modules || exit 1
index c6f4810e8a31b426478324656fdd24be56bcd238..94826855cf13f39c82b593d1868f542fa05f7590 100644 (file)
@@ -339,17 +339,11 @@ setup (const char *dir,
          if (grub_disk_write (dest_dev->disk, embed_region.start, 0, core_size, core_img))
            grub_util_error ("%s", grub_errmsg);
 
-         /* The boot image and the core image are on the same drive,
-            so there is no need to specify the boot drive explicitly.  */
-         *boot_drive = 0xff;
-         *kernel_sector = grub_cpu_to_le64 (embed_region.start);
+         /* FIXME: can this be skipped?  */
+         *boot_drive = 0xFF;
+         *root_drive = 0xFF;
 
-          /* If the root device is different from the destination device,
-             it is necessary to embed the root drive explicitly.  */
-          if (root_dev->disk->id != dest_dev->disk->id)
-            *root_drive = (grub_uint8_t) root_dev->disk->id;
-          else
-            *root_drive = 0xFF;
+         *kernel_sector = grub_cpu_to_le64 (embed_region.start);
 
          /* Write the boot image onto the disk.  */
          if (grub_disk_write (dest_dev->disk, 0, 0, GRUB_DISK_SECTOR_SIZE,
@@ -480,15 +474,8 @@ setup (const char *dir,
   
   *kernel_sector = grub_cpu_to_le64 (first_sector);
 
-  /* If the destination device is different from the root device,
-     it is necessary to embed the boot drive explicitly.  */
-  if (root_dev->disk->id != dest_dev->disk->id)
-    *boot_drive = (grub_uint8_t) root_dev->disk->id;
-  else
-    *boot_drive = 0xFF;
-
-  /* When the core image is not embedded, the root device always follows
-     the boot device.  */
+  /* FIXME: can this be skipped?  */
+  *boot_drive = 0xFF;
   *root_drive = 0xFF;
 
   *install_dos_part = grub_cpu_to_le32 (dos_part);