]> git.ipfire.org Git - thirdparty/ipxe.git/commit
[efi] Remove redundant zero padding in PE header
authorMichael Brown <mcb30@ipxe.org>
Wed, 5 Apr 2023 12:41:53 +0000 (13:41 +0100)
committerMichael Brown <mcb30@ipxe.org>
Mon, 10 Apr 2023 15:50:10 +0000 (16:50 +0100)
commit0d04635ef0e4fa0850716c03163e120c63125df7
tree31f7bbe3e7566e21688d7400a42ce8f649d3fc48
parent1d1cf74a5e58811822bee4b3da3cff7282fcdfca
[efi] Remove redundant zero padding in PE header

Hybrid bzImage and UEFI binaries (such as wimboot) require the PE
header to be kept as small as possible, since the bzImage header
starts at a fixed offset 0x1f1.

The PE header currently includes 128 bytes of zero padding between the
DOS and NT header portions.  This padding has been present since
commit 81d92c6 ("[efi] Add EFI image format and basic runtime
environment") first added support for EFI images in iPXE, and was
included on the basis of matching the observed behaviour of the
Microsoft toolchain.  There appears to be no requirement for this
padding to exist: EDK2 binaries built with gcc include only 64 bytes
of zero padding, Linux kernel binaries include 66 bytes of non-zero
padding, and wimboot binaries include no padding at all.

Remove the unnecessary padding between the DOS and NT header portions
to minimise the overall size of the PE header.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/util/elf2efi.c