diff --git a/ChangeLog b/ChangeLog index b5315fa70..797b50874 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-09-24 Robert Millan + + * util/i386/pc/grub-mkimage.c (generate_image): Enclose BIOS-specific + size check within GRUB_MACHINE_PCBIOS section. + 2009-09-24 Robert Millan * include/grub/i386/at_keyboard.h (KEYBOARD_ISREADY): Negate diff --git a/util/i386/pc/grub-mkimage.c b/util/i386/pc/grub-mkimage.c index b81392ce8..c8fe02e13 100644 --- a/util/i386/pc/grub-mkimage.c +++ b/util/i386/pc/grub-mkimage.c @@ -97,7 +97,6 @@ generate_image (const char *dir, char *prefix, FILE *out, char *mods[], size_t kernel_size, boot_size, total_module_size, core_size; size_t memdisk_size = 0, config_size = 0; char *kernel_path, *boot_path; - unsigned num; size_t offset; struct grub_util_path_list *path_list, *p, *next; struct grub_module_info *modinfo; @@ -196,30 +195,30 @@ generate_image (const char *dir, char *prefix, FILE *out, char *mods[], grub_util_info ("the core size is 0x%x", core_size); - num = ((core_size + GRUB_DISK_SECTOR_SIZE - 1) >> GRUB_DISK_SECTOR_BITS); - if (num > 0xffff) - grub_util_error ("the core image is too big"); - #if defined(GRUB_MACHINE_PCBIOS) - - boot_path = grub_util_get_path (dir, "diskboot.img"); - boot_size = grub_util_get_image_size (boot_path); - if (boot_size != GRUB_DISK_SECTOR_SIZE) - grub_util_error ("diskboot.img is not one sector size"); - - boot_img = grub_util_read_image (boot_path); - - /* i386 is a little endian architecture. */ - *((grub_uint16_t *) (boot_img + GRUB_DISK_SECTOR_SIZE - - GRUB_BOOT_MACHINE_LIST_SIZE + 8)) - = grub_cpu_to_le16 (num); - - grub_util_write_image (boot_img, boot_size, out); - free (boot_img); - free (boot_path); - + { + unsigned num; + num = ((core_size + GRUB_DISK_SECTOR_SIZE - 1) >> GRUB_DISK_SECTOR_BITS); + if (num > 0xffff) + grub_util_error ("the core image is too big"); + + boot_path = grub_util_get_path (dir, "diskboot.img"); + boot_size = grub_util_get_image_size (boot_path); + if (boot_size != GRUB_DISK_SECTOR_SIZE) + grub_util_error ("diskboot.img is not one sector size"); + + boot_img = grub_util_read_image (boot_path); + + /* i386 is a little endian architecture. */ + *((grub_uint16_t *) (boot_img + GRUB_DISK_SECTOR_SIZE + - GRUB_BOOT_MACHINE_LIST_SIZE + 8)) + = grub_cpu_to_le16 (num); + + grub_util_write_image (boot_img, boot_size, out); + free (boot_img); + free (boot_path); + } #elif defined(GRUB_MACHINE_QEMU) - { char *rom_img; size_t rom_size;