Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[efi] Use elf2efi utility in place of efilink
elf2efi converts a suitable ELF executable (containing relocation
information, and with appropriate virtual addresses) into an EFI
executable.  It is less tightly coupled with the gPXE build process
and, in particular, does not require the use of a hand-crafted PE
image header in efiprefix.S.

elf2efi correctly handles .bss sections, which significantly reduces
the size of the gPXE EFI executable.
  • Loading branch information
Michael Brown committed Jan 7, 2009
1 parent 85e5e25 commit 314779e
Show file tree
Hide file tree
Showing 16 changed files with 939 additions and 1,258 deletions.
3 changes: 2 additions & 1 deletion src/Makefile
Expand Up @@ -37,7 +37,8 @@ SYMCHECK := $(PERL) ./util/symcheck.pl
SORTOBJDUMP := $(PERL) ./util/sortobjdump.pl
NRV2B := ./util/nrv2b
ZBIN := ./util/zbin
EFILINK := ./util/efilink
ELF2EFI32 := ./util/elf2efi32
ELF2EFI64 := ./util/elf2efi64
DOXYGEN := doxygen

###############################################################################
Expand Down
13 changes: 9 additions & 4 deletions src/Makefile.housekeeping
Expand Up @@ -703,12 +703,17 @@ CLEANUP += $(ZBIN)

###############################################################################
#
# The EFI custom linker
# The EFI image converter
#
$(EFILINK) : util/efilink.c $(MAKEDEPS)
$(ELF2EFI32) : util/elf2efi.c $(MAKEDEPS)
$(QM)$(ECHO) " [HOSTCC] $@"
$(Q)$(HOST_CC) -O2 -o $@ $< -lbfd -liberty
CLEANUP += $(EFILINK)
$(Q)$(HOST_CC) -DMDE_CPU_IA32 -O2 -o $@ $< -lbfd -liberty
CLEANUP += $(ELF2EFI32)

$(ELF2EFI64) : util/elf2efi.c $(MAKEDEPS)
$(QM)$(ECHO) " [HOSTCC] $@"
$(Q)$(HOST_CC) -DMDE_CPU_X64 -O2 -o $@ $< -lbfd -liberty
CLEANUP += $(ELF2EFI64)

###############################################################################
#
Expand Down
16 changes: 5 additions & 11 deletions src/arch/i386/Makefile.efi
Expand Up @@ -2,24 +2,18 @@

# The EFI linker script
#
LDSCRIPT = arch/i386/scripts/efi.lds
LDSCRIPT = arch/x86/scripts/efi.lds

# Use a relocatable link; we perform final relocations in the efilink utility.
# Retain relocation information for elf2efi
#
LDFLAGS += -r -d -S
LDFLAGS += -q -S

# Media types.
#
NON_AUTO_MEDIA += efi

# Rule for building EFI files
#
$(BIN)/%.efi.tmp-reloc : $(BIN)/%.efi.tmp $(EFILINK)
$(QM)$(ECHO) " [EFILINK] $@"
$(Q)# Check for unresolved symbols
$(Q)$(LD) -e 0 --no-warn-mismatch -o /dev/null $<
$(Q)$(EFILINK) $< $@

$(BIN)/%.efi : $(BIN)/%.efi.tmp-reloc
$(BIN)/%.efi : $(BIN)/%.efi.tmp $(ELF2EFI32)
$(QM)$(ECHO) " [FINISH] $@"
$(Q)$(OBJCOPY) -Obinary $< $@
$(Q)$(ELF2EFI32) $< $@
175 changes: 0 additions & 175 deletions src/arch/i386/prefix/efiprefix.S

This file was deleted.

0 comments on commit 314779e

Please sign in to comment.