On Sat, 2014-06-28 at 02:25 +0100, Roy Franz wrote:
This patch adds a simple PE/COFF header in head.S. PE/COFF linker support is not available for arm64, so a native build is not possible. Also, this allows the binary to be both a PE/COFF EFI application, and a normal Image file bootable like a Linux kernel. The arm and arm64 Linux kernels use the same methodology to create a single image that is both an EFI application and a zImage/Image file.
This looks good to me. A few minor comments:
Some of the whitespace is off (please use space and not hard tabs throughout)
I think we could perhaps get rid of CONFIG_EFI_STUB at least at the arm64 subarch level. We don't in general support the same level of configurability in Xen as Linux -- it's mostly just a single configuration for everyone. It'd need to be retain at the arch level to cope with arm32 not doing efi, but removing it here would make things simpler I think?
Would it be possible to find sort of link/reference to a spec for the header structs which you are adding and stick them in comments before each one please.
Signed-off-by: Roy Franz roy.franz@linaro.org
xen/arch/arm/arm64/head.S | 118 +++++++++++++++++++++++++++++++++++++++++++++- xen/arch/arm/xen.lds.S | 1 + 2 files changed, 117 insertions(+), 2 deletions(-)
diff --git a/xen/arch/arm/arm64/head.S b/xen/arch/arm/arm64/head.S index 2a13527..9b88aeb 100644 --- a/xen/arch/arm/arm64/head.S +++ b/xen/arch/arm/arm64/head.S @@ -84,7 +84,7 @@ #endif /* !CONFIG_EARLY_PRINTK */ /*.aarch64*/
+#define CONFIG_EFI_STUB /* * Kernel startup entry point. * --------------------------- @@ -100,12 +100,24 @@ */ .global start +efi_stub_entry: /* Dummy symbol so we can compile before actual stub added */ start: +#ifdef CONFIG_EFI_STUB /* * DO NOT MODIFY. Image header expected by Linux boot-loaders. */
b real_start /* branch to kernel start, magic */
+efi_head:
/*
* This add instruction has no meaningful effect except that
* its opcode forms the magic "MZ" signature of a PE/COFF file
* that is required for UEFI applications.
*/
add x13, x18, #0x16
I love this hack ;-)
Ian.