Pad image to 512K for flashrom

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2010-05-31 08:24:33 +02:00
parent 7eaef0ed51
commit 8148171e96

View file

@ -1015,7 +1015,7 @@ generate_image (const char *dir, char *prefix, FILE *out, char *mods[],
boot_size = grub_util_get_image_size (boot_path); boot_size = grub_util_get_image_size (boot_path);
boot_img = grub_util_read_image (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); rom_img = xmalloc (rom_size);
memset (rom_img, 0, rom_size); memset (rom_img, 0, rom_size);
@ -1024,6 +1024,9 @@ generate_image (const char *dir, char *prefix, FILE *out, char *mods[],
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); free (core_img);
core_img = rom_img; core_img = rom_img;
core_size = rom_size; core_size = rom_size;