efi_loader: fix SectionAlignment, FileAlignment
The alignment of sections in the EFI binaries generated by U-Boot is
incorrect.
According to the PE-COFF specification [1] the minimum value for
FileAlignment is 512. If the value of SectionAlignment is
less then the page size, it must equal FileAlignment.
Let's set both values to 512 for the ARM and RISC-V architectures.
[1] https://docs.microsoft.com/en-us/windows/win32/debug/pe-format
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
diff --git a/arch/riscv/lib/crt0_riscv_efi.S b/arch/riscv/lib/crt0_riscv_efi.S
index 3e62e8e..a01e08a 100644
--- a/arch/riscv/lib/crt0_riscv_efi.S
+++ b/arch/riscv/lib/crt0_riscv_efi.S
@@ -71,8 +71,8 @@
#else
.quad 0 /* ImageBase */
#endif
- .long 0x20 /* SectionAlignment */
- .long 0x8 /* FileAlignment */
+ .long 0x200 /* SectionAlignment */
+ .long 0x200 /* FileAlignment */
.short 0 /* MajorOperatingSystemVersion */
.short 0 /* MinorOperatingSystemVersion */
.short 1 /* MajorImageVersion */
@@ -148,6 +148,7 @@
.short 0 /* NumberOfLineNumbers (0 for executables) */
.long 0xe0500020 /* Characteristics (section flags) */
+ .align 9
_start:
addi sp, sp, -(SIZE_LONG * 3)
SAVE_LONG(a0, 0)