diff options
-rw-r--r-- | arch/arm64/Kconfig | 5 | ||||
-rw-r--r-- | arch/arm64/Makefile | 1 | ||||
-rw-r--r-- | arch/arm64/kernel/Makefile | 3 | ||||
-rw-r--r-- | arch/arm64/kernel/efi-stub.c | 6 | ||||
-rw-r--r-- | arch/x86/boot/compressed/Makefile | 3 | ||||
-rw-r--r-- | arch/x86/boot/compressed/eboot.c | 2 | ||||
-rw-r--r-- | drivers/firmware/efi/Kconfig | 3 | ||||
-rw-r--r-- | drivers/firmware/efi/Makefile | 1 | ||||
-rw-r--r-- | drivers/firmware/efi/libstub/Makefile | 26 | ||||
-rw-r--r-- | drivers/firmware/efi/libstub/arm-stub.c (renamed from drivers/firmware/efi/arm-stub.c) | 0 | ||||
-rw-r--r-- | drivers/firmware/efi/libstub/efi-stub-helper.c (renamed from drivers/firmware/efi/efi-stub-helper.c) | 0 | ||||
-rw-r--r-- | drivers/firmware/efi/libstub/efistub.h (renamed from drivers/firmware/efi/efistub.h) | 0 | ||||
-rw-r--r-- | drivers/firmware/efi/libstub/fdt.c (renamed from drivers/firmware/efi/fdt.c) | 0 |
13 files changed, 39 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 | ||
295 | config EFI_STUB | ||
296 | bool | ||
297 | |||
295 | config EFI | 298 | config 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/ | |||
48 | core-$(CONFIG_CRYPTO) += arch/arm64/crypto/ | 48 | core-$(CONFIG_CRYPTO) += arch/arm64/crypto/ |
49 | libs-y := arch/arm64/lib/ $(libs-y) | 49 | libs-y := arch/arm64/lib/ $(libs-y) |
50 | libs-y += $(LIBGCC) | 50 | libs-y += $(LIBGCC) |
51 | libs-$(CONFIG_EFI_STUB) += drivers/firmware/efi/libstub/ | ||
51 | 52 | ||
52 | # Default target when executing plain make | 53 | # Default target when executing plain make |
53 | KBUILD_IMAGE := Image.gz | 54 | KBUILD_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 | ||
5 | CPPFLAGS_vmlinux.lds := -DTEXT_OFFSET=$(TEXT_OFFSET) | 5 | CPPFLAGS_vmlinux.lds := -DTEXT_OFFSET=$(TEXT_OFFSET) |
6 | AFLAGS_head.o := -DTEXT_OFFSET=$(TEXT_OFFSET) | 6 | AFLAGS_head.o := -DTEXT_OFFSET=$(TEXT_OFFSET) |
7 | CFLAGS_efi-stub.o := -DTEXT_OFFSET=$(TEXT_OFFSET) \ | 7 | CFLAGS_efi-stub.o := -DTEXT_OFFSET=$(TEXT_OFFSET) |
8 | -I$(src)/../../../scripts/dtc/libfdt | ||
9 | 8 | ||
10 | CFLAGS_REMOVE_ftrace.o = -pg | 9 | CFLAGS_REMOVE_ftrace.o = -pg |
11 | CFLAGS_REMOVE_insn.o = -pg | 10 | CFLAGS_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 | |||
22 | efi_status_t handle_kernel_image(efi_system_table_t *sys_table, | 16 | efi_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 | ||
35 | ifeq ($(CONFIG_EFI_STUB), y) | 35 | ifeq ($(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 | ||
37 | endif | 38 | endif |
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 | |||
285 | static void find_bits(unsigned long mask, u8 *pos, u8 *size) | 283 | static void find_bits(unsigned long mask, u8 *pos, u8 *size) |
286 | { | 284 | { |
287 | u8 first, len; | 285 | u8 first, len; |
diff --git a/drivers/firmware/efi/Kconfig b/drivers/firmware/efi/Kconfig index 588dc47e7075..f712d47f30d8 100644 --- a/drivers/firmware/efi/Kconfig +++ b/drivers/firmware/efi/Kconfig | |||
@@ -57,6 +57,9 @@ config EFI_PARAMS_FROM_FDT | |||
57 | config EFI_RUNTIME_WRAPPERS | 57 | config EFI_RUNTIME_WRAPPERS |
58 | bool | 58 | bool |
59 | 59 | ||
60 | config EFI_ARMSTUB | ||
61 | bool | ||
62 | |||
60 | endmenu | 63 | endmenu |
61 | 64 | ||
62 | config UEFI_CPER | 65 | config UEFI_CPER |
diff --git a/drivers/firmware/efi/Makefile b/drivers/firmware/efi/Makefile index e1096539eedb..a204d1474cec 100644 --- a/drivers/firmware/efi/Makefile +++ b/drivers/firmware/efi/Makefile | |||
@@ -7,3 +7,4 @@ obj-$(CONFIG_EFI_VARS_PSTORE) += efi-pstore.o | |||
7 | obj-$(CONFIG_UEFI_CPER) += cper.o | 7 | obj-$(CONFIG_UEFI_CPER) += cper.o |
8 | obj-$(CONFIG_EFI_RUNTIME_MAP) += runtime-map.o | 8 | obj-$(CONFIG_EFI_RUNTIME_MAP) += runtime-map.o |
9 | obj-$(CONFIG_EFI_RUNTIME_WRAPPERS) += runtime-wrappers.o | 9 | obj-$(CONFIG_EFI_RUNTIME_WRAPPERS) += runtime-wrappers.o |
10 | obj-$(CONFIG_EFI_STUB) += libstub/ | ||
diff --git a/drivers/firmware/efi/libstub/Makefile b/drivers/firmware/efi/libstub/Makefile new file mode 100644 index 000000000000..b14bc2b9fb4d --- /dev/null +++ b/drivers/firmware/efi/libstub/Makefile | |||
@@ -0,0 +1,26 @@ | |||
1 | # | ||
2 | # The stub may be linked into the kernel proper or into a separate boot binary, | ||
3 | # but in either case, it executes before the kernel does (with MMU disabled) so | ||
4 | # things like ftrace and stack-protector are likely to cause trouble if left | ||
5 | # enabled, even if doing so doesn't break the build. | ||
6 | # | ||
7 | cflags-$(CONFIG_X86_32) := -march=i386 | ||
8 | cflags-$(CONFIG_X86_64) := -mcmodel=small | ||
9 | cflags-$(CONFIG_X86) += -m$(BITS) -D__KERNEL__ $(LINUX_INCLUDE) -O2 \ | ||
10 | -fPIC -fno-strict-aliasing -mno-red-zone \ | ||
11 | -mno-mmx -mno-sse -DDISABLE_BRANCH_PROFILING | ||
12 | |||
13 | cflags-$(CONFIG_ARM64) := $(subst -pg,,$(KBUILD_CFLAGS)) | ||
14 | cflags-$(CONFIG_ARM) := $(subst -pg,,$(KBUILD_CFLAGS)) \ | ||
15 | -fno-builtin -fpic -mno-single-pic-base | ||
16 | |||
17 | KBUILD_CFLAGS := $(cflags-y) \ | ||
18 | $(call cc-option,-ffreestanding) \ | ||
19 | $(call cc-option,-fno-stack-protector) | ||
20 | |||
21 | GCOV_PROFILE := n | ||
22 | |||
23 | lib-y := efi-stub-helper.o | ||
24 | lib-$(CONFIG_EFI_ARMSTUB) += arm-stub.o fdt.o | ||
25 | |||
26 | CFLAGS_fdt.o += -I$(srctree)/scripts/dtc/libfdt/ | ||
diff --git a/drivers/firmware/efi/arm-stub.c b/drivers/firmware/efi/libstub/arm-stub.c index 480339b6b110..480339b6b110 100644 --- a/drivers/firmware/efi/arm-stub.c +++ b/drivers/firmware/efi/libstub/arm-stub.c | |||
diff --git a/drivers/firmware/efi/efi-stub-helper.c b/drivers/firmware/efi/libstub/efi-stub-helper.c index 32d5cca30f49..32d5cca30f49 100644 --- a/drivers/firmware/efi/efi-stub-helper.c +++ b/drivers/firmware/efi/libstub/efi-stub-helper.c | |||
diff --git a/drivers/firmware/efi/efistub.h b/drivers/firmware/efi/libstub/efistub.h index 304ab295ca1a..304ab295ca1a 100644 --- a/drivers/firmware/efi/efistub.h +++ b/drivers/firmware/efi/libstub/efistub.h | |||
diff --git a/drivers/firmware/efi/fdt.c b/drivers/firmware/efi/libstub/fdt.c index 86d2934840e2..86d2934840e2 100644 --- a/drivers/firmware/efi/fdt.c +++ b/drivers/firmware/efi/libstub/fdt.c | |||