aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorArd Biesheuvel <ard.biesheuvel@linaro.org>2014-07-02 08:54:43 -0400
committerMatt Fleming <matt.fleming@intel.com>2014-07-18 16:22:19 -0400
commitf4f75ad5741fe0331bbe1f5c42b906cda299f26b (patch)
tree0f06f0b7ecc94bc930a952dd79763adc94b34fda /arch
parentbd669475d14e3279a7f96ed917a82df5da6ad52d (diff)
efi: efistub: Convert into static library
This patch changes both x86 and arm64 efistub implementations from #including shared .c files under drivers/firmware/efi to building shared code as a static library. The x86 code uses a stub built into the boot executable which uncompresses the kernel at boot time. In this case, the library is linked into the decompressor. In the arm64 case, the stub is part of the kernel proper so the library is linked into the kernel proper as well. Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm64/Kconfig5
-rw-r--r--arch/arm64/Makefile1
-rw-r--r--arch/arm64/kernel/Makefile3
-rw-r--r--arch/arm64/kernel/efi-stub.c6
-rw-r--r--arch/x86/boot/compressed/Makefile3
-rw-r--r--arch/x86/boot/compressed/eboot.c2
6 files changed, 9 insertions, 11 deletions
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 2cc14cef01bd..3a0a4ce4c751 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -292,6 +292,9 @@ config CMDLINE_FORCE
292 This is useful if you cannot or don't want to change the 292 This is useful if you cannot or don't want to change the
293 command-line options your boot loader passes to the kernel. 293 command-line options your boot loader passes to the kernel.
294 294
295config EFI_STUB
296 bool
297
295config EFI 298config EFI
296 bool "UEFI runtime support" 299 bool "UEFI runtime support"
297 depends on OF && !CPU_BIG_ENDIAN 300 depends on OF && !CPU_BIG_ENDIAN
@@ -299,6 +302,8 @@ config EFI
299 select UCS2_STRING 302 select UCS2_STRING
300 select EFI_PARAMS_FROM_FDT 303 select EFI_PARAMS_FROM_FDT
301 select EFI_RUNTIME_WRAPPERS 304 select EFI_RUNTIME_WRAPPERS
305 select EFI_STUB
306 select EFI_ARMSTUB
302 default y 307 default y
303 help 308 help
304 This option provides support for runtime services provided 309 This option provides support for runtime services provided
diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
index 8185a913c5ed..5836717d2f66 100644
--- a/arch/arm64/Makefile
+++ b/arch/arm64/Makefile
@@ -48,6 +48,7 @@ core-$(CONFIG_XEN) += arch/arm64/xen/
48core-$(CONFIG_CRYPTO) += arch/arm64/crypto/ 48core-$(CONFIG_CRYPTO) += arch/arm64/crypto/
49libs-y := arch/arm64/lib/ $(libs-y) 49libs-y := arch/arm64/lib/ $(libs-y)
50libs-y += $(LIBGCC) 50libs-y += $(LIBGCC)
51libs-$(CONFIG_EFI_STUB) += drivers/firmware/efi/libstub/
51 52
52# Default target when executing plain make 53# Default target when executing plain make
53KBUILD_IMAGE := Image.gz 54KBUILD_IMAGE := Image.gz
diff --git a/arch/arm64/kernel/Makefile b/arch/arm64/kernel/Makefile
index cdaedad3afe5..afaeb734295a 100644
--- a/arch/arm64/kernel/Makefile
+++ b/arch/arm64/kernel/Makefile
@@ -4,8 +4,7 @@
4 4
5CPPFLAGS_vmlinux.lds := -DTEXT_OFFSET=$(TEXT_OFFSET) 5CPPFLAGS_vmlinux.lds := -DTEXT_OFFSET=$(TEXT_OFFSET)
6AFLAGS_head.o := -DTEXT_OFFSET=$(TEXT_OFFSET) 6AFLAGS_head.o := -DTEXT_OFFSET=$(TEXT_OFFSET)
7CFLAGS_efi-stub.o := -DTEXT_OFFSET=$(TEXT_OFFSET) \ 7CFLAGS_efi-stub.o := -DTEXT_OFFSET=$(TEXT_OFFSET)
8 -I$(src)/../../../scripts/dtc/libfdt
9 8
10CFLAGS_REMOVE_ftrace.o = -pg 9CFLAGS_REMOVE_ftrace.o = -pg
11CFLAGS_REMOVE_insn.o = -pg 10CFLAGS_REMOVE_insn.o = -pg
diff --git a/arch/arm64/kernel/efi-stub.c b/arch/arm64/kernel/efi-stub.c
index e4999021b07d..1317fef8dde9 100644
--- a/arch/arm64/kernel/efi-stub.c
+++ b/arch/arm64/kernel/efi-stub.c
@@ -13,12 +13,6 @@
13#include <asm/efi.h> 13#include <asm/efi.h>
14#include <asm/sections.h> 14#include <asm/sections.h>
15 15
16/* Include shared EFI stub code */
17#include "../../../drivers/firmware/efi/efi-stub-helper.c"
18#include "../../../drivers/firmware/efi/fdt.c"
19#include "../../../drivers/firmware/efi/arm-stub.c"
20
21
22efi_status_t handle_kernel_image(efi_system_table_t *sys_table, 16efi_status_t handle_kernel_image(efi_system_table_t *sys_table,
23 unsigned long *image_addr, 17 unsigned long *image_addr,
24 unsigned long *image_size, 18 unsigned long *image_size,
diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile
index 0fcd9133790c..7a801a310e37 100644
--- a/arch/x86/boot/compressed/Makefile
+++ b/arch/x86/boot/compressed/Makefile
@@ -33,7 +33,8 @@ VMLINUX_OBJS = $(obj)/vmlinux.lds $(obj)/head_$(BITS).o $(obj)/misc.o \
33$(obj)/eboot.o: KBUILD_CFLAGS += -fshort-wchar -mno-red-zone 33$(obj)/eboot.o: KBUILD_CFLAGS += -fshort-wchar -mno-red-zone
34 34
35ifeq ($(CONFIG_EFI_STUB), y) 35ifeq ($(CONFIG_EFI_STUB), y)
36 VMLINUX_OBJS += $(obj)/eboot.o $(obj)/efi_stub_$(BITS).o 36 VMLINUX_OBJS += $(obj)/eboot.o $(obj)/efi_stub_$(BITS).o \
37 $(objtree)/drivers/firmware/efi/libstub/lib.a
37endif 38endif
38 39
39$(obj)/vmlinux: $(VMLINUX_OBJS) FORCE 40$(obj)/vmlinux: $(VMLINUX_OBJS) FORCE
diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c
index 916bbdd7dd28..3b5c66c8f749 100644
--- a/arch/x86/boot/compressed/eboot.c
+++ b/arch/x86/boot/compressed/eboot.c
@@ -280,8 +280,6 @@ void efi_char16_printk(efi_system_table_t *table, efi_char16_t *str)
280 } 280 }
281} 281}
282 282
283#include "../../../../drivers/firmware/efi/efi-stub-helper.c"
284
285static void find_bits(unsigned long mask, u8 *pos, u8 *size) 283static void find_bits(unsigned long mask, u8 *pos, u8 *size)
286{ 284{
287 u8 first, len; 285 u8 first, len;