diff -up kexec-tools-testing-20070330/makedumpfile/makedumpfile.c.orig kexec-tools-testing-20070330/makedumpfile/makedumpfile.c --- kexec-tools-testing-20070330/makedumpfile/makedumpfile.c.orig 2008-02-27 11:48:34.000000000 -0500 +++ kexec-tools-testing-20070330/makedumpfile/makedumpfile.c 2008-02-27 12:24:53.000000000 -0500 @@ -5797,12 +5797,22 @@ handle_xen() if (!create_dump_bitmap_xen()) goto out; + if (info->flag_flatten) { + if (!write_start_flat_header()) + goto out; + } + if (!write_elf_header()) goto out; if (!write_elf_pages()) goto out; + if (info->flag_flatten) { + if (!write_end_flat_header()) + goto out; + } + if (!close_files_for_creating_dumpfile()) goto out;