]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
2007-07-22 Robert Millan <rmh@aybabtu.com>
authorrobertmh <robertmh@localhost>
Sun, 22 Jul 2007 09:05:11 +0000 (09:05 +0000)
committerrobertmh <robertmh@localhost>
Sun, 22 Jul 2007 09:05:11 +0000 (09:05 +0000)
* include/grub/ieee1275/ieee1275.h (grub_ieee1275_flag): Add
GRUB_IEEE1275_FLAG_BROKEN_OUTPUT flag.
* kern/powerpc/ieee1275/cmain.c (grub_ieee1275_find_options): Set this
flag when running on SmartFirmware.
* term/ieee1275/ofconsole.c (grub_ofconsole_init): Avoid running
"output-device output" command when GRUB_IEEE1275_FLAG_BROKEN_OUTPUT
was set.

* kern/powerpc/ieee1275/openfw.c (grub_ieee1275_encode_devname):
Increase partno when GRUB_IEEE1275_FLAG_0_BASED_PARTITIONS flag is set,
rather than decreasing it.

* util/i386/pc/grub-setup.c (setup): When embedding is required, but
there's not enough space to do it, fail in the same way as when it
can't be done because there are no partitions.

* util/powerpc/ieee1275/grub-install.in: Improve error message shown
when nvsetenv failed.

ChangeLog
include/grub/ieee1275/ieee1275.h
kern/powerpc/ieee1275/cmain.c
kern/powerpc/ieee1275/openfw.c
term/ieee1275/ofconsole.c
util/i386/pc/grub-setup.c
util/powerpc/ieee1275/grub-install.in

index c85fa1dcf03f94e74ebb78b4866309aecfff3b96..eb5e6158d6c234d0d338f48908170ae5e03dc478 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,24 @@
+2007-07-22  Robert Millan  <rmh@aybabtu.com>
+
+       * include/grub/ieee1275/ieee1275.h (grub_ieee1275_flag): Add
+       GRUB_IEEE1275_FLAG_BROKEN_OUTPUT flag.
+       * kern/powerpc/ieee1275/cmain.c (grub_ieee1275_find_options): Set this
+       flag when running on SmartFirmware.
+       * term/ieee1275/ofconsole.c (grub_ofconsole_init): Avoid running
+       "output-device output" command when GRUB_IEEE1275_FLAG_BROKEN_OUTPUT
+       was set.
+
+       * kern/powerpc/ieee1275/openfw.c (grub_ieee1275_encode_devname):
+       Increase partno when GRUB_IEEE1275_FLAG_0_BASED_PARTITIONS flag is set,
+       rather than decreasing it.
+
+       * util/i386/pc/grub-setup.c (setup): When embedding is required, but
+       there's not enough space to do it, fail in the same way as when it
+       can't be done because there are no partitions.
+
+       * util/powerpc/ieee1275/grub-install.in: Improve error message shown
+       when nvsetenv failed.
+
 2007-07-22  Yoshinori K. Okuji  <okuji@enbug.org>
 
        * conf/i386-pc.rmk (CLEANFILES): Removed for grub-mkrescue,
index 92b1c8812bfec61baca0a14aa7379f1c4bd4b439..6fe5cd1a5a556be9b9ddbfb91c2a0bd9b0295596 100644 (file)
@@ -79,6 +79,9 @@ enum grub_ieee1275_flag
   /* CHRP specifies partitions are numbered from 1 (partition 0 refers to the
      whole disk). However, CodeGen firmware numbers partitions from 0.  */
   GRUB_IEEE1275_FLAG_0_BASED_PARTITIONS,
+
+  /* CodeGen firmware does not correctly implement "output-device output" */
+  GRUB_IEEE1275_FLAG_BROKEN_OUTPUT,
 };
 
 extern int EXPORT_FUNC(grub_ieee1275_test_flag) (enum grub_ieee1275_flag flag);
index 3a2ebeb2b0b6d1296be4316b927fde61d04035d9..56878de8c761093bd602e832ea710ea8ee58ecb2 100644 (file)
@@ -62,7 +62,10 @@ grub_ieee1275_find_options (void)
   grub_ieee1275_finddevice ("/openprom", &openprom);
   rc = grub_ieee1275_get_property (openprom, "SmartFirmware-version", 0, 0, 0);
   if (rc >= 0)
-    grub_ieee1275_set_flag (GRUB_IEEE1275_FLAG_0_BASED_PARTITIONS);
+    {
+      grub_ieee1275_set_flag (GRUB_IEEE1275_FLAG_0_BASED_PARTITIONS);
+      grub_ieee1275_set_flag (GRUB_IEEE1275_FLAG_BROKEN_OUTPUT);
+    }
 }
 
 void cmain (uint32_t r3, uint32_t r4, uint32_t r5);
index 15ded152c9975a4ed751bd48dc272962f04fba4e..b8207b028a415c7a681a21d2f1447eb82e045287 100644 (file)
@@ -372,7 +372,7 @@ grub_ieee1275_encode_devname (const char *path)
 
       if (grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_0_BASED_PARTITIONS))
        /* GRUB partition 1 is OF partition 0.  */
-       partno--;
+       partno++;
 
       /* Assume partno will require less than five bytes to encode.  */
       encoding = grub_malloc (grub_strlen (device) + 3 + 5);
index fc59820d65196fbc84a220118e00f25c81a9a9ef..9eb1202a09b929d3d0eb85d2498ae60c59499d6f 100644 (file)
@@ -311,8 +311,10 @@ grub_ofconsole_init (void)
   int col;
 
   /* The latest PowerMacs don't actually initialize the screen for us, so we
-   * use this trick to re-open the output device.  */
-  grub_ieee1275_interpret ("output-device output", 0);
+   * use this trick to re-open the output device (but we avoid doing this on
+   * platforms where it's known to be broken). */
+  if (! grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_BROKEN_OUTPUT))
+    grub_ieee1275_interpret ("output-device output", 0);
 
   if (grub_ieee1275_get_property (grub_ieee1275_chosen, "stdout", data,
                                  sizeof data, &actual)
index c37dabcd088412eec80db302aebf42dd03c710ea..240a9553eda4058006a526e51f965bda72c3eea1 100644 (file)
@@ -105,6 +105,7 @@ setup (const char *prefix, const char *dir,
   grub_file_t file;
   FILE *fp;
   unsigned long first_start = ~0UL;
+  int able_to_embed = 1;
   
   auto void save_first_sector (grub_disk_addr_t sector, unsigned offset,
                               unsigned length);
@@ -323,8 +324,13 @@ setup (const char *prefix, const char *dir,
 
          goto finish;
        }
+      else
+        able_to_embed = 0;
     }
-  else if (must_embed)
+  else
+    able_to_embed = 0;
+
+  if (must_embed && !able_to_embed)
     grub_util_error ("Can't embed the core image, but this is required when\n"
                     "the root device is on a RAID array or LVM volume.");
   
index 915ac5e395eab4be8e558b4dd9ad4aec841f5fe6..2f917829c653a78acdd0625baedd9d1e16b4e208 100644 (file)
@@ -208,9 +208,11 @@ if test $update_nvram = yes; then
     }
 
     # Point boot-device at the new grub install
-    "$nvsetenv" boot-device "$ofpath:$partno,"'\grub' || {
+    boot_device="boot-device $ofpath:$partno,\\grub"
+    "$nvsetenv" "$boot_device" || {
        echo "$nvsetenv failed."
-       echo "You will have to set boot-device manually."
+       echo "You will have to set boot-device manually.  At the Open Firmware prompt, type:"
+       echo "  setenv $boot_device"
        exit 1
     }
 fi