diff --git a/ChangeLog b/ChangeLog index e3eee32c4..d7c458d15 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-12-15 Vladimir Serbinenko + + * util/grub-mkimage.c (generate_image): Clean multiboot header to avoid + confusing ipxe. + 2011-12-15 Vladimir Serbinenko * grub-core/lib/libgcrypt/cipher/md4.c (transform) [WORDS_BIGENDIAN]: diff --git a/util/grub-mkimage.c b/util/grub-mkimage.c index de43c4493..ca8047df6 100644 --- a/util/grub-mkimage.c +++ b/util/grub-mkimage.c @@ -32,6 +32,7 @@ #include #include #include +#include #include #include @@ -971,6 +972,7 @@ generate_image (const char *dir, char *prefix, FILE *out, char *mods[], { char *pxeboot_path, *pxeboot_img; size_t pxeboot_size; + grub_uint32_t *ptr; pxeboot_path = grub_util_get_path (dir, "pxeboot.img"); pxeboot_size = grub_util_get_image_size (pxeboot_path); @@ -979,6 +981,18 @@ generate_image (const char *dir, char *prefix, FILE *out, char *mods[], grub_util_write_image (pxeboot_img, pxeboot_size, out); free (pxeboot_img); free (pxeboot_path); + + /* Remove Multiboot header to avoid confusing ipxe. */ + for (ptr = (grub_uint32_t *) core_img; + ptr < (grub_uint32_t *) (core_img + MULTIBOOT_SEARCH); ptr++) + if (*ptr == grub_host_to_target32 (MULTIBOOT_HEADER_MAGIC) + && grub_target_to_host32 (ptr[0]) + + grub_target_to_host32 (ptr[1]) + + grub_target_to_host32 (ptr[2]) == 0) + { + *ptr = 0; + break; + } } boot_path = grub_util_get_path (dir, "diskboot.img");