x86/efi: Request desired alignment via the PE/COFF headers
authorMichael Brown <mbrown@fensystems.co.uk>
Thu, 10 Jul 2014 15:59:23 +0000 (16:59 +0100)
committerMatt Fleming <matt.fleming@intel.com>
Fri, 18 Jul 2014 20:24:02 +0000 (21:24 +0100)
The EFI boot stub goes to great pains to relocate the kernel image to
an appropriately aligned address, as indicated by the ->kernel_alignment
field in the bzImage header.  However, for the PE stub entry case, we
can request that the EFI PE/COFF loader do the work for us.

Fix by exposing the desired alignment via the SectionAlignment field
in the PE/COFF headers.  Despite its name, this field provides an
overall alignment requirement for the loaded file.  (Naturally, the
FileAlignment field describes the alignment for individual sections.)

There is no way in the PE/COFF headers to express the concept of
min_alignment; we therefore do not expose the minimum (as opposed to
preferred) alignment.

Signed-off-by: Michael Brown <mbrown@fensystems.co.uk>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
arch/x86/boot/header.S

index 84c223479e3c9b9e3aa64ad25d4f633909f497dd..1fdb350c4a58e9c0c385dbb4b00be4c2064132f9 100644 (file)
@@ -155,7 +155,7 @@ extra_header_fields:
 #else
        .quad   0                               # ImageBase
 #endif
-       .long   0x20                            # SectionAlignment
+       .long   CONFIG_PHYSICAL_ALIGN           # SectionAlignment
        .long   0x20                            # FileAlignment
        .word   0                               # MajorOperatingSystemVersion
        .word   0                               # MinorOperatingSystemVersion