+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.
#include "progname.h"
+#define ALIGN_ADDR(x) (ALIGN_UP((x), GRUB_TARGET_SIZEOF_VOID_P))
+
#ifdef ENABLE_LZMA
#include <grub/lib/LzmaEnc.h>
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);
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));
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));