Clean up make process for EFI payload
Subsystems (2)
cover Clean up make process for EFI payload
Currently we have a single EFI application that we can deliver integrated into U-Boot. It is a hello world application that can be called with 'bootefi hello'.
The Makefiles do not easily accomodate further EFI payloads like a unit test for the EFI API or an EFI shell.
This patch series changes Makefile.lib to allow additional EFI payloads. Required fixes to the helloworld app are provided.
Further work will be needed to accomodate EFI payloads built out of multiple source files.
Heinrich Schuchardt (3):
efi_loader: rename __efi_hello_world_* scripts/Makefile.lib: generalize building built in EFI app
efi_loader: usage of always in Makefile
cmd/bootefi.c | 4 ++-- include/asm-generic/sections.h | 4 ++-- lib/efi_loader/Makefile | 5 +++-- scripts/Makefile.lib | 28 +++++++++++++++------------- 4 files changed, 22 insertions(+), 19 deletions(-)
Signature · 1 line
2.11.0
PATCH 1/3 efi_loader: rename __efi_hello_world_*
In scripts/Makefile.lib we build section including helloworld.efi. This allows to load the EFI binary with command 'bootefi hello'.
scripts/Makefile.lib contains explicit references to strings containing helloworld and hello_world. This makes it impossible to generalize the coding to accomodate additional built in EFI binaries.
Let us rename the variables __efi_hello_world_* to __efi_helloworld_*.
--- cmd/bootefi.c | 4 ++-- include/asm-generic/sections.h | 4 ++-- scripts/Makefile.lib | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-)
cmd/bootefi.c +2 -2
@@ -298,14 +298,14 @@ static int do_bootefi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])return CMD_RET_USAGE ;#ifdef CONFIG_CMD_BOOTEFI_HELLO if (!strcmp (argv[1 ],"hello" )) { -ulong size = __efi_hello_world_end - __efi_hello_world_begin; +ulong size = __efi_helloworld_end - __efi_helloworld_begin; saddr =env_get ("loadaddr" );if (saddr) addr =simple_strtoul (saddr,NULL ,16 );else addr =CONFIG_SYS_LOAD_ADDR ; -memcpy ((char *)addr, __efi_hello_world_begin, size); +memcpy ((char *)addr, __efi_helloworld_begin, size); } else#endif {
include/asm-generic/sections.h +2 -2
@@ -22,8 +22,8 @@ extern char __kprobes_text_start[], __kprobes_text_end[];extern char __entry_text_start[], __entry_text_end[];extern char __initdata_begin[], __initdata_end[];extern char __start_rodata[], __end_rodata[]; -extern char __efi_hello_world_begin[]; -extern char __efi_hello_world_end[]; +extern char __efi_helloworld_begin[]; +extern char __efi_helloworld_end[];/* Start and end of .ctors section - used for constructor calls. */ extern char __ctors_start[], __ctors_end[];
scripts/Makefile.lib +4 -4
@@ -350,11 +350,11 @@ cmd_S_efi= \ ( \ echo '.section .rodata.efi.init,"a"'; \ echo '.balign 16'; \ - echo '.global __efi_hello_world_begin'; \ - echo '__efi_hello_world_begin:'; \ + echo '.global __efi_helloworld_begin'; \ + echo '__efi_helloworld_begin:'; \ echo '.incbin "$<" '; \ - echo '__efi_hello_world_end:'; \ - echo '.global __efi_hello_world_end'; \ + echo '__efi_helloworld_end:'; \ + echo '.global __efi_helloworld_end'; \ echo '.balign 16'; \ ) > $@
Signature · 1 line
2.11.0
PATCH 1/3 efi_loader: rename __efi_hello_world_*
Quoted 11 lines · Heinrich Schuchardt
In
scripts/Makefile.libwe build section including helloworld.efi. This allows to load the EFI binary with command 'bootefi hello'.
scripts/Makefile.libcontains explicit references to strings containing helloworld andhello_world. This makes it impossible to generalize the coding to accomodate additional built in EFI binaries.Let us rename the variables __efi_hello_world_* to __efi_helloworld_*.
Quoted 7 lines
Signed-off-by Heinrich Schuchardt <[email protected]>--- cmd/bootefi.c | 4 ++-- include/asm-generic/sections.h | 4 ++-- scripts/Makefile.lib | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-)
PATCH 2/3 scripts/Makefile.lib: generalize building built in EFI app
In reply to Heinrich SchuchardtReplace all occurences of helloworld by generalized forms. This allows us to build additional EFI applications that are included into the U-Boot binary without loading scripts/Makefile.lib with specific filenames.
--- scripts/Makefile.lib | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-)
scripts/Makefile.lib +15 -13
@@ -342,20 +342,22 @@ cmd_S_ttf= \ $(obj)/%.S: $(src)/%.ttf $(call cmd,S_ttf) -# EFI Hello World application +# EFI applications +# A Makefile target *.efi is built as EFI application. +# A Makefile target *_efi.S wraps *.efi as built-in EFI application. # --------------------------------------------------------------------------- # Generate an assembly file to wrap the EFI app -cmd_S_efi= \ -( \ - echo '.section .rodata.efi.init,"a"'; \ - echo '.balign 16'; \ - echo '.global __efi_helloworld_begin'; \ - echo '__efi_helloworld_begin:'; \ - echo '.incbin "$<" '; \ - echo '__efi_helloworld_end:'; \ - echo '.global __efi_helloworld_end'; \ - echo '.balign 16'; \ +cmd_S_efi= \ +( \ + echo '.section .rodata.$*.init,"a"'; \ + echo '.balign 16'; \ + echo '.global __efi_$*_begin'; \ + echo '__efi_$*_begin:'; \ + echo '.incbin "$<" '; \ + echo '__efi_$*_end:'; \ + echo '.global __efi_$*_end'; \ + echo '.balign 16'; \ ) > $@ $(obj)/%_efi.S: $(obj)/%.efi
@@ -366,7 +368,7 @@ cmd_efi_objcopy = $(OBJCOPY) -j .header -j .text -j .sdata -j .data -j \ .dynamic -j .dynsym -j .rel* -j .rela* -j .reloc \ $(if $(EFI_TARGET),$(EFI_TARGET),-O binary) $^ $@ -$(obj)/%.efi: $(obj)/%.so +$(obj)/%.efi: $(obj)/%_efi.so $(call cmd,efi_objcopy) quiet_cmd_efi_ld = LD $@
@@ -375,7 +377,7 @@ cmd_efi_ld = $(LD) -nostdlib -znocombreloc -T $(EFI_LDS_PATH) -shared \ EFI_LDS_PATH = $(srctree)/arch/$(ARCH)/lib/$(EFI_LDS) -$(obj)/helloworld.so: $(obj)/helloworld.o arch/$(ARCH)/lib/$(EFI_CRT0) \ +$(obj)/%_efi.so: $(obj)/%.o $(%_deps) arch/$(ARCH)/lib/$(EFI_CRT0) \ arch/$(ARCH)/lib/$(EFI_RELOC) $(call cmd,efi_ld)
Signature · 1 line
2.11.0
PATCH 2/3 scripts/Makefile.lib: generalize building built in EFI app
Quoted 9 lines · Heinrich Schuchardt
Replace all occurences of helloworld by generalized forms. This allows us to build additional EFI applications that are included into the U-Boot binary without loading
scripts/Makefile.libwith specific filenames.Signed-off-by Heinrich Schuchardt <[email protected]>--- scripts/Makefile.lib | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-)
PATCH 3/3 efi_loader: usage of always in Makefile
In reply to Heinrich SchuchardtVariable always should only be appended but not overwritten by lib/efi_loader/Makefile.
Remove variable efiprogs which is not otherwise used.
--- lib/efi_loader/Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
lib/efi_loader/Makefile +3 -2
@@ -10,8 +10,9 @@ CFLAGS_helloworld.o := $(CFLAGS_EFI) CFLAGS_REMOVE_helloworld.o := $(CFLAGS_NON_EFI) -efiprogs-$(CONFIG_CMD_BOOTEFI_HELLO_COMPILE) += helloworld.efi -always := $(efiprogs-y) +ifneq ($(CONFIG_CMD_BOOTEFI_HELLO_COMPILE),) +always += helloworld.efi +endif obj-$(CONFIG_CMD_BOOTEFI_HELLO) += helloworld_efi.o obj-y += efi_image_loader.o efi_boottime.o efi_runtime.o efi_console.o
Signature · 1 line
2.11.0
PATCH 3/3 efi_loader: usage of always in Makefile
Quoted 9 lines · Heinrich Schuchardt
Variable always should only be appended but not overwritten by
lib/efi_loader/Makefile.Remove variable efiprogs which is not otherwise used.
Signed-off-by Heinrich Schuchardt <[email protected]>--- lib/efi_loader/Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
cover Clean up make process for EFI payload
In reply to Heinrich SchuchardtQuoted 7 lines · Heinrich Schuchardt
Currently we have a single EFI application that we can deliver integrated into U-Boot. It is a hello world application that can be called with 'bootefi hello'.
The Makefiles do not easily accomodate further EFI payloads like a unit test for the EFI API or an EFI shell.
Quoted 6 lines
This patch series changes Makefile.lib to allow additional EFI payloads. Required fixes to the helloworld app are provided.
Further work will be needed to accomodate EFI payloads built out of multiple source files.
Please, amend .gitignore, if needed, according to the changes.
Quoted 12 lines
Heinrich Schuchardt (3):
efi_loader: rename __efi_hello_world_*scripts/Makefile.lib: generalize building built in EFI app
efi_loader: usage of always inMakefilecmd/bootefi.c | 4 ++--
include/asm-generic/sections.h| 4 ++-- lib/efi_loader/Makefile | 5 +++-- scripts/Makefile.lib | 28 +++++++++++++++-------------4 files changed, 22 insertions(+), 19 deletions(-)
Signature · 2 lines
Andy Shevchenko <[email protected]> Intel Finland Oy
cover Clean up make process for EFI payload
Quoted 8 lines · Andy Shevchenko
Quoted 7 lines · Heinrich Schuchardt
Currently we have a single EFI application that we can deliver integrated into U-Boot. It is a hello world application that can be called with 'bootefi hello'.
The Makefiles do not easily accomodate further EFI payloads like a unit test for the EFI API or an EFI shell.
Quoted 8 lines
Quoted 6 lines
This patch series changes Makefile.lib to allow additional EFI payloads. Required fixes to the helloworld app are provided.
Further work will be needed to accomodate EFI payloads built out of multiple source files.
Please, amend .gitignore, if needed, according to the changes.
In this old version of the patch series no new files are created.
In the v2 version dependency files are created/updated which we want to add to the source repository keep.
Best regards
Heinrich
Quoted 14 lines
Quoted 13 lines
Heinrich Schuchardt (3):
efi_loader: rename __efi_hello_world_*scripts/Makefile.lib: generalize building built in EFI app
efi_loader: usage of always inMakefilecmd/bootefi.c | 4 ++-- include/asm-generic/sections.h | 4 ++-- lib/efi_loader/Makefile | 5 +++-- scripts/Makefile.lib | 28 +++++++++++++++------------- 4 files changed, 22 insertions(+), 19 deletions(-)