[PATCH v3 13/13] ARM: add UEFI stub support
From: Matt Fleming <hidden>
Date: 2015-11-26 10:47:14
Also in:
linux-efi, linux-mm
On Mon, 23 Nov, at 10:06:33AM, Ard Biesheuvel wrote:
From: Roy Franz <redacted> This patch adds EFI stub support for the ARM Linux kernel. The EFI stub operates similarly to the x86 and arm64 stubs: it is a shim between the EFI firmware and the normal zImage entry point, and sets up the environment that the zImage is expecting. This includes optionally loading the initrd and device tree from the system partition based on the kernel command line. Signed-off-by: Roy Franz <redacted> Signed-off-by: Ard Biesheuvel <redacted> --- arch/arm/Kconfig | 19 +++ arch/arm/boot/compressed/Makefile | 4 +- arch/arm/boot/compressed/efi-header.S | 130 ++++++++++++++++++++ arch/arm/boot/compressed/head.S | 54 +++++++- arch/arm/boot/compressed/vmlinux.lds.S | 7 ++ arch/arm/include/asm/efi.h | 23 ++++ drivers/firmware/efi/libstub/Makefile | 9 ++ drivers/firmware/efi/libstub/arm-stub.c | 4 +- drivers/firmware/efi/libstub/arm32-stub.c | 85 +++++++++++++ 9 files changed, 331 insertions(+), 4 deletions(-)
[...]
+
+ /*
+ * Relocate the zImage, if required. ARM doesn't have a
+ * preferred address, so we set it to 0, as we want to allocate
+ * as low in memory as possible.
+ */
+ *image_size = image->image_size;
+ status = efi_relocate_kernel(sys_table, image_addr, *image_size,
+ *image_size, 0, 0);
+ if (status != EFI_SUCCESS) {
+ pr_efi_err(sys_table, "Failed to relocate kernel.\n");
+ efi_free(sys_table, *reserve_size, *reserve_addr);
+ *reserve_size = 0;
+ return status;
+ }If efi_relocate_kernel() successfully allocates memory at address 0x0, is that going to cause issues with NULL pointer checking?