From: Vladimir 'phcoder' Serbinenko Date: Mon, 31 May 2010 06:24:33 +0000 (+0200) Subject: Pad image to 512K for flashrom X-Git-Tag: 1.99~780^2~3 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8148171e96f291ad36b1d58e2332d41552f73992;p=thirdparty%2Fgrub.git Pad image to 512K for flashrom --- diff --git a/util/grub-mkimage.c b/util/grub-mkimage.c index bb4a9b2eb..dc9dcc208 100644 --- a/util/grub-mkimage.c +++ b/util/grub-mkimage.c @@ -1015,14 +1015,17 @@ generate_image (const char *dir, char *prefix, FILE *out, char *mods[], boot_size = grub_util_get_image_size (boot_path); boot_img = grub_util_read_image (boot_path); - rom_size = core_size + boot_size; + rom_size = ALIGN_UP (core_size + boot_size, 512 * 1024); rom_img = xmalloc (rom_size); memset (rom_img, 0, rom_size); memcpy (rom_img, boot_img, boot_size); - memcpy (rom_img + boot_size, core_img, core_size); + memcpy (rom_img + boot_size, core_img, core_size); + + memset (rom_img + boot_size + core_size, 0, + rom_size - (boot_size + core_size)); free (core_img); core_img = rom_img;