]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
2010-02-13 Vladimir Serbinenko <phcoder@gmail.com>
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Sat, 13 Feb 2010 14:54:27 +0000 (15:54 +0100)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Sat, 13 Feb 2010 14:54:27 +0000 (15:54 +0100)
Properly align 64-bit targets.

* util/grub-mkrawimage.c (ALIGN_ADDR): New macro.
(generate_image): Use ALIGN_ADDR.

ChangeLog
util/grub-mkrawimage.c

index 0d84d9340db9e9604f8a34d337758f71d67f677b..9591c45a9241dde62ca7f648b0bd031c769090b8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2010-02-13  Vladimir Serbinenko  <phcoder@gmail.com>
+
+       Properly align 64-bit targets.
+
+       * util/grub-mkrawimage.c (ALIGN_ADDR): New macro.
+       (generate_image): Use ALIGN_ADDR.
+
 2010-02-13  Vladimir Serbinenko  <phcoder@gmail.com>
 
        Properly create cross-endian images.
index 023854c0c9156c13771c92466d11ea7f5dde1dfd..4ed29744f27f0bfbad2e749f0bb3e190f2fcb3e5 100644 (file)
@@ -41,6 +41,8 @@
 
 #include "progname.h"
 
+#define ALIGN_ADDR(x) (ALIGN_UP((x), GRUB_TARGET_SIZEOF_VOID_P))
+
 #ifdef ENABLE_LZMA
 #include <grub/lib/LzmaEnc.h>
 
@@ -129,20 +131,20 @@ generate_image (const char *dir, char *prefix, FILE *out, char *mods[],
 
   if (font_path)
     {
-      font_size = ALIGN_UP(grub_util_get_image_size (font_path), 4);
+      font_size = ALIGN_ADDR (grub_util_get_image_size (font_path));
       total_module_size += font_size + sizeof (struct grub_module_header);
     }
 
   if (config_path)
     {
       config_size_pure = grub_util_get_image_size (config_path) + 1;
-      config_size = ALIGN_UP(config_size_pure, 4);
+      config_size = ALIGN_ADDR (config_size_pure);
       grub_util_info ("the size of config file is 0x%x", config_size);
       total_module_size += config_size + sizeof (struct grub_module_header);
     }
 
   for (p = path_list; p; p = p->next)
-    total_module_size += (ALIGN_UP (grub_util_get_image_size (p->name), 4)
+    total_module_size += (ALIGN_ADDR (grub_util_get_image_size (p->name))
                          + sizeof (struct grub_module_header));
 
   grub_util_info ("the total module size is 0x%x", total_module_size);
@@ -168,7 +170,7 @@ generate_image (const char *dir, char *prefix, FILE *out, char *mods[],
       size_t mod_size, orig_size;
 
       orig_size = grub_util_get_image_size (p->name);
-      mod_size = ALIGN_UP(orig_size, 4);
+      mod_size = ALIGN_ADDR (orig_size);
 
       header = (struct grub_module_header *) (kernel_img + offset);
       memset (header, 0, sizeof (struct grub_module_header));
@@ -339,7 +341,7 @@ generate_image (const char *dir, char *prefix, FILE *out, char *mods[],
       Elf32_Phdr *phdr;
       grub_uint32_t target_addr;
 
-      program_size = ALIGN_UP (core_size, 4);
+      program_size = ALIGN_ADDR (core_size);
 
       elf_img = xmalloc (program_size + sizeof (*ehdr) + sizeof (*phdr));
       memset (elf_img, 0, program_size + sizeof (*ehdr) + sizeof (*phdr));