2010-02-13 Vladimir Serbinenko <phcoder@gmail.com>
Properly create cross-endian images. * include/grub/types.h (grub_host_to_target_addr): New macro * util/grub-mkrawimage.c (generate_image): Add missing host_to_target.
This commit is contained in:
parent
82da2062d8
commit
b274d734f3
3 changed files with 20 additions and 7 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
2010-02-13 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
Properly create cross-endian images.
|
||||||
|
|
||||||
|
* include/grub/types.h (grub_host_to_target_addr): New macro
|
||||||
|
* util/grub-mkrawimage.c (generate_image): Add missing host_to_target.
|
||||||
|
|
||||||
2010-02-13 Vladimir Serbinenko <phcoder@gmail.com>
|
2010-02-13 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
* util/grub-mkrawimage.c (generate_image): Add forgotten ALIGN_UP.
|
* util/grub-mkrawimage.c (generate_image): Add forgotten ALIGN_UP.
|
||||||
|
|
|
@ -223,4 +223,10 @@ static inline grub_uint64_t grub_swap_bytes64(grub_uint64_t x)
|
||||||
# endif
|
# endif
|
||||||
#endif /* ! WORDS_BIGENDIAN */
|
#endif /* ! WORDS_BIGENDIAN */
|
||||||
|
|
||||||
|
#if GRUB_TARGET_SIZEOF_VOID_P == 8
|
||||||
|
# define grub_host_to_target_addr(x) grub_host_to_target64(x)
|
||||||
|
#else
|
||||||
|
# define grub_host_to_target_addr(x) grub_host_to_target32(x)
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* ! GRUB_TYPES_HEADER */
|
#endif /* ! GRUB_TYPES_HEADER */
|
||||||
|
|
|
@ -157,9 +157,9 @@ generate_image (const char *dir, char *prefix, FILE *out, char *mods[],
|
||||||
/* Fill in the grub_module_info structure. */
|
/* Fill in the grub_module_info structure. */
|
||||||
modinfo = (struct grub_module_info *) (kernel_img + kernel_size);
|
modinfo = (struct grub_module_info *) (kernel_img + kernel_size);
|
||||||
memset (modinfo, 0, sizeof (struct grub_module_info));
|
memset (modinfo, 0, sizeof (struct grub_module_info));
|
||||||
modinfo->magic = GRUB_MODULE_MAGIC;
|
modinfo->magic = grub_host_to_target32 (GRUB_MODULE_MAGIC);
|
||||||
modinfo->offset = sizeof (struct grub_module_info);
|
modinfo->offset = grub_host_to_target_addr (sizeof (struct grub_module_info));
|
||||||
modinfo->size = total_module_size;
|
modinfo->size = grub_host_to_target_addr (total_module_size);
|
||||||
|
|
||||||
offset = kernel_size + sizeof (struct grub_module_info);
|
offset = kernel_size + sizeof (struct grub_module_info);
|
||||||
for (p = path_list; p; p = p->next)
|
for (p = path_list; p; p = p->next)
|
||||||
|
@ -172,7 +172,7 @@ generate_image (const char *dir, char *prefix, FILE *out, char *mods[],
|
||||||
|
|
||||||
header = (struct grub_module_header *) (kernel_img + offset);
|
header = (struct grub_module_header *) (kernel_img + offset);
|
||||||
memset (header, 0, sizeof (struct grub_module_header));
|
memset (header, 0, sizeof (struct grub_module_header));
|
||||||
header->type = OBJ_TYPE_ELF;
|
header->type = grub_host_to_target32 (OBJ_TYPE_ELF);
|
||||||
header->size = grub_host_to_target32 (mod_size + sizeof (*header));
|
header->size = grub_host_to_target32 (mod_size + sizeof (*header));
|
||||||
offset += sizeof (*header);
|
offset += sizeof (*header);
|
||||||
memset (kernel_img + offset + orig_size, 0, mod_size - orig_size);
|
memset (kernel_img + offset + orig_size, 0, mod_size - orig_size);
|
||||||
|
@ -187,7 +187,7 @@ generate_image (const char *dir, char *prefix, FILE *out, char *mods[],
|
||||||
|
|
||||||
header = (struct grub_module_header *) (kernel_img + offset);
|
header = (struct grub_module_header *) (kernel_img + offset);
|
||||||
memset (header, 0, sizeof (struct grub_module_header));
|
memset (header, 0, sizeof (struct grub_module_header));
|
||||||
header->type = OBJ_TYPE_MEMDISK;
|
header->type = grub_host_to_target32 (OBJ_TYPE_MEMDISK);
|
||||||
header->size = grub_host_to_target32 (memdisk_size + sizeof (*header));
|
header->size = grub_host_to_target32 (memdisk_size + sizeof (*header));
|
||||||
offset += sizeof (*header);
|
offset += sizeof (*header);
|
||||||
|
|
||||||
|
@ -201,7 +201,7 @@ generate_image (const char *dir, char *prefix, FILE *out, char *mods[],
|
||||||
|
|
||||||
header = (struct grub_module_header *) (kernel_img + offset);
|
header = (struct grub_module_header *) (kernel_img + offset);
|
||||||
memset (header, 0, sizeof (struct grub_module_header));
|
memset (header, 0, sizeof (struct grub_module_header));
|
||||||
header->type = OBJ_TYPE_FONT;
|
header->type = grub_host_to_target32 (OBJ_TYPE_FONT);
|
||||||
header->size = grub_host_to_target32 (font_size + sizeof (*header));
|
header->size = grub_host_to_target32 (font_size + sizeof (*header));
|
||||||
offset += sizeof (*header);
|
offset += sizeof (*header);
|
||||||
|
|
||||||
|
@ -215,7 +215,7 @@ generate_image (const char *dir, char *prefix, FILE *out, char *mods[],
|
||||||
|
|
||||||
header = (struct grub_module_header *) (kernel_img + offset);
|
header = (struct grub_module_header *) (kernel_img + offset);
|
||||||
memset (header, 0, sizeof (struct grub_module_header));
|
memset (header, 0, sizeof (struct grub_module_header));
|
||||||
header->type = OBJ_TYPE_CONFIG;
|
header->type = grub_host_to_target32 (OBJ_TYPE_CONFIG);
|
||||||
header->size = grub_host_to_target32 (config_size + sizeof (*header));
|
header->size = grub_host_to_target32 (config_size + sizeof (*header));
|
||||||
offset += sizeof (*header);
|
offset += sizeof (*header);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue