efi: x86: Adjust EFI files support efi_loader
authorSimon Glass <sjg@chromium.org>
Mon, 7 Nov 2016 15:47:15 +0000 (08:47 -0700)
committerAlexander Graf <agraf@suse.de>
Mon, 14 Nov 2016 22:24:04 +0000 (23:24 +0100)
Add compiler flags and make a few minor adjustments to support the efi
loader.

Signed-off-by: Simon Glass <sjg@chromium.org>
[agraf: Add Kconfig dep]
Signed-off-by: Alexander Graf <agraf@suse.de>
arch/x86/config.mk
arch/x86/lib/Makefile
arch/x86/lib/elf_ia32_efi.lds
arch/x86/lib/elf_x86_64_efi.lds
cmd/Kconfig

index 12a8d73f87f78a6ad508d525b392cd3439e4da19..03c71f7baeca6d8a7ba0119728d65683a2bcdf0f 100644 (file)
@@ -65,3 +65,19 @@ PLATFORM_LDFLAGS += --emit-relocs
 LDFLAGS_FINAL += --gc-sections -pie
 
 endif
+
+ifneq ($(CONFIG_EFI_STUB)$(CONFIG_CMD_BOOTEFI_HELLO),)
+
+ifneq ($(CONFIG_EFI_STUB_64BIT),)
+EFI_LDS := elf_x86_64_efi.lds
+EFI_CRT0 := crt0_x86_64_efi.o
+EFI_RELOC := reloc_x86_64_efi.o
+EFI_TARGET := --target=efi-app-ia32
+else
+EFI_LDS := elf_ia32_efi.lds
+EFI_CRT0 := crt0_ia32_efi.o
+EFI_RELOC := reloc_ia32_efi.o
+EFI_TARGET := --target=efi-app-x86_64
+endif
+
+endif
index aad6555a713fd5e0f2d242d390d93c26002775ed..ff402dc578a5ff4fde58a6b1da16ecbd1dfab348 100644 (file)
@@ -61,4 +61,9 @@ AFLAGS_crt0_x86_64_efi.o += -fpic -fshort-wchar
 
 extra-$(CONFIG_EFI_STUB_32BIT) += crt0_ia32_efi.o reloc_ia32_efi.o
 extra-$(CONFIG_EFI_STUB_64BIT) += crt0_x86_64_efi.o reloc_x86_64_efi.o
+
+endif
+
+ifneq ($(CONFIG_EFI_STUB)$(CONFIG_CMD_BOOTEFI_HELLO),)
+extra-y += $(EFI_CRT0) $(EFI_RELOC)
 endif
index cd3b0a982dac85dcd15634f6c95e5b284898521f..174d36f758e3731bf851785480d3e9d8dc14ca9e 100644 (file)
@@ -6,8 +6,6 @@
  * Modified from usr/lib32/elf_ia32_efi.lds in gnu-efi
  */
 
-#include <config.h>
-
 OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
 OUTPUT_ARCH(i386)
 ENTRY(_start)
index 9d9f05774a929a3eb31b437d9d3f8f4efa7feed5..70c7c52332888b6460e95e767813c11a756b7eaa 100644 (file)
@@ -6,8 +6,6 @@
  * Modified from usr/lib32/elf_x86_64_efi.lds in gnu-efi
  */
 
-#include <config.h>
-
 OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64")
 OUTPUT_ARCH(i386:x86-64)
 ENTRY(_start)
index 501ac17d2c27cbaade23e2f43da9236e60b560b4..2a2f23e2518bcb4a185cbed8697513a776bd3bb4 100644 (file)
@@ -183,7 +183,7 @@ config CMD_BOOTEFI
 
 config CMD_BOOTEFI_HELLO
        bool "Allow booting a standard EFI hello world for testing"
-       depends on CMD_BOOTEFI && ARM
+       depends on CMD_BOOTEFI && (ARM || X86)
        help
          This adds a standard EFI hello world application to U-Boot so that
          it can be used with the 'bootefi hello' command. This is useful