]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
* util/grub-mkimage.c (generate_image): Refuse to create the images
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Mon, 24 Jan 2011 01:44:27 +0000 (02:44 +0100)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Mon, 24 Jan 2011 01:44:27 +0000 (02:44 +0100)
bigger than the actual flash (512K) in Loongson machines. 512K is also
the biggest chip supported by them.

ChangeLog
util/grub-mkimage.c

index edb7d46f70e7f5edc767af5bb1f122c0c86fb1de..514ce4ef833d195ace6b71c43c9fe44320191712 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2011-01-24  Vladimir Serbinenko  <phcoder@gmail.com>
+
+       * util/grub-mkimage.c (generate_image): Refuse to create the images
+       bigger than the actual flash (512K) in Loongson machines. 512K is also
+       the biggest chip supported by them.
+
 2011-01-22  Vladimir Serbinenko  <phcoder@gmail.com>
 
        * grub-core/kern/emu/getroot.c: Include config-util.h explicitly.
index 0375d3ed586c9186bb9ca04688a0b730c9b5770c..876e9c9b289bb4403cf9d054581181bcc96af7f5 100644 (file)
@@ -1196,7 +1196,9 @@ generate_image (const char *dir, char *prefix, FILE *out, char *mods[],
        grub_util_warn ("fwstart.img doesn't match the known good version. "
                        "Proceed at your own risk");
 
-      rom_size = ALIGN_UP (core_size + boot_size, 512 * 1024);
+      if (core_size + boot_size > 512 * 1024)
+       grub_util_error ("firmware image is too big");
+      rom_size = 512 * 1024;
 
       rom_img = xmalloc (rom_size);
       memset (rom_img, 0, rom_size);