diff options
-rw-r--r-- | arch/arm64/kernel/efi-stub.c | 14 | ||||
-rw-r--r-- | drivers/firmware/efi/libstub/Makefile | 14 | ||||
-rw-r--r-- | drivers/firmware/efi/libstub/arm-stub.c | 8 | ||||
-rw-r--r-- | drivers/firmware/efi/libstub/efi-stub-helper.c | 2 |
4 files changed, 26 insertions, 12 deletions
diff --git a/arch/arm64/kernel/efi-stub.c b/arch/arm64/kernel/efi-stub.c index d27dd982ff26..f5374065ad53 100644 --- a/arch/arm64/kernel/efi-stub.c +++ b/arch/arm64/kernel/efi-stub.c | |||
@@ -13,13 +13,13 @@ | |||
13 | #include <asm/efi.h> | 13 | #include <asm/efi.h> |
14 | #include <asm/sections.h> | 14 | #include <asm/sections.h> |
15 | 15 | ||
16 | efi_status_t handle_kernel_image(efi_system_table_t *sys_table, | 16 | efi_status_t __init handle_kernel_image(efi_system_table_t *sys_table, |
17 | unsigned long *image_addr, | 17 | unsigned long *image_addr, |
18 | unsigned long *image_size, | 18 | unsigned long *image_size, |
19 | unsigned long *reserve_addr, | 19 | unsigned long *reserve_addr, |
20 | unsigned long *reserve_size, | 20 | unsigned long *reserve_size, |
21 | unsigned long dram_base, | 21 | unsigned long dram_base, |
22 | efi_loaded_image_t *image) | 22 | efi_loaded_image_t *image) |
23 | { | 23 | { |
24 | efi_status_t status; | 24 | efi_status_t status; |
25 | unsigned long kernel_size, kernel_memsize = 0; | 25 | unsigned long kernel_size, kernel_memsize = 0; |
diff --git a/drivers/firmware/efi/libstub/Makefile b/drivers/firmware/efi/libstub/Makefile index b14bc2b9fb4d..8902f52e0998 100644 --- a/drivers/firmware/efi/libstub/Makefile +++ b/drivers/firmware/efi/libstub/Makefile | |||
@@ -24,3 +24,17 @@ lib-y := efi-stub-helper.o | |||
24 | lib-$(CONFIG_EFI_ARMSTUB) += arm-stub.o fdt.o | 24 | lib-$(CONFIG_EFI_ARMSTUB) += arm-stub.o fdt.o |
25 | 25 | ||
26 | CFLAGS_fdt.o += -I$(srctree)/scripts/dtc/libfdt/ | 26 | CFLAGS_fdt.o += -I$(srctree)/scripts/dtc/libfdt/ |
27 | |||
28 | # | ||
29 | # arm64 puts the stub in the kernel proper, which will unnecessarily retain all | ||
30 | # code indefinitely unless it is annotated as __init/__initdata/__initconst etc. | ||
31 | # So let's apply the __init annotations at the section level, by prefixing | ||
32 | # the section names directly. This will ensure that even all the inline string | ||
33 | # literals are covered. | ||
34 | # | ||
35 | extra-$(CONFIG_ARM64) := $(lib-y) | ||
36 | lib-$(CONFIG_ARM64) := $(patsubst %.o,%.init.o,$(lib-y)) | ||
37 | |||
38 | OBJCOPYFLAGS := --prefix-alloc-sections=.init | ||
39 | $(obj)/%.init.o: $(obj)/%.o FORCE | ||
40 | $(call if_changed,objcopy) | ||
diff --git a/drivers/firmware/efi/libstub/arm-stub.c b/drivers/firmware/efi/libstub/arm-stub.c index 75ee05964cbc..a1fda71c425a 100644 --- a/drivers/firmware/efi/libstub/arm-stub.c +++ b/drivers/firmware/efi/libstub/arm-stub.c | |||
@@ -17,10 +17,10 @@ | |||
17 | 17 | ||
18 | #include "efistub.h" | 18 | #include "efistub.h" |
19 | 19 | ||
20 | static int __init efi_secureboot_enabled(efi_system_table_t *sys_table_arg) | 20 | static int efi_secureboot_enabled(efi_system_table_t *sys_table_arg) |
21 | { | 21 | { |
22 | static efi_guid_t const var_guid __initconst = EFI_GLOBAL_VARIABLE_GUID; | 22 | static efi_guid_t const var_guid = EFI_GLOBAL_VARIABLE_GUID; |
23 | static efi_char16_t const var_name[] __initconst = { | 23 | static efi_char16_t const var_name[] = { |
24 | 'S', 'e', 'c', 'u', 'r', 'e', 'B', 'o', 'o', 't', 0 }; | 24 | 'S', 'e', 'c', 'u', 'r', 'e', 'B', 'o', 'o', 't', 0 }; |
25 | 25 | ||
26 | efi_get_variable_t *f_getvar = sys_table_arg->runtime->get_variable; | 26 | efi_get_variable_t *f_getvar = sys_table_arg->runtime->get_variable; |
@@ -164,7 +164,7 @@ efi_status_t handle_kernel_image(efi_system_table_t *sys_table, | |||
164 | * for both archictectures, with the arch-specific code provided in the | 164 | * for both archictectures, with the arch-specific code provided in the |
165 | * handle_kernel_image() function. | 165 | * handle_kernel_image() function. |
166 | */ | 166 | */ |
167 | unsigned long __init efi_entry(void *handle, efi_system_table_t *sys_table, | 167 | unsigned long efi_entry(void *handle, efi_system_table_t *sys_table, |
168 | unsigned long *image_addr) | 168 | unsigned long *image_addr) |
169 | { | 169 | { |
170 | efi_loaded_image_t *image; | 170 | efi_loaded_image_t *image; |
diff --git a/drivers/firmware/efi/libstub/efi-stub-helper.c b/drivers/firmware/efi/libstub/efi-stub-helper.c index a920fec8fe88..9bd9fbb5bea8 100644 --- a/drivers/firmware/efi/libstub/efi-stub-helper.c +++ b/drivers/firmware/efi/libstub/efi-stub-helper.c | |||
@@ -101,7 +101,7 @@ fail: | |||
101 | } | 101 | } |
102 | 102 | ||
103 | 103 | ||
104 | unsigned long __init get_dram_base(efi_system_table_t *sys_table_arg) | 104 | unsigned long get_dram_base(efi_system_table_t *sys_table_arg) |
105 | { | 105 | { |
106 | efi_status_t status; | 106 | efi_status_t status; |
107 | unsigned long map_size; | 107 | unsigned long map_size; |