2009-09-24 Pavel Roskin <proski@gnu.org>

* include/grub/kernel.h (struct grub_module_header): Remove
        `grub_module_header_types'.  Make `type' unsigned.  Make `size'
        32-bit on all platforms.
        * util/elf/grub-mkimage.c (load_modules): Treat `type' as an
        8-bit field.  Use grub_host_to_target32() for `size'.
        * util/i386/efi/grub-mkimage.c (make_mods_section): Likewise.
        * util/i386/pc/grub-mkimage.c (generate_image): Likewise.
        * util/sparc64/ieee1275/grub-mkimage.c (generate_image): Likewise.
This commit is contained in:
robertmh 2009-09-24 13:40:40 +00:00
parent 4e5a02a7ba
commit 6b9b6276d4
6 changed files with 35 additions and 24 deletions

View file

@ -1,3 +1,14 @@
2009-09-24 Pavel Roskin <proski@gnu.org>
* include/grub/kernel.h (struct grub_module_header): Remove
`grub_module_header_types'. Make `type' unsigned. Make `size'
32-bit on all platforms.
* util/elf/grub-mkimage.c (load_modules): Treat `type' as an
8-bit field. Use grub_host_to_target32() for `size'.
* util/i386/efi/grub-mkimage.c (make_mods_section): Likewise.
* util/i386/pc/grub-mkimage.c (generate_image): Likewise.
* util/sparc64/ieee1275/grub-mkimage.c (generate_image): Likewise.
2009-09-24 Robert Millan <rmh.grub@aybabtu.com>
Fix "lost keypress" bug in at_keyboard.

View file

@ -22,20 +22,20 @@
#include <grub/types.h>
#include <grub/symbol.h>
enum
{
OBJ_TYPE_ELF,
OBJ_TYPE_MEMDISK,
OBJ_TYPE_CONFIG
};
/* The module header. */
struct grub_module_header
{
/* The type of object. */
grub_int8_t type;
enum
{
OBJ_TYPE_ELF,
OBJ_TYPE_MEMDISK,
OBJ_TYPE_CONFIG
} grub_module_header_types;
grub_uint8_t type;
/* The size of object (including this header). */
grub_target_size_t size;
grub_uint32_t size;
};
/* "gmim" (GRUB Module Info Magic). */

View file

@ -144,7 +144,7 @@ load_modules (grub_addr_t modbase, Elf32_Phdr *phdr, const char *dir,
mod_size = grub_util_get_image_size (p->name);
header = (struct grub_module_header *) (module_img + offset);
header->type = grub_host_to_target32 (OBJ_TYPE_ELF);
header->type = OBJ_TYPE_ELF;
header->size = grub_host_to_target32 (mod_size + sizeof (*header));
grub_util_load_image (p->name, module_img + offset + sizeof (*header));
@ -157,8 +157,8 @@ load_modules (grub_addr_t modbase, Elf32_Phdr *phdr, const char *dir,
struct grub_module_header *header;
header = (struct grub_module_header *) (module_img + offset);
header->type = grub_cpu_to_le32 (OBJ_TYPE_MEMDISK);
header->size = grub_cpu_to_le32 (memdisk_size + sizeof (*header));
header->type = OBJ_TYPE_MEMDISK;
header->size = grub_host_to_target32 (memdisk_size + sizeof (*header));
offset += sizeof (*header);
grub_util_load_image (memdisk_path, module_img + offset);

View file

@ -683,8 +683,8 @@ make_mods_section (FILE *out, Elf_Addr current_address,
grub_util_info ("adding module %s", p->name);
mod_size = grub_util_get_image_size (p->name);
header.type = grub_cpu_to_le32 (OBJ_TYPE_ELF);
header.size = grub_cpu_to_le32 (mod_size + sizeof (header));
header.type = OBJ_TYPE_ELF;
header.size = grub_host_to_target32 (mod_size + sizeof (header));
mod_image = grub_util_read_image (p->name);

View file

@ -152,8 +152,8 @@ generate_image (const char *dir, char *prefix, FILE *out, char *mods[],
header = (struct grub_module_header *) (kernel_img + offset);
memset (header, 0, sizeof (struct grub_module_header));
header->type = grub_cpu_to_le32 (OBJ_TYPE_ELF);
header->size = grub_cpu_to_le32 (mod_size + sizeof (*header));
header->type = OBJ_TYPE_ELF;
header->size = grub_host_to_target32 (mod_size + sizeof (*header));
offset += sizeof (*header);
grub_util_load_image (p->name, kernel_img + offset);
@ -166,8 +166,8 @@ generate_image (const char *dir, char *prefix, FILE *out, char *mods[],
header = (struct grub_module_header *) (kernel_img + offset);
memset (header, 0, sizeof (struct grub_module_header));
header->type = grub_cpu_to_le32 (OBJ_TYPE_MEMDISK);
header->size = grub_cpu_to_le32 (memdisk_size + sizeof (*header));
header->type = OBJ_TYPE_MEMDISK;
header->size = grub_host_to_target32 (memdisk_size + sizeof (*header));
offset += sizeof (*header);
grub_util_load_image (memdisk_path, kernel_img + offset);
@ -180,8 +180,8 @@ generate_image (const char *dir, char *prefix, FILE *out, char *mods[],
header = (struct grub_module_header *) (kernel_img + offset);
memset (header, 0, sizeof (struct grub_module_header));
header->type = grub_cpu_to_le32 (OBJ_TYPE_CONFIG);
header->size = grub_cpu_to_le32 (config_size + sizeof (*header));
header->type = OBJ_TYPE_CONFIG;
header->size = grub_host_to_target32 (config_size + sizeof (*header));
offset += sizeof (*header);
grub_util_load_image (config_path, kernel_img + offset);

View file

@ -98,8 +98,8 @@ generate_image (const char *dir, const char *prefix, FILE *out, char *mods[], ch
mod_size = grub_util_get_image_size (p->name);
header = (struct grub_module_header *) (kernel_img + offset);
header->type = grub_cpu_to_be32 (OBJ_TYPE_ELF);
header->size = grub_cpu_to_be32 (mod_size + sizeof (*header));
header->type = OBJ_TYPE_ELF;
header->size = grub_host_to_target32 (mod_size + sizeof (*header));
offset += sizeof (*header);
grub_util_load_image (p->name, kernel_img + offset);
@ -111,8 +111,8 @@ generate_image (const char *dir, const char *prefix, FILE *out, char *mods[], ch
struct grub_module_header *header;
header = (struct grub_module_header *) (kernel_img + offset);
header->type = grub_cpu_to_be32 (OBJ_TYPE_MEMDISK);
header->size = grub_cpu_to_be32 (memdisk_size + sizeof (*header));
header->type = OBJ_TYPE_MEMDISK;
header->size = grub_host_to_target32 (memdisk_size + sizeof (*header));
offset += sizeof (*header);
grub_util_load_image (memdisk_path, kernel_img + offset);