2008-07-04 Pavel Roskin <proski@gnu.org>
* util/elf/grub-mkimage.c: Use GRUB_TARGET_SIZEOF_LONG instead of sizeof(long). This fixes PowerPC image generation on x86_64.
This commit is contained in:
parent
8516d2a8e1
commit
fdecb8fdbb
2 changed files with 13 additions and 7 deletions
|
@ -1,3 +1,8 @@
|
|||
2008-07-04 Pavel Roskin <proski@gnu.org>
|
||||
|
||||
* util/elf/grub-mkimage.c: Use GRUB_TARGET_SIZEOF_LONG instead
|
||||
of sizeof(long). This fixes PowerPC image generation on x86_64.
|
||||
|
||||
2008-07-04 Robert Millan <rmh@aybabtu.com>
|
||||
|
||||
This fixes a performance issue when pc & gpt partmap iterators
|
||||
|
|
|
@ -88,7 +88,7 @@ load_note (Elf32_Phdr *phdr, FILE *out)
|
|||
/* Fill in the rest of the segment header. */
|
||||
phdr->p_type = grub_host_to_target32 (PT_NOTE);
|
||||
phdr->p_flags = grub_host_to_target32 (PF_R);
|
||||
phdr->p_align = grub_host_to_target32 (sizeof (long));
|
||||
phdr->p_align = grub_host_to_target32 (GRUB_TARGET_SIZEOF_LONG);
|
||||
phdr->p_vaddr = 0;
|
||||
phdr->p_paddr = 0;
|
||||
phdr->p_filesz = grub_host_to_target32 (note_size);
|
||||
|
@ -150,7 +150,7 @@ load_modules (grub_addr_t modbase, Elf32_Phdr *phdr, const char *dir,
|
|||
/* Fill in the rest of the segment header. */
|
||||
phdr->p_type = grub_host_to_target32 (PT_LOAD);
|
||||
phdr->p_flags = grub_host_to_target32 (PF_R | PF_W | PF_X);
|
||||
phdr->p_align = grub_host_to_target32 (sizeof (long));
|
||||
phdr->p_align = grub_host_to_target32 (GRUB_TARGET_SIZEOF_LONG);
|
||||
phdr->p_vaddr = grub_host_to_target32 (modbase);
|
||||
phdr->p_paddr = grub_host_to_target32 (modbase);
|
||||
phdr->p_filesz = grub_host_to_target32 (total_module_size);
|
||||
|
@ -177,7 +177,7 @@ add_segments (char *dir, FILE *out, int chrp, char *mods[])
|
|||
|
||||
grub_util_read_at (&ehdr, sizeof (ehdr), 0, in);
|
||||
|
||||
offset = ALIGN_UP (sizeof (ehdr), sizeof (long));
|
||||
offset = ALIGN_UP (sizeof (ehdr), GRUB_TARGET_SIZEOF_LONG);
|
||||
ehdr.e_phoff = grub_host_to_target32 (offset);
|
||||
|
||||
phdr_size = (grub_target_to_host16 (ehdr.e_phentsize) *
|
||||
|
@ -190,7 +190,7 @@ add_segments (char *dir, FILE *out, int chrp, char *mods[])
|
|||
phdr_size += grub_target_to_host16 (ehdr.e_phentsize);
|
||||
|
||||
phdrs = xmalloc (phdr_size);
|
||||
offset += ALIGN_UP (phdr_size, sizeof (long));
|
||||
offset += ALIGN_UP (phdr_size, GRUB_TARGET_SIZEOF_LONG);
|
||||
|
||||
/* Copy all existing segments. */
|
||||
for (i = 0; i < grub_target_to_host16 (ehdr.e_phnum); i++)
|
||||
|
@ -224,7 +224,8 @@ add_segments (char *dir, FILE *out, int chrp, char *mods[])
|
|||
phdr->p_offset = grub_host_to_target32 (offset);
|
||||
grub_util_write_image_at (segment_img, grub_target_to_host32 (phdr->p_filesz),
|
||||
offset, out);
|
||||
offset += ALIGN_UP (grub_target_to_host32 (phdr->p_filesz), sizeof (long));
|
||||
offset += ALIGN_UP (grub_target_to_host32 (phdr->p_filesz),
|
||||
GRUB_TARGET_SIZEOF_LONG);
|
||||
|
||||
free (segment_img);
|
||||
}
|
||||
|
@ -242,7 +243,7 @@ add_segments (char *dir, FILE *out, int chrp, char *mods[])
|
|||
|
||||
/* Fill in p_offset so the callees know where to write. */
|
||||
phdr->p_offset = grub_host_to_target32 (ALIGN_UP (grub_util_get_fp_size (out),
|
||||
sizeof (long)));
|
||||
GRUB_TARGET_SIZEOF_LONG));
|
||||
|
||||
load_modules (modbase, phdr, dir, mods, out);
|
||||
}
|
||||
|
@ -255,7 +256,7 @@ add_segments (char *dir, FILE *out, int chrp, char *mods[])
|
|||
|
||||
/* Fill in p_offset so the callees know where to write. */
|
||||
phdr->p_offset = grub_host_to_target32 (ALIGN_UP (grub_util_get_fp_size (out),
|
||||
sizeof (long)));
|
||||
GRUB_TARGET_SIZEOF_LONG));
|
||||
|
||||
load_note (phdr, out);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue